| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| 11 #include "chrome/browser/sync/glue/change_processor_mock.h" | 11 #include "chrome/browser/sync/glue/change_processor_mock.h" |
| 12 #include "chrome/browser/sync/glue/data_type_controller_mock.h" | 12 #include "chrome/browser/sync/glue/data_type_controller_mock.h" |
| 13 #include "chrome/browser/sync/glue/model_associator_mock.h" | 13 #include "chrome/browser/sync/glue/model_associator_mock.h" |
| 14 #include "chrome/browser/sync/glue/theme_data_type_controller.h" | 14 #include "chrome/browser/sync/glue/theme_data_type_controller.h" |
| 15 #include "chrome/browser/sync/profile_sync_factory_mock.h" | 15 #include "chrome/browser/sync/profile_sync_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 "content/test/test_browser_thread.h" | 18 #include "content/test/test_browser_thread.h" |
| 19 | 19 |
| 20 using browser_sync::ThemeDataTypeController; | 20 using browser_sync::ThemeDataTypeController; |
| 21 using browser_sync::ChangeProcessorMock; | 21 using browser_sync::ChangeProcessorMock; |
| 22 using browser_sync::DataTypeController; | 22 using browser_sync::DataTypeController; |
| 23 using browser_sync::ModelAssociatorMock; | 23 using browser_sync::ModelAssociatorMock; |
| 24 using browser_sync::StartCallback; | 24 using browser_sync::StartCallback; |
| 25 using content::BrowserThread; |
| 25 using testing::_; | 26 using testing::_; |
| 26 using testing::DoAll; | 27 using testing::DoAll; |
| 27 using testing::InvokeWithoutArgs; | 28 using testing::InvokeWithoutArgs; |
| 28 using testing::Return; | 29 using testing::Return; |
| 29 using testing::SetArgumentPointee; | 30 using testing::SetArgumentPointee; |
| 30 | 31 |
| 31 class ThemeDataTypeControllerTest : public testing::Test { | 32 class ThemeDataTypeControllerTest : public testing::Test { |
| 32 public: | 33 public: |
| 33 ThemeDataTypeControllerTest() | 34 ThemeDataTypeControllerTest() |
| 34 : ui_thread_(BrowserThread::UI, &message_loop_) {} | 35 : ui_thread_(BrowserThread::UI, &message_loop_) {} |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 WillOnce(InvokeWithoutArgs(theme_dtc_.get(), | 165 WillOnce(InvokeWithoutArgs(theme_dtc_.get(), |
| 165 &ThemeDataTypeController::Stop)); | 166 &ThemeDataTypeController::Stop)); |
| 166 SetStopExpectations(); | 167 SetStopExpectations(); |
| 167 | 168 |
| 168 EXPECT_CALL(start_callback_, Run(DataTypeController::OK, _)); | 169 EXPECT_CALL(start_callback_, Run(DataTypeController::OK, _)); |
| 169 theme_dtc_->Start(NewCallback(&start_callback_, &StartCallback::Run)); | 170 theme_dtc_->Start(NewCallback(&start_callback_, &StartCallback::Run)); |
| 170 // This should cause theme_dtc_->Stop() to be called. | 171 // This should cause theme_dtc_->Stop() to be called. |
| 171 theme_dtc_->OnUnrecoverableError(FROM_HERE, "Test"); | 172 theme_dtc_->OnUnrecoverableError(FROM_HERE, "Test"); |
| 172 PumpLoop(); | 173 PumpLoop(); |
| 173 } | 174 } |
| OLD | NEW |