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