| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/task.h" | 8 #include "base/task.h" |
| 9 #include "base/tracked_objects.h" | 9 #include "base/tracked_objects.h" |
| 10 #include "chrome/browser/extensions/app_notification_manager.h" | 10 #include "chrome/browser/extensions/app_notification_manager.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/sync/glue/app_notification_data_type_controller.h" | 12 #include "chrome/browser/sync/glue/app_notification_data_type_controller.h" |
| 13 #include "chrome/browser/sync/glue/change_processor_mock.h" | 13 #include "chrome/browser/sync/glue/change_processor_mock.h" |
| 14 #include "chrome/browser/sync/glue/data_type_controller_mock.h" | 14 #include "chrome/browser/sync/glue/data_type_controller_mock.h" |
| 15 #include "chrome/browser/sync/glue/model_associator_mock.h" | 15 #include "chrome/browser/sync/glue/model_associator_mock.h" |
| 16 #include "chrome/browser/sync/profile_sync_factory_mock.h" | 16 #include "chrome/browser/sync/profile_sync_factory_mock.h" |
| 17 #include "chrome/browser/sync/profile_sync_service_mock.h" | 17 #include "chrome/browser/sync/profile_sync_service_mock.h" |
| 18 #include "chrome/common/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
| 19 #include "chrome/test/base/testing_profile.h" | 19 #include "chrome/test/base/testing_profile.h" |
| 20 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
| 21 #include "content/test/test_browser_thread.h" | 21 #include "content/test/test_browser_thread.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 23 |
| 24 using browser_sync::AppNotificationDataTypeController; | 24 using browser_sync::AppNotificationDataTypeController; |
| 25 using browser_sync::ChangeProcessorMock; | 25 using browser_sync::ChangeProcessorMock; |
| 26 using browser_sync::DataTypeController; | 26 using browser_sync::DataTypeController; |
| 27 using browser_sync::ModelAssociatorMock; | 27 using browser_sync::ModelAssociatorMock; |
| 28 using browser_sync::StartCallback; | 28 using browser_sync::StartCallback; |
| 29 using content::BrowserThread; |
| 29 using testing::_; | 30 using testing::_; |
| 30 using testing::DoAll; | 31 using testing::DoAll; |
| 31 using testing::InvokeWithoutArgs; | 32 using testing::InvokeWithoutArgs; |
| 32 using testing::Return; | 33 using testing::Return; |
| 33 using testing::SetArgumentPointee; | 34 using testing::SetArgumentPointee; |
| 34 | 35 |
| 35 class TestAppNotificationDataTypeController | 36 class TestAppNotificationDataTypeController |
| 36 : public AppNotificationDataTypeController { | 37 : public AppNotificationDataTypeController { |
| 37 public: | 38 public: |
| 38 TestAppNotificationDataTypeController( | 39 TestAppNotificationDataTypeController( |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 WillOnce(InvokeWithoutArgs(app_notif_dtc_.get(), | 243 WillOnce(InvokeWithoutArgs(app_notif_dtc_.get(), |
| 243 &AppNotificationDataTypeController::Stop)); | 244 &AppNotificationDataTypeController::Stop)); |
| 244 SetStopExpectations(); | 245 SetStopExpectations(); |
| 245 | 246 |
| 246 EXPECT_CALL(start_callback_, Run(DataTypeController::OK, _)); | 247 EXPECT_CALL(start_callback_, Run(DataTypeController::OK, _)); |
| 247 app_notif_dtc_->Start(NewCallback(&start_callback_, &StartCallback::Run)); | 248 app_notif_dtc_->Start(NewCallback(&start_callback_, &StartCallback::Run)); |
| 248 // This should cause app_notif_dtc_->Stop() to be called. | 249 // This should cause app_notif_dtc_->Stop() to be called. |
| 249 app_notif_dtc_->OnUnrecoverableError(FROM_HERE, "Test"); | 250 app_notif_dtc_->OnUnrecoverableError(FROM_HERE, "Test"); |
| 250 PumpLoop(); | 251 PumpLoop(); |
| 251 } | 252 } |
| OLD | NEW |