| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/sync/driver/frontend_data_type_controller.h" | 5 #include "components/sync/driver/frontend_data_type_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/memory/ptr_util.h" |
| 11 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 12 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 13 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 15 #include "base/tracked_objects.h" | 16 #include "base/tracked_objects.h" |
| 16 #include "components/sync/driver/change_processor_mock.h" | 17 #include "components/sync/driver/change_processor_mock.h" |
| 17 #include "components/sync/driver/data_type_controller_mock.h" | 18 #include "components/sync/driver/data_type_controller_mock.h" |
| 18 #include "components/sync/driver/fake_sync_client.h" | 19 #include "components/sync/driver/fake_sync_client.h" |
| 19 #include "components/sync/driver/fake_sync_service.h" | 20 #include "components/sync/driver/fake_sync_service.h" |
| 20 #include "components/sync/driver/frontend_data_type_controller_mock.h" | 21 #include "components/sync/driver/frontend_data_type_controller_mock.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 67 |
| 67 class SyncFrontendDataTypeControllerTest : public testing::Test { | 68 class SyncFrontendDataTypeControllerTest : public testing::Test { |
| 68 public: | 69 public: |
| 69 SyncFrontendDataTypeControllerTest() | 70 SyncFrontendDataTypeControllerTest() |
| 70 : model_associator_(new ModelAssociatorMock()), | 71 : model_associator_(new ModelAssociatorMock()), |
| 71 change_processor_(new ChangeProcessorMock()), | 72 change_processor_(new ChangeProcessorMock()), |
| 72 components_factory_(model_associator_, change_processor_), | 73 components_factory_(model_associator_, change_processor_), |
| 73 sync_client_(&components_factory_) {} | 74 sync_client_(&components_factory_) {} |
| 74 | 75 |
| 75 void SetUp() override { | 76 void SetUp() override { |
| 76 dtc_mock_.reset(new StrictMock<FrontendDataTypeControllerMock>()); | 77 dtc_mock_ = base::MakeUnique<StrictMock<FrontendDataTypeControllerMock>>(); |
| 77 frontend_dtc_.reset( | 78 frontend_dtc_ = base::MakeUnique<FrontendDataTypeControllerFake>( |
| 78 new FrontendDataTypeControllerFake(&sync_client_, dtc_mock_.get())); | 79 &sync_client_, dtc_mock_.get()); |
| 79 } | 80 } |
| 80 | 81 |
| 81 protected: | 82 protected: |
| 82 void SetStartExpectations() { | 83 void SetStartExpectations() { |
| 83 EXPECT_CALL(*dtc_mock_.get(), StartModels()).WillOnce(Return(true)); | 84 EXPECT_CALL(*dtc_mock_.get(), StartModels()).WillOnce(Return(true)); |
| 84 EXPECT_CALL(model_load_callback_, Run(_, _)); | 85 EXPECT_CALL(model_load_callback_, Run(_, _)); |
| 85 } | 86 } |
| 86 | 87 |
| 87 void SetAssociateExpectations() { | 88 void SetAssociateExpectations() { |
| 88 EXPECT_CALL(*model_associator_, CryptoReadyIfNecessary()) | 89 EXPECT_CALL(*model_associator_, CryptoReadyIfNecessary()) |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 SetActivateExpectations(DataTypeController::OK); | 228 SetActivateExpectations(DataTypeController::OK); |
| 228 SetStopExpectations(); | 229 SetStopExpectations(); |
| 229 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); | 230 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); |
| 230 Start(); | 231 Start(); |
| 231 EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state()); | 232 EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state()); |
| 232 frontend_dtc_->Stop(); | 233 frontend_dtc_->Stop(); |
| 233 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); | 234 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); |
| 234 } | 235 } |
| 235 | 236 |
| 236 } // namespace syncer | 237 } // namespace syncer |
| OLD | NEW |