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/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "chrome/browser/net/gaia/token_service.h" | 9 #include "chrome/browser/net/gaia/token_service.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
11 #include "chrome/browser/sync/glue/data_type_manager.h" | 11 #include "chrome/browser/sync/glue/data_type_manager.h" |
12 #include "chrome/browser/sync/glue/data_type_manager_mock.h" | 12 #include "chrome/browser/sync/glue/data_type_manager_mock.h" |
13 #include "chrome/browser/sync/profile_sync_factory_mock.h" | 13 #include "chrome/browser/sync/profile_sync_factory_mock.h" |
14 #include "chrome/browser/sync/profile_sync_test_util.h" | 14 #include "chrome/browser/sync/profile_sync_test_util.h" |
15 #include "chrome/browser/sync/test_profile_sync_service.h" | 15 #include "chrome/browser/sync/test_profile_sync_service.h" |
| 16 #include "chrome/common/chrome_notification_types.h" |
16 #include "chrome/common/net/gaia/gaia_auth_consumer.h" | 17 #include "chrome/common/net/gaia/gaia_auth_consumer.h" |
17 #include "chrome/common/net/gaia/gaia_constants.h" | 18 #include "chrome/common/net/gaia/gaia_constants.h" |
18 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
19 #include "chrome/test/testing_profile.h" | 20 #include "chrome/test/testing_profile.h" |
20 #include "content/browser/browser_thread.h" | 21 #include "content/browser/browser_thread.h" |
21 #include "content/common/notification_type.h" | |
22 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
23 | 23 |
24 using browser_sync::DataTypeManager; | 24 using browser_sync::DataTypeManager; |
25 using browser_sync::DataTypeManagerMock; | 25 using browser_sync::DataTypeManagerMock; |
26 using testing::_; | 26 using testing::_; |
27 using testing::AnyNumber; | 27 using testing::AnyNumber; |
28 using testing::DoAll; | 28 using testing::DoAll; |
29 using testing::InvokeArgument; | 29 using testing::InvokeArgument; |
30 using testing::Mock; | 30 using testing::Mock; |
31 using testing::Return; | 31 using testing::Return; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } | 244 } |
245 | 245 |
246 TEST_F(ProfileSyncServiceStartupTest, SKIP_MACOSX(StartFailure)) { | 246 TEST_F(ProfileSyncServiceStartupTest, SKIP_MACOSX(StartFailure)) { |
247 DataTypeManagerMock* data_type_manager = SetUpDataTypeManager(); | 247 DataTypeManagerMock* data_type_manager = SetUpDataTypeManager(); |
248 DataTypeManager::ConfigureResult configure_result = | 248 DataTypeManager::ConfigureResult configure_result = |
249 DataTypeManager::ASSOCIATION_FAILED; | 249 DataTypeManager::ASSOCIATION_FAILED; |
250 browser_sync::DataTypeManager::ConfigureResultWithErrorLocation result( | 250 browser_sync::DataTypeManager::ConfigureResultWithErrorLocation result( |
251 configure_result, FROM_HERE, syncable::ModelTypeSet()); | 251 configure_result, FROM_HERE, syncable::ModelTypeSet()); |
252 EXPECT_CALL(*data_type_manager, Configure(_, _)). | 252 EXPECT_CALL(*data_type_manager, Configure(_, _)). |
253 WillRepeatedly(DoAll(NotifyFromDataTypeManager(data_type_manager, | 253 WillRepeatedly(DoAll(NotifyFromDataTypeManager(data_type_manager, |
254 NotificationType::SYNC_CONFIGURE_START), | 254 chrome::NOTIFICATION_SYNC_CONFIGURE_START), |
255 NotifyFromDataTypeManagerWithResult(data_type_manager, | 255 NotifyFromDataTypeManagerWithResult(data_type_manager, |
256 NotificationType::SYNC_CONFIGURE_DONE, | 256 chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, |
257 &result))); | 257 &result))); |
258 EXPECT_CALL(*data_type_manager, state()). | 258 EXPECT_CALL(*data_type_manager, state()). |
259 WillOnce(Return(DataTypeManager::STOPPED)); | 259 WillOnce(Return(DataTypeManager::STOPPED)); |
260 | 260 |
261 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); | 261 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); |
262 | 262 |
263 profile_.GetTokenService()->IssueAuthTokenForTest( | 263 profile_.GetTokenService()->IssueAuthTokenForTest( |
264 GaiaConstants::kSyncService, "sync_token"); | 264 GaiaConstants::kSyncService, "sync_token"); |
265 service_->Initialize(); | 265 service_->Initialize(); |
266 EXPECT_TRUE(service_->unrecoverable_error_detected()); | 266 EXPECT_TRUE(service_->unrecoverable_error_detected()); |
267 } | 267 } |
OLD | NEW |