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

Side by Side Diff: chrome/browser/resources/chromeos/login/login_common.js

Issue 1767443002: Add enterprise enrollment support for fake users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Split PolicyOAuth2TokenFetcher into impl/fake classes; fix SAML browsertests Created 4 years, 9 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 /** 5 /**
6 * @fileoverview Common OOBE controller methods. 6 * @fileoverview Common OOBE controller methods.
7 */ 7 */
8 8
9 <include src="test_util.js"> 9 <include src="test_util.js">
10 <include src="../../../../../ui/login/screen.js"> 10 <include src="../../../../../ui/login/screen.js">
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 */ 286 */
287 Oobe.skipToLoginForTesting = function() { 287 Oobe.skipToLoginForTesting = function() {
288 Oobe.disableSigninUI(); 288 Oobe.disableSigninUI();
289 chrome.send('skipToLoginForTesting'); 289 chrome.send('skipToLoginForTesting');
290 }; 290 };
291 291
292 /** 292 /**
293 * Login for telemetry. 293 * Login for telemetry.
294 * @param {string} username Login username. 294 * @param {string} username Login username.
295 * @param {string} password Login password. 295 * @param {string} password Login password.
296 * @param {boolean} enterpriseEnroll Login as an enterprise enrollment?
296 */ 297 */
297 Oobe.loginForTesting = function(username, password, gaia_id) { 298 Oobe.loginForTesting = function(username, password, gaia_id,
299 enterpriseEnroll) {
achuithb 2016/03/08 08:11:45 should we use a default? I'm not confident this wo
jdufault 2016/03/08 21:37:09 Done.
300 // Helper method that runs |fn| after |screenName| is visible.
301 function waitForOobeScreen(screenName, fn) {
302 if (Oobe.getInstance().currentScreen.id === screenName) {
303 fn();
304 } else {
305 $('oobe').addEventListener('screenchanged', function handler(e) {
306 if (e.detail == screenName) {
307 fn();
308 $('oobe').removeEventListener('screenchanged', handler);
achuithb 2016/03/08 08:11:45 should the remove come before fn()?
jdufault 2016/03/08 21:37:09 Done, makes sense because fn() could invoke anothe
309 }
310 });
311 }
312 }
313
314 if (!gaia_id) {
315 // TODO (alemate): Remove this backward compatibility hack when
316 // as soon as all telemetry tests will pass gaia_id directly.
317 gaia_id = '12345';
318 }
319
298 Oobe.disableSigninUI(); 320 Oobe.disableSigninUI();
299 chrome.send('skipToLoginForTesting', [username]); 321 chrome.send('skipToLoginForTesting', [username]);
300 if (!gaia_id) { 322
301 /* TODO (alemate): Remove this backward compatibility hack when 323 if (!enterpriseEnroll) {
302 as soon as all telemetry tests will pass gaia_id directly. 324 chrome.send('completeLogin', [gaia_id, username, password, false]);
303 */ 325 } else {
304 gaia_id = '12345'; 326 waitForOobeScreen('gaia-signin', function() {
327 chrome.send('toggleEnrollmentScreen');
328 chrome.send('toggleFakeEnrollment');
329 });
330
331 waitForOobeScreen('oauth-enrollment', function() {
332 chrome.send('oauthEnrollCompleteLogin', [username, 'authcode']);
333 chrome.send('completeLogin', ['12345', username, password, false]);
dzhioev (left Google) 2016/03/09 00:19:28 Is '12345' supposed to be |gaia_id| here?
jdufault 2016/03/18 17:38:20 Good catch.
334 });
305 } 335 }
306 chrome.send('completeLogin', [gaia_id, username, password, false]);
307 }; 336 };
308 337
309 /** 338 /**
310 * Guest login for telemetry. 339 * Guest login for telemetry.
311 */ 340 */
312 Oobe.guestLoginForTesting = function() { 341 Oobe.guestLoginForTesting = function() {
313 Oobe.skipToLoginForTesting(); 342 Oobe.skipToLoginForTesting();
314 chrome.send('launchIncognito'); 343 chrome.send('launchIncognito');
315 }; 344 };
316 345
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 cr.ui.login.ResourceLoader.loadAssets(SCREEN_OOBE_ENROLLMENT, function() { 452 cr.ui.login.ResourceLoader.loadAssets(SCREEN_OOBE_ENROLLMENT, function() {
424 // This screen is async-loaded so we manually trigger i18n processing. 453 // This screen is async-loaded so we manually trigger i18n processing.
425 i18nTemplate.process($('oauth-enrollment'), loadTimeData); 454 i18nTemplate.process($('oauth-enrollment'), loadTimeData);
426 // Delayed binding since this isn't defined yet. 455 // Delayed binding since this isn't defined yet.
427 login.OAuthEnrollmentScreen.register(); 456 login.OAuthEnrollmentScreen.register();
428 }); 457 });
429 458
430 cr.ui.Oobe.initialize(); 459 cr.ui.Oobe.initialize();
431 }); 460 });
432 })(); 461 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698