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

Side by Side Diff: chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc

Issue 964563002: Replace SetAuthenticatedUsername with SetAuthenticatedAccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@priv
Patch Set: rebased Created 5 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/extensions/external_provider_impl.h" 5 #include "chrome/browser/extensions/external_provider_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/test/scoped_path_override.h" 9 #include "base/test/scoped_path_override.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // User signed in, sync service started, install app when sync is disabled by 150 // User signed in, sync service started, install app when sync is disabled by
151 // policy. 151 // policy.
152 TEST_F(ExternalProviderImplChromeOSTest, PolicyDisabled) { 152 TEST_F(ExternalProviderImplChromeOSTest, PolicyDisabled) {
153 InitServiceWithExternalProviders(true); 153 InitServiceWithExternalProviders(true);
154 154
155 // Log user in, start sync. 155 // Log user in, start sync.
156 TestingBrowserProcess::GetGlobal()->SetProfileManager( 156 TestingBrowserProcess::GetGlobal()->SetProfileManager(
157 new ProfileManagerWithoutInit(temp_dir().path())); 157 new ProfileManagerWithoutInit(temp_dir().path()));
158 SigninManagerBase* signin = 158 SigninManagerBase* signin =
159 SigninManagerFactory::GetForProfile(profile_.get()); 159 SigninManagerFactory::GetForProfile(profile_.get());
160 signin->SetAuthenticatedUsername("test_user@gmail.com"); 160 signin->SetAuthenticatedAccountInfo("gaia-id-test_user@gmail.com",
161 "test_user@gmail.com");
161 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()) 162 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get())
162 ->UpdateCredentials("test_user@gmail.com", "oauth2_login_token"); 163 ->UpdateCredentials("test_user@gmail.com", "oauth2_login_token");
163 164
164 // App sync will wait for priority sync to complete. 165 // App sync will wait for priority sync to complete.
165 service_->CheckForExternalUpdates(); 166 service_->CheckForExternalUpdates();
166 167
167 // Sync is dsabled by policy. 168 // Sync is dsabled by policy.
168 profile_->GetPrefs()->SetBoolean(sync_driver::prefs::kSyncManaged, true); 169 profile_->GetPrefs()->SetBoolean(sync_driver::prefs::kSyncManaged, true);
169 170
170 content::WindowedNotificationObserver( 171 content::WindowedNotificationObserver(
171 extensions::NOTIFICATION_CRX_INSTALLER_DONE, 172 extensions::NOTIFICATION_CRX_INSTALLER_DONE,
172 content::NotificationService::AllSources()).Wait(); 173 content::NotificationService::AllSources()).Wait();
173 174
174 EXPECT_TRUE(service_->GetInstalledExtension(kStandaloneAppId)); 175 EXPECT_TRUE(service_->GetInstalledExtension(kStandaloneAppId));
175 176
176 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL); 177 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL);
177 } 178 }
178 179
179 // User signed in, sync service started, install app when priority sync is 180 // User signed in, sync service started, install app when priority sync is
180 // completed. 181 // completed.
181 TEST_F(ExternalProviderImplChromeOSTest, PriorityCompleted) { 182 TEST_F(ExternalProviderImplChromeOSTest, PriorityCompleted) {
182 InitServiceWithExternalProviders(true); 183 InitServiceWithExternalProviders(true);
183 184
184 // User is logged in. 185 // User is logged in.
185 SigninManagerBase* signin = 186 SigninManagerBase* signin =
186 SigninManagerFactory::GetForProfile(profile_.get()); 187 SigninManagerFactory::GetForProfile(profile_.get());
187 signin->SetAuthenticatedUsername("test_user@gmail.com"); 188 signin->SetAuthenticatedAccountInfo("gaia-id-test_user@gmail.com",
189 "test_user@gmail.com");
188 190
189 // App sync will wait for priority sync to complete. 191 // App sync will wait for priority sync to complete.
190 service_->CheckForExternalUpdates(); 192 service_->CheckForExternalUpdates();
191 193
192 // Priority sync completed. 194 // Priority sync completed.
193 PrefServiceSyncable::FromProfile(profile_.get()) 195 PrefServiceSyncable::FromProfile(profile_.get())
194 ->GetSyncableService(syncer::PRIORITY_PREFERENCES) 196 ->GetSyncableService(syncer::PRIORITY_PREFERENCES)
195 ->MergeDataAndStartSyncing(syncer::PRIORITY_PREFERENCES, 197 ->MergeDataAndStartSyncing(syncer::PRIORITY_PREFERENCES,
196 syncer::SyncDataList(), 198 syncer::SyncDataList(),
197 scoped_ptr<syncer::SyncChangeProcessor>( 199 scoped_ptr<syncer::SyncChangeProcessor>(
198 new syncer::FakeSyncChangeProcessor), 200 new syncer::FakeSyncChangeProcessor),
199 scoped_ptr<syncer::SyncErrorFactory>( 201 scoped_ptr<syncer::SyncErrorFactory>(
200 new syncer::SyncErrorFactoryMock())); 202 new syncer::SyncErrorFactoryMock()));
201 203
202 content::WindowedNotificationObserver( 204 content::WindowedNotificationObserver(
203 extensions::NOTIFICATION_CRX_INSTALLER_DONE, 205 extensions::NOTIFICATION_CRX_INSTALLER_DONE,
204 content::NotificationService::AllSources()).Wait(); 206 content::NotificationService::AllSources()).Wait();
205 207
206 EXPECT_TRUE(service_->GetInstalledExtension(kStandaloneAppId)); 208 EXPECT_TRUE(service_->GetInstalledExtension(kStandaloneAppId));
207 } 209 }
208 210
209 } // namespace extensions 211 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698