| 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/tracked_objects.h" | 12 #include "base/tracked_objects.h" |
| 13 #include "chrome/browser/sync/glue/frontend_data_type_controller.h" | 13 #include "chrome/browser/sync/glue/frontend_data_type_controller.h" |
| 14 #include "chrome/browser/sync/glue/frontend_data_type_controller_mock.h" | 14 #include "chrome/browser/sync/glue/frontend_data_type_controller_mock.h" |
| 15 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" | 15 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
| 16 #include "chrome/browser/sync/profile_sync_service_mock.h" | 16 #include "chrome/browser/sync/profile_sync_service_mock.h" |
| 17 #include "chrome/test/base/profile_mock.h" | 17 #include "chrome/test/base/profile_mock.h" |
| 18 #include "components/sync_driver/change_processor_mock.h" | 18 #include "components/sync_driver/change_processor_mock.h" |
| 19 #include "components/sync_driver/data_type_controller_mock.h" | 19 #include "components/sync_driver/data_type_controller_mock.h" |
| 20 #include "components/sync_driver/model_associator_mock.h" | 20 #include "components/sync_driver/model_associator_mock.h" |
| 21 #include "content/public/test/test_browser_thread_bundle.h" | 21 #include "content/public/test/test_browser_thread_bundle.h" |
| 22 | 22 |
| 23 using browser_sync::ChangeProcessorMock; | |
| 24 using browser_sync::DataTypeController; | |
| 25 using browser_sync::FrontendDataTypeController; | 23 using browser_sync::FrontendDataTypeController; |
| 26 using browser_sync::FrontendDataTypeControllerMock; | 24 using browser_sync::FrontendDataTypeControllerMock; |
| 27 using browser_sync::ModelAssociatorMock; | 25 using sync_driver::ChangeProcessorMock; |
| 28 using browser_sync::ModelLoadCallbackMock; | 26 using sync_driver::DataTypeController; |
| 29 using browser_sync::StartCallbackMock; | 27 using sync_driver::ModelAssociatorMock; |
| 28 using sync_driver::ModelLoadCallbackMock; |
| 29 using sync_driver::StartCallbackMock; |
| 30 using testing::_; | 30 using testing::_; |
| 31 using testing::DoAll; | 31 using testing::DoAll; |
| 32 using testing::InvokeWithoutArgs; | 32 using testing::InvokeWithoutArgs; |
| 33 using testing::Return; | 33 using testing::Return; |
| 34 using testing::SetArgumentPointee; | 34 using testing::SetArgumentPointee; |
| 35 using testing::StrictMock; | 35 using testing::StrictMock; |
| 36 | 36 |
| 37 class FrontendDataTypeControllerFake : public FrontendDataTypeController { | 37 class FrontendDataTypeControllerFake : public FrontendDataTypeController { |
| 38 public: | 38 public: |
| 39 FrontendDataTypeControllerFake( | 39 FrontendDataTypeControllerFake( |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 &FrontendDataTypeController::Stop)); | 266 &FrontendDataTypeController::Stop)); |
| 267 SetStopExpectations(); | 267 SetStopExpectations(); |
| 268 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); | 268 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); |
| 269 Start(); | 269 Start(); |
| 270 EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state()); | 270 EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state()); |
| 271 // This should cause frontend_dtc_->Stop() to be called. | 271 // This should cause frontend_dtc_->Stop() to be called. |
| 272 frontend_dtc_->OnSingleDatatypeUnrecoverableError(FROM_HERE, "Test"); | 272 frontend_dtc_->OnSingleDatatypeUnrecoverableError(FROM_HERE, "Test"); |
| 273 PumpLoop(); | 273 PumpLoop(); |
| 274 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); | 274 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); |
| 275 } | 275 } |
| OLD | NEW |