Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "cartographer/cloud/internal/handlers/add_rangefinder_data_handler.h"
00018
00019 #include "cartographer/cloud/internal/testing/handler_test.h"
00020 #include "cartographer/cloud/internal/testing/test_helpers.h"
00021 #include "google/protobuf/text_format.h"
00022 #include "gtest/gtest.h"
00023
00024 namespace cartographer {
00025 namespace cloud {
00026 namespace handlers {
00027 namespace {
00028
00029 using ::testing::_;
00030 using ::testing::Eq;
00031 using ::testing::Pointee;
00032 using ::testing::Truly;
00033
00034 const std::string kMessage = R"(
00035 sensor_metadata {
00036 trajectory_id: 1
00037 sensor_id: "sensor_id"
00038 }
00039 timed_point_cloud_data {
00040 timestamp: 2
00041 origin {
00042 x: 3.f y: 4.f z: 5.f
00043 }
00044 point_data {
00045 position {
00046 x: 6.f y: 7.f z: 8.f
00047 }
00048 time: 9.f
00049 }
00050 })";
00051
00052 using AddRangefinderDataHandlerTest =
00053 testing::HandlerTest<AddRangefinderDataSignature,
00054 AddRangefinderDataHandler>;
00055
00056 TEST_F(AddRangefinderDataHandlerTest, NoLocalSlamUploader) {
00057 proto::AddRangefinderDataRequest request;
00058 EXPECT_TRUE(
00059 google::protobuf::TextFormat::ParseFromString(kMessage, &request));
00060 EXPECT_CALL(
00061 *mock_map_builder_context_,
00062 CheckClientIdForTrajectory(Eq(request.sensor_metadata().client_id()),
00063 Eq(request.sensor_metadata().trajectory_id())))
00064 .WillOnce(::testing::Return(true));
00065 EXPECT_CALL(*mock_map_builder_context_,
00066 DoEnqueueSensorData(
00067 Eq(request.sensor_metadata().trajectory_id()),
00068 Pointee(Truly(testing::BuildDataPredicateEquals(request)))));
00069 test_server_->SendWrite(request);
00070 test_server_->SendWritesDone();
00071 test_server_->SendFinish();
00072 }
00073
00074 }
00075 }
00076 }
00077 }