| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 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/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" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 151 } |
| 152 | 152 |
| 153 MessageLoop ui_loop_; | 153 MessageLoop ui_loop_; |
| 154 content::TestBrowserThread ui_thread_; | 154 content::TestBrowserThread ui_thread_; |
| 155 content::TestBrowserThread file_thread_; | 155 content::TestBrowserThread file_thread_; |
| 156 scoped_ptr<TestingProfile> profile_; | 156 scoped_ptr<TestingProfile> profile_; |
| 157 scoped_refptr<TestAppNotificationDataTypeController> app_notif_dtc_; | 157 scoped_refptr<TestAppNotificationDataTypeController> app_notif_dtc_; |
| 158 scoped_ptr<ProfileSyncComponentsFactoryMock> profile_sync_factory_; | 158 scoped_ptr<ProfileSyncComponentsFactoryMock> profile_sync_factory_; |
| 159 ProfileSyncServiceMock service_; | 159 ProfileSyncServiceMock service_; |
| 160 scoped_ptr<FakeGenericChangeProcessor> change_processor_; | 160 scoped_ptr<FakeGenericChangeProcessor> change_processor_; |
| 161 FakeSyncableService syncable_service_; | 161 csync::FakeSyncableService syncable_service_; |
| 162 StartCallbackMock start_callback_; | 162 StartCallbackMock start_callback_; |
| 163 ModelLoadCallbackMock model_load_callback_; | 163 ModelLoadCallbackMock model_load_callback_; |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 // When notification manager is ready, sync association should happen | 166 // When notification manager is ready, sync association should happen |
| 167 // successfully. | 167 // successfully. |
| 168 TEST_F(SyncAppNotificationDataTypeControllerTest, StartManagerReady) { | 168 TEST_F(SyncAppNotificationDataTypeControllerTest, StartManagerReady) { |
| 169 SetStartExpectations(); | 169 SetStartExpectations(); |
| 170 InitAndLoadManager(); | 170 InitAndLoadManager(); |
| 171 SetActivateExpectations(); | 171 SetActivateExpectations(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 EXPECT_EQ(DataTypeController::RUNNING, app_notif_dtc_->state()); | 211 EXPECT_EQ(DataTypeController::RUNNING, app_notif_dtc_->state()); |
| 212 EXPECT_TRUE(syncable_service_.syncing()); | 212 EXPECT_TRUE(syncable_service_.syncing()); |
| 213 } | 213 } |
| 214 | 214 |
| 215 TEST_F(SyncAppNotificationDataTypeControllerTest, StartAssociationFailed) { | 215 TEST_F(SyncAppNotificationDataTypeControllerTest, StartAssociationFailed) { |
| 216 SetStartExpectations(); | 216 SetStartExpectations(); |
| 217 InitAndLoadManager(); | 217 InitAndLoadManager(); |
| 218 EXPECT_CALL(start_callback_, | 218 EXPECT_CALL(start_callback_, |
| 219 Run(DataTypeController::ASSOCIATION_FAILED, _)); | 219 Run(DataTypeController::ASSOCIATION_FAILED, _)); |
| 220 syncable_service_.set_merge_data_and_start_syncing_error( | 220 syncable_service_.set_merge_data_and_start_syncing_error( |
| 221 SyncError(FROM_HERE, "Error", syncable::APP_NOTIFICATIONS)); | 221 csync::SyncError(FROM_HERE, "Error", syncable::APP_NOTIFICATIONS)); |
| 222 | 222 |
| 223 Start(); | 223 Start(); |
| 224 EXPECT_EQ(DataTypeController::DISABLED, app_notif_dtc_->state()); | 224 EXPECT_EQ(DataTypeController::DISABLED, app_notif_dtc_->state()); |
| 225 EXPECT_FALSE(syncable_service_.syncing()); | 225 EXPECT_FALSE(syncable_service_.syncing()); |
| 226 } | 226 } |
| 227 | 227 |
| 228 TEST_F(SyncAppNotificationDataTypeControllerTest, | 228 TEST_F(SyncAppNotificationDataTypeControllerTest, |
| 229 StartAssociationTriggersUnrecoverableError) { | 229 StartAssociationTriggersUnrecoverableError) { |
| 230 SetStartExpectations(); | 230 SetStartExpectations(); |
| 231 InitAndLoadManager(); | 231 InitAndLoadManager(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 EXPECT_TRUE(syncable_service_.syncing()); | 272 EXPECT_TRUE(syncable_service_.syncing()); |
| 273 // This should cause app_notif_dtc_->Stop() to be called. | 273 // This should cause app_notif_dtc_->Stop() to be called. |
| 274 app_notif_dtc_->OnSingleDatatypeUnrecoverableError(FROM_HERE, "Test"); | 274 app_notif_dtc_->OnSingleDatatypeUnrecoverableError(FROM_HERE, "Test"); |
| 275 PumpLoop(); | 275 PumpLoop(); |
| 276 EXPECT_EQ(DataTypeController::NOT_RUNNING, app_notif_dtc_->state()); | 276 EXPECT_EQ(DataTypeController::NOT_RUNNING, app_notif_dtc_->state()); |
| 277 EXPECT_FALSE(syncable_service_.syncing()); | 277 EXPECT_FALSE(syncable_service_.syncing()); |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace | 280 } // namespace |
| 281 } // namespace browser_sync | 281 } // namespace browser_sync |
| OLD | NEW |