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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/invalidation/invalidation_service_factory.h" | 10 #include "chrome/browser/invalidation/invalidation_service_factory.h" |
| 11 #include "chrome/browser/managed_mode/managed_user_signin_manager_wrapper.h" |
11 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 12 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
13 #include "chrome/browser/signin/signin_manager.h" | 14 #include "chrome/browser/signin/signin_manager.h" |
14 #include "chrome/browser/signin/signin_manager_factory.h" | 15 #include "chrome/browser/signin/signin_manager_factory.h" |
15 #include "chrome/browser/sync/glue/data_type_manager_impl.h" | 16 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
16 #include "chrome/browser/sync/glue/sync_backend_host_mock.h" | 17 #include "chrome/browser/sync/glue/sync_backend_host_mock.h" |
17 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" | 18 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" |
18 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
19 #include "chrome/test/base/testing_pref_service_syncable.h" | 20 #include "chrome/test/base/testing_pref_service_syncable.h" |
20 #include "chrome/test/base/testing_profile.h" | 21 #include "chrome/test/base/testing_profile.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 void CreateService(ProfileSyncService::StartBehavior behavior) { | 119 void CreateService(ProfileSyncService::StartBehavior behavior) { |
119 SigninManagerBase* signin = | 120 SigninManagerBase* signin = |
120 SigninManagerFactory::GetForProfile(profile_.get()); | 121 SigninManagerFactory::GetForProfile(profile_.get()); |
121 signin->SetAuthenticatedUsername("test"); | 122 signin->SetAuthenticatedUsername("test"); |
122 ProfileOAuth2TokenService* oauth2_token_service = | 123 ProfileOAuth2TokenService* oauth2_token_service = |
123 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); | 124 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); |
124 components_factory_ = new StrictMock<ProfileSyncComponentsFactoryMock>(); | 125 components_factory_ = new StrictMock<ProfileSyncComponentsFactoryMock>(); |
125 service_.reset(new ProfileSyncService( | 126 service_.reset(new ProfileSyncService( |
126 components_factory_, | 127 components_factory_, |
127 profile_.get(), | 128 profile_.get(), |
128 signin, | 129 new ManagedUserSigninManagerWrapper(signin), |
129 oauth2_token_service, | 130 oauth2_token_service, |
130 behavior)); | 131 behavior)); |
131 } | 132 } |
132 | 133 |
133 void ShutdownAndDeleteService() { | 134 void ShutdownAndDeleteService() { |
134 if (service_) | 135 if (service_) |
135 service_->Shutdown(); | 136 service_->Shutdown(); |
136 service_.reset(); | 137 service_.reset(); |
137 } | 138 } |
138 | 139 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 EXPECT_TRUE(token_status.next_token_request_time.is_null()); | 363 EXPECT_TRUE(token_status.next_token_request_time.is_null()); |
363 | 364 |
364 // Simulate successful connection. | 365 // Simulate successful connection. |
365 service()->OnConnectionStatusChange(syncer::CONNECTION_OK); | 366 service()->OnConnectionStatusChange(syncer::CONNECTION_OK); |
366 token_status = service()->GetSyncTokenStatus(); | 367 token_status = service()->GetSyncTokenStatus(); |
367 EXPECT_EQ(syncer::CONNECTION_OK, token_status.connection_status); | 368 EXPECT_EQ(syncer::CONNECTION_OK, token_status.connection_status); |
368 } | 369 } |
369 | 370 |
370 } // namespace | 371 } // namespace |
371 } // namespace browser_sync | 372 } // namespace browser_sync |
OLD | NEW |