20 #include "google/protobuf/text_format.h" 21 #include "gtest/gtest.h" 30 using ::testing::Pointee;
31 using ::testing::Truly;
33 const std::string kMessage = R
"( 36 sensor_id: "sensor_id" 48 using AddImuDataHandlerTest =
49 testing::HandlerTest<AddImuDataSignature, AddImuDataHandler>;
51 TEST_F(AddImuDataHandlerTest, NoLocalSlamUploader) {
52 proto::AddImuDataRequest request;
54 google::protobuf::TextFormat::ParseFromString(kMessage, &request));
55 SetNoLocalTrajectoryUploader();
56 EXPECT_CALL(*mock_map_builder_context_,
58 Eq(request.sensor_metadata().trajectory_id()),
60 test_server_->SendWrite(request);
61 test_server_->SendWritesDone();
62 test_server_->SendFinish();
65 TEST_F(AddImuDataHandlerTest, WithMockLocalSlamUploader) {
66 proto::AddImuDataRequest request;
68 google::protobuf::TextFormat::ParseFromString(kMessage, &request));
69 SetMockLocalTrajectoryUploader();
70 EXPECT_CALL(*mock_map_builder_context_,
72 Eq(request.sensor_metadata().trajectory_id()),
74 proto::SensorData sensor_data;
75 *sensor_data.mutable_sensor_metadata() = request.sensor_metadata();
76 *sensor_data.mutable_imu_data() = request.imu_data();
77 EXPECT_CALL(*mock_local_trajectory_uploader_,
78 DoEnqueueSensorData(Pointee(
80 test_server_->SendWrite(request);
81 test_server_->SendWritesDone();
82 test_server_->SendFinish();
DataPredicateType BuildDataPredicateEquals(const T &proto)
ProtoPredicateType BuildProtoPredicateEquals(const google::protobuf::Message *proto)