Move mapping:: related mocks to cartographer/internal/testing. (#960)

master
Alexander Belyaev 2018-03-05 14:09:04 +01:00 committed by GitHub
parent f76d8a8a0d
commit cf180a0b19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 22 deletions

View File

@ -19,10 +19,10 @@
#include "cartographer/cloud/client/map_builder_stub.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/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 "glog/logging.h"
#include "gmock/gmock.h"
@ -32,6 +32,8 @@ using ::cartographer::mapping::MapBuilder;
using ::cartographer::mapping::MapBuilderInterface;
using ::cartographer::mapping::PoseGraphInterface;
using ::cartographer::mapping::TrajectoryBuilderInterface;
using ::cartographer::mapping::testing::MockMapBuilder;
using ::cartographer::mapping::testing::MockTrajectoryBuilder;
using ::testing::_;
using SensorId = ::cartographer::mapping::TrajectoryBuilderInterface::SensorId;
@ -92,13 +94,12 @@ class ClientServerTest : public ::testing::Test {
}
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();
server_ = common::make_unique<MapBuilderServer>(
map_builder_server_options_, std::move(mock_map_builder));
EXPECT_TRUE(server_ != nullptr);
mock_trajectory_builder_ =
common::make_unique<testing::MockTrajectoryBuilder>();
mock_trajectory_builder_ = common::make_unique<MockTrajectoryBuilder>();
}
void InitializeStub() {
@ -114,8 +115,8 @@ class ClientServerTest : public ::testing::Test {
}
proto::MapBuilderServerOptions map_builder_server_options_;
testing::MockMapBuilder* mock_map_builder_;
std::unique_ptr<testing::MockTrajectoryBuilder> mock_trajectory_builder_;
MockMapBuilder* mock_map_builder_;
std::unique_ptr<MockTrajectoryBuilder> mock_trajectory_builder_;
::cartographer::mapping::proto::TrajectoryBuilderOptions
trajectory_builder_options_;
std::unique_ptr<MapBuilderServer> server_;

View File

@ -17,8 +17,8 @@
#include "cartographer/cloud/internal/handlers/add_trajectory_handler.h"
#include "cartographer/cloud/internal/sensor/serialization.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/mapping/internal/testing/mock_map_builder.h"
#include "google/protobuf/text_format.h"
#include "gtest/gtest.h"
@ -70,7 +70,7 @@ class AddTrajectoryHandlerTest
public:
void SetUp() override {
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_,
GetLocalSlamResultCallbackForSubscriptions())
.WillOnce(Return(nullptr));
@ -88,7 +88,7 @@ class AddTrajectoryHandlerTest
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) {

View File

@ -19,11 +19,11 @@
#include "cartographer/cloud/internal/framework/testing/rpc_handler_test_server.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 "mock_local_trajectory_uploader.h"
#include "mock_map_builder.h"
#include "mock_map_builder_context.h"
#include "mock_pose_graph.h"
namespace cartographer {
namespace cloud {
@ -44,8 +44,8 @@ class HandlerTest : public Test {
->template GetUnsynchronizedContext<MockMapBuilderContext>();
mock_local_trajectory_uploader_ =
common::make_unique<MockLocalTrajectoryUploader>();
mock_map_builder_ = common::make_unique<MockMapBuilder>();
mock_pose_graph_ = common::make_unique<MockPoseGraph>();
mock_map_builder_ = common::make_unique<mapping::testing::MockMapBuilder>();
mock_pose_graph_ = common::make_unique<mapping::testing::MockPoseGraph>();
EXPECT_CALL(*mock_map_builder_context_, map_builder())
.Times(::testing::AnyNumber())
@ -70,8 +70,8 @@ class HandlerTest : public Test {
test_server_;
MockMapBuilderContext* mock_map_builder_context_;
std::unique_ptr<MockLocalTrajectoryUploader> mock_local_trajectory_uploader_;
std::unique_ptr<MockMapBuilder> mock_map_builder_;
std::unique_ptr<MockPoseGraph> mock_pose_graph_;
std::unique_ptr<mapping::testing::MockMapBuilder> mock_map_builder_;
std::unique_ptr<mapping::testing::MockPoseGraph> mock_pose_graph_;
};
} // namespace testing

View File

@ -26,7 +26,7 @@
using testing::_;
namespace cartographer {
namespace cloud {
namespace mapping {
namespace testing {
class MockMapBuilder : public mapping::MapBuilderInterface {
@ -57,7 +57,7 @@ class MockMapBuilder : public mapping::MapBuilderInterface {
};
} // namespace testing
} // namespace cloud
} // namespace mapping
} // namespace cartographer
#endif // CARTOGRAPHER_GRPC_INTERNAL_TESTING_MOCK_MAP_BUILDER_H

View File

@ -23,7 +23,7 @@
#include "gtest/gtest.h"
namespace cartographer {
namespace cloud {
namespace mapping {
namespace testing {
class MockPoseGraph : public mapping::PoseGraphInterface {
@ -51,7 +51,7 @@ class MockPoseGraph : public mapping::PoseGraphInterface {
};
} // namespace testing
} // namespace cloud
} // namespace mapping
} // namespace cartographer
#endif // CARTOGRAPHER_GRPC_INTERNAL_TESTING_MOCK_POSE_GRAPH_H

View File

@ -23,7 +23,7 @@
#include "gtest/gtest.h"
namespace cartographer {
namespace cloud {
namespace mapping {
namespace testing {
class MockTrajectoryBuilder : public mapping::TrajectoryBuilderInterface {
@ -52,7 +52,7 @@ class MockTrajectoryBuilder : public mapping::TrajectoryBuilderInterface {
};
} // namespace testing
} // namespace cloud
} // namespace mapping
} // namespace cartographer
#endif // CARTOGRAPHER_GRPC_INTERNAL_TESTING_MOCK_TRAJECTORY_BUILDER_CONTEXT_H