Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: chrome/browser/sync/profile_sync_service_startup_unittest.cc

Issue 335273005: Rename "managed (mode|user)" to "supervised user" (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/file_util.h" 5 #include "base/file_util.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/prefs/pref_service_syncable.h" 9 #include "chrome/browser/prefs/pref_service_syncable.h"
10 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
11 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" 11 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h"
12 #include "chrome/browser/signin/fake_signin_manager.h" 12 #include "chrome/browser/signin/fake_signin_manager.h"
13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
14 #include "chrome/browser/signin/signin_manager_factory.h" 14 #include "chrome/browser/signin/signin_manager_factory.h"
15 #include "chrome/browser/sync/glue/sync_backend_host_mock.h" 15 #include "chrome/browser/sync/glue/sync_backend_host_mock.h"
16 #include "chrome/browser/sync/managed_user_signin_manager_wrapper.h"
17 #include "chrome/browser/sync/profile_sync_components_factory_mock.h" 16 #include "chrome/browser/sync/profile_sync_components_factory_mock.h"
18 #include "chrome/browser/sync/profile_sync_service_factory.h" 17 #include "chrome/browser/sync/profile_sync_service_factory.h"
19 #include "chrome/browser/sync/profile_sync_test_util.h" 18 #include "chrome/browser/sync/profile_sync_test_util.h"
19 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h"
20 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
21 #include "chrome/test/base/testing_browser_process.h" 21 #include "chrome/test/base/testing_browser_process.h"
22 #include "chrome/test/base/testing_profile.h" 22 #include "chrome/test/base/testing_profile.h"
23 #include "chrome/test/base/testing_profile_manager.h" 23 #include "chrome/test/base/testing_profile_manager.h"
24 #include "components/signin/core/browser/profile_oauth2_token_service.h" 24 #include "components/signin/core/browser/profile_oauth2_token_service.h"
25 #include "components/signin/core/browser/signin_manager.h" 25 #include "components/signin/core/browser/signin_manager.h"
26 #include "components/sync_driver/data_type_manager.h" 26 #include "components/sync_driver/data_type_manager.h"
27 #include "components/sync_driver/data_type_manager_mock.h" 27 #include "components/sync_driver/data_type_manager_mock.h"
28 #include "components/sync_driver/pref_names.h" 28 #include "components/sync_driver/pref_names.h"
29 #include "components/sync_driver/sync_prefs.h" 29 #include "components/sync_driver/sync_prefs.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 virtual void TearDown() { 95 virtual void TearDown() {
96 sync_->RemoveObserver(&observer_); 96 sync_->RemoveObserver(&observer_);
97 } 97 }
98 98
99 static KeyedService* BuildService(content::BrowserContext* browser_context) { 99 static KeyedService* BuildService(content::BrowserContext* browser_context) {
100 Profile* profile = static_cast<Profile*>(browser_context); 100 Profile* profile = static_cast<Profile*>(browser_context);
101 return new ProfileSyncService( 101 return new ProfileSyncService(
102 new ProfileSyncComponentsFactoryMock(), 102 new ProfileSyncComponentsFactoryMock(),
103 profile, 103 profile,
104 make_scoped_ptr(new ManagedUserSigninManagerWrapper( 104 make_scoped_ptr(new SupervisedUserSigninManagerWrapper(
105 profile, SigninManagerFactory::GetForProfile(profile))), 105 profile, SigninManagerFactory::GetForProfile(profile))),
106 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 106 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
107 browser_sync::MANUAL_START); 107 browser_sync::MANUAL_START);
108 } 108 }
109 109
110 void CreateSyncService() { 110 void CreateSyncService() {
111 sync_ = static_cast<ProfileSyncService*>( 111 sync_ = static_cast<ProfileSyncService*>(
112 ProfileSyncServiceFactory::GetForProfile(profile_)); 112 ProfileSyncServiceFactory::GetForProfile(profile_));
113 sync_->AddObserver(&observer_); 113 sync_->AddObserver(&observer_);
114 } 114 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 SigninManagerFactory::GetForProfile(profile); 178 SigninManagerFactory::GetForProfile(profile);
179 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, 179 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername,
180 "test_user@gmail.com"); 180 "test_user@gmail.com");
181 signin->SetAuthenticatedUsername("test_user@gmail.com"); 181 signin->SetAuthenticatedUsername("test_user@gmail.com");
182 ProfileOAuth2TokenService* oauth2_token_service = 182 ProfileOAuth2TokenService* oauth2_token_service =
183 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 183 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
184 EXPECT_FALSE(signin->GetAuthenticatedUsername().empty()); 184 EXPECT_FALSE(signin->GetAuthenticatedUsername().empty());
185 return new ProfileSyncService( 185 return new ProfileSyncService(
186 new ProfileSyncComponentsFactoryMock(), 186 new ProfileSyncComponentsFactoryMock(),
187 profile, 187 profile,
188 make_scoped_ptr(new ManagedUserSigninManagerWrapper(profile, signin)), 188 make_scoped_ptr(new SupervisedUserSigninManagerWrapper(profile,
189 signin)),
189 oauth2_token_service, 190 oauth2_token_service,
190 browser_sync::AUTO_START); 191 browser_sync::AUTO_START);
191 } 192 }
192 }; 193 };
193 194
194 TEST_F(ProfileSyncServiceStartupTest, StartFirstTime) { 195 TEST_F(ProfileSyncServiceStartupTest, StartFirstTime) {
195 // We've never completed startup. 196 // We've never completed startup.
196 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted); 197 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted);
197 CreateSyncService(); 198 CreateSyncService();
198 SetUpSyncBackendHost(); 199 SetUpSyncBackendHost();
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted); 520 profile_->GetPrefs()->ClearPref(sync_driver::prefs::kSyncHasSetupCompleted);
520 521
521 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); 522 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber());
522 sync_->Initialize(); 523 sync_->Initialize();
523 524
524 sync_->SetSetupInProgress(true); 525 sync_->SetSetupInProgress(true);
525 IssueTestTokens(); 526 IssueTestTokens();
526 sync_->SetSetupInProgress(false); 527 sync_->SetSetupInProgress(false);
527 EXPECT_FALSE(sync_->sync_initialized()); 528 EXPECT_FALSE(sync_->sync_initialized());
528 } 529 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_mock.cc ('k') | chrome/browser/sync/profile_sync_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698