Move mapping:: related mocks to cartographer/internal/testing. (#960)
parent
f76d8a8a0d
commit
cf180a0b19
|
@ -19,10 +19,10 @@
|
||||||
|
|
||||||
#include "cartographer/cloud/client/map_builder_stub.h"
|
#include "cartographer/cloud/client/map_builder_stub.h"
|
||||||
#include "cartographer/cloud/internal/map_builder_server.h"
|
#include "cartographer/cloud/internal/map_builder_server.h"
|
||||||
#include "cartographer/cloud/internal/testing/mock_map_builder.h"
|
|
||||||
#include "cartographer/cloud/internal/testing/mock_trajectory_builder.h"
|
|
||||||
#include "cartographer/cloud/map_builder_server_options.h"
|
#include "cartographer/cloud/map_builder_server_options.h"
|
||||||
#include "cartographer/mapping/internal/test_helpers.h"
|
#include "cartographer/mapping/internal/test_helpers.h"
|
||||||
|
#include "cartographer/mapping/internal/testing/mock_map_builder.h"
|
||||||
|
#include "cartographer/mapping/internal/testing/mock_trajectory_builder.h"
|
||||||
#include "cartographer/mapping/local_slam_result_data.h"
|
#include "cartographer/mapping/local_slam_result_data.h"
|
||||||
#include "glog/logging.h"
|
#include "glog/logging.h"
|
||||||
#include "gmock/gmock.h"
|
#include "gmock/gmock.h"
|
||||||
|
@ -32,6 +32,8 @@ using ::cartographer::mapping::MapBuilder;
|
||||||
using ::cartographer::mapping::MapBuilderInterface;
|
using ::cartographer::mapping::MapBuilderInterface;
|
||||||
using ::cartographer::mapping::PoseGraphInterface;
|
using ::cartographer::mapping::PoseGraphInterface;
|
||||||
using ::cartographer::mapping::TrajectoryBuilderInterface;
|
using ::cartographer::mapping::TrajectoryBuilderInterface;
|
||||||
|
using ::cartographer::mapping::testing::MockMapBuilder;
|
||||||
|
using ::cartographer::mapping::testing::MockTrajectoryBuilder;
|
||||||
using ::testing::_;
|
using ::testing::_;
|
||||||
using SensorId = ::cartographer::mapping::TrajectoryBuilderInterface::SensorId;
|
using SensorId = ::cartographer::mapping::TrajectoryBuilderInterface::SensorId;
|
||||||
|
|
||||||
|
@ -92,13 +94,12 @@ class ClientServerTest : public ::testing::Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializeServerWithMockMapBuilder() {
|
void InitializeServerWithMockMapBuilder() {
|
||||||
auto mock_map_builder = common::make_unique<testing::MockMapBuilder>();
|
auto mock_map_builder = common::make_unique<MockMapBuilder>();
|
||||||
mock_map_builder_ = mock_map_builder.get();
|
mock_map_builder_ = mock_map_builder.get();
|
||||||
server_ = common::make_unique<MapBuilderServer>(
|
server_ = common::make_unique<MapBuilderServer>(
|
||||||
map_builder_server_options_, std::move(mock_map_builder));
|
map_builder_server_options_, std::move(mock_map_builder));
|
||||||
EXPECT_TRUE(server_ != nullptr);
|
EXPECT_TRUE(server_ != nullptr);
|
||||||
mock_trajectory_builder_ =
|
mock_trajectory_builder_ = common::make_unique<MockTrajectoryBuilder>();
|
||||||
common::make_unique<testing::MockTrajectoryBuilder>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializeStub() {
|
void InitializeStub() {
|
||||||
|
@ -114,8 +115,8 @@ class ClientServerTest : public ::testing::Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
proto::MapBuilderServerOptions map_builder_server_options_;
|
proto::MapBuilderServerOptions map_builder_server_options_;
|
||||||
testing::MockMapBuilder* mock_map_builder_;
|
MockMapBuilder* mock_map_builder_;
|
||||||
std::unique_ptr<testing::MockTrajectoryBuilder> mock_trajectory_builder_;
|
std::unique_ptr<MockTrajectoryBuilder> mock_trajectory_builder_;
|
||||||
::cartographer::mapping::proto::TrajectoryBuilderOptions
|
::cartographer::mapping::proto::TrajectoryBuilderOptions
|
||||||
trajectory_builder_options_;
|
trajectory_builder_options_;
|
||||||
std::unique_ptr<MapBuilderServer> server_;
|
std::unique_ptr<MapBuilderServer> server_;
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
#include "cartographer/cloud/internal/handlers/add_trajectory_handler.h"
|
#include "cartographer/cloud/internal/handlers/add_trajectory_handler.h"
|
||||||
#include "cartographer/cloud/internal/sensor/serialization.h"
|
#include "cartographer/cloud/internal/sensor/serialization.h"
|
||||||
#include "cartographer/cloud/internal/testing/handler_test.h"
|
#include "cartographer/cloud/internal/testing/handler_test.h"
|
||||||
#include "cartographer/cloud/internal/testing/mock_map_builder.h"
|
|
||||||
#include "cartographer/cloud/internal/testing/test_helpers.h"
|
#include "cartographer/cloud/internal/testing/test_helpers.h"
|
||||||
|
#include "cartographer/mapping/internal/testing/mock_map_builder.h"
|
||||||
#include "google/protobuf/text_format.h"
|
#include "google/protobuf/text_format.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ class AddTrajectoryHandlerTest
|
||||||
public:
|
public:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
testing::HandlerTest<AddTrajectoryHandler>::SetUp();
|
testing::HandlerTest<AddTrajectoryHandler>::SetUp();
|
||||||
mock_map_builder_ = common::make_unique<testing::MockMapBuilder>();
|
mock_map_builder_ = common::make_unique<mapping::testing::MockMapBuilder>();
|
||||||
EXPECT_CALL(*mock_map_builder_context_,
|
EXPECT_CALL(*mock_map_builder_context_,
|
||||||
GetLocalSlamResultCallbackForSubscriptions())
|
GetLocalSlamResultCallbackForSubscriptions())
|
||||||
.WillOnce(Return(nullptr));
|
.WillOnce(Return(nullptr));
|
||||||
|
@ -88,7 +88,7 @@ class AddTrajectoryHandlerTest
|
||||||
return expected_sensor_ids;
|
return expected_sensor_ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<testing::MockMapBuilder> mock_map_builder_;
|
std::unique_ptr<mapping::testing::MockMapBuilder> mock_map_builder_;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(AddTrajectoryHandlerTest, NoLocalSlamUploader) {
|
TEST_F(AddTrajectoryHandlerTest, NoLocalSlamUploader) {
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
|
|
||||||
#include "cartographer/cloud/internal/framework/testing/rpc_handler_test_server.h"
|
#include "cartographer/cloud/internal/framework/testing/rpc_handler_test_server.h"
|
||||||
#include "cartographer/common/make_unique.h"
|
#include "cartographer/common/make_unique.h"
|
||||||
|
#include "cartographer/mapping/internal/testing/mock_map_builder.h"
|
||||||
|
#include "cartographer/mapping/internal/testing/mock_pose_graph.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "mock_local_trajectory_uploader.h"
|
#include "mock_local_trajectory_uploader.h"
|
||||||
#include "mock_map_builder.h"
|
|
||||||
#include "mock_map_builder_context.h"
|
#include "mock_map_builder_context.h"
|
||||||
#include "mock_pose_graph.h"
|
|
||||||
|
|
||||||
namespace cartographer {
|
namespace cartographer {
|
||||||
namespace cloud {
|
namespace cloud {
|
||||||
|
@ -44,8 +44,8 @@ class HandlerTest : public Test {
|
||||||
->template GetUnsynchronizedContext<MockMapBuilderContext>();
|
->template GetUnsynchronizedContext<MockMapBuilderContext>();
|
||||||
mock_local_trajectory_uploader_ =
|
mock_local_trajectory_uploader_ =
|
||||||
common::make_unique<MockLocalTrajectoryUploader>();
|
common::make_unique<MockLocalTrajectoryUploader>();
|
||||||
mock_map_builder_ = common::make_unique<MockMapBuilder>();
|
mock_map_builder_ = common::make_unique<mapping::testing::MockMapBuilder>();
|
||||||
mock_pose_graph_ = common::make_unique<MockPoseGraph>();
|
mock_pose_graph_ = common::make_unique<mapping::testing::MockPoseGraph>();
|
||||||
|
|
||||||
EXPECT_CALL(*mock_map_builder_context_, map_builder())
|
EXPECT_CALL(*mock_map_builder_context_, map_builder())
|
||||||
.Times(::testing::AnyNumber())
|
.Times(::testing::AnyNumber())
|
||||||
|
@ -70,8 +70,8 @@ class HandlerTest : public Test {
|
||||||
test_server_;
|
test_server_;
|
||||||
MockMapBuilderContext* mock_map_builder_context_;
|
MockMapBuilderContext* mock_map_builder_context_;
|
||||||
std::unique_ptr<MockLocalTrajectoryUploader> mock_local_trajectory_uploader_;
|
std::unique_ptr<MockLocalTrajectoryUploader> mock_local_trajectory_uploader_;
|
||||||
std::unique_ptr<MockMapBuilder> mock_map_builder_;
|
std::unique_ptr<mapping::testing::MockMapBuilder> mock_map_builder_;
|
||||||
std::unique_ptr<MockPoseGraph> mock_pose_graph_;
|
std::unique_ptr<mapping::testing::MockPoseGraph> mock_pose_graph_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
using testing::_;
|
using testing::_;
|
||||||
|
|
||||||
namespace cartographer {
|
namespace cartographer {
|
||||||
namespace cloud {
|
namespace mapping {
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
class MockMapBuilder : public mapping::MapBuilderInterface {
|
class MockMapBuilder : public mapping::MapBuilderInterface {
|
||||||
|
@ -57,7 +57,7 @@ class MockMapBuilder : public mapping::MapBuilderInterface {
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
} // namespace cloud
|
} // namespace mapping
|
||||||
} // namespace cartographer
|
} // namespace cartographer
|
||||||
|
|
||||||
#endif // CARTOGRAPHER_GRPC_INTERNAL_TESTING_MOCK_MAP_BUILDER_H
|
#endif // CARTOGRAPHER_GRPC_INTERNAL_TESTING_MOCK_MAP_BUILDER_H
|
|
@ -23,7 +23,7 @@
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
namespace cartographer {
|
namespace cartographer {
|
||||||
namespace cloud {
|
namespace mapping {
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
class MockPoseGraph : public mapping::PoseGraphInterface {
|
class MockPoseGraph : public mapping::PoseGraphInterface {
|
||||||
|
@ -51,7 +51,7 @@ class MockPoseGraph : public mapping::PoseGraphInterface {
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
} // namespace cloud
|
} // namespace mapping
|
||||||
} // namespace cartographer
|
} // namespace cartographer
|
||||||
|
|
||||||
#endif // CARTOGRAPHER_GRPC_INTERNAL_TESTING_MOCK_POSE_GRAPH_H
|
#endif // CARTOGRAPHER_GRPC_INTERNAL_TESTING_MOCK_POSE_GRAPH_H
|
|
@ -23,7 +23,7 @@
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
namespace cartographer {
|
namespace cartographer {
|
||||||
namespace cloud {
|
namespace mapping {
|
||||||
namespace testing {
|
namespace testing {
|
||||||
|
|
||||||
class MockTrajectoryBuilder : public mapping::TrajectoryBuilderInterface {
|
class MockTrajectoryBuilder : public mapping::TrajectoryBuilderInterface {
|
||||||
|
@ -52,7 +52,7 @@ class MockTrajectoryBuilder : public mapping::TrajectoryBuilderInterface {
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
} // namespace cloud
|
} // namespace mapping
|
||||||
} // namespace cartographer
|
} // namespace cartographer
|
||||||
|
|
||||||
#endif // CARTOGRAPHER_GRPC_INTERNAL_TESTING_MOCK_TRAJECTORY_BUILDER_CONTEXT_H
|
#endif // CARTOGRAPHER_GRPC_INTERNAL_TESTING_MOCK_TRAJECTORY_BUILDER_CONTEXT_H
|
Loading…
Reference in New Issue