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

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: 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) {
300 // Helper method that runs |cb| after |screenName| is visible.
301 function waitForScreen(screenName, cb) {
302 function runner() {
303 if ($(screenName).hidden) {
304 setTimeout(runner, 100);
achuithb 2016/03/03 22:45:00 No better way than polling? Are there no events we
jdufault 2016/03/03 23:11:04 There is OobeScreenWaiter on the C++ side but noth
achuithb 2016/03/03 23:23:43 Let's do it. Maybe Pavel has a better idea?
jdufault 2016/03/04 20:42:47 Done.
305 return;
306 }
307
308 cb();
309 }
310 runner();
311 }
312
313 if (!gaia_id) {
314 // TODO (alemate): Remove this backward compatibility hack when
315 // as soon as all telemetry tests will pass gaia_id directly.
316 gaia_id = '12345';
317 }
318
298 Oobe.disableSigninUI(); 319 Oobe.disableSigninUI();
299 chrome.send('skipToLoginForTesting', [username]); 320 chrome.send('skipToLoginForTesting', [username]);
300 if (!gaia_id) { 321
301 /* TODO (alemate): Remove this backward compatibility hack when 322 if (!enterpriseEnroll) {
302 as soon as all telemetry tests will pass gaia_id directly. 323 chrome.send('completeLogin', [gaia_id, username, password, false]);
303 */ 324 } else {
304 gaia_id = '12345'; 325 waitForScreen('gaia-signin', function() {
326 chrome.send('toggleEnrollmentScreen');
327 chrome.send('toggleFakeEnrollment');
328 });
329
330 waitForScreen('oauth-enrollment', function() {
331 chrome.send('oauthEnrollCompleteLogin', [username, 'authcode']);
332 chrome.send('completeLogin', ['12345', username, password, false]);
333 });
305 } 334 }
306 chrome.send('completeLogin', [gaia_id, username, password, false]);
307 }; 335 };
308 336
309 /** 337 /**
310 * Guest login for telemetry. 338 * Guest login for telemetry.
311 */ 339 */
312 Oobe.guestLoginForTesting = function() { 340 Oobe.guestLoginForTesting = function() {
313 Oobe.skipToLoginForTesting(); 341 Oobe.skipToLoginForTesting();
314 chrome.send('launchIncognito'); 342 chrome.send('launchIncognito');
315 }; 343 };
316 344
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 cr.ui.login.ResourceLoader.loadAssets(SCREEN_OOBE_ENROLLMENT, function() { 451 cr.ui.login.ResourceLoader.loadAssets(SCREEN_OOBE_ENROLLMENT, function() {
424 // This screen is async-loaded so we manually trigger i18n processing. 452 // This screen is async-loaded so we manually trigger i18n processing.
425 i18nTemplate.process($('oauth-enrollment'), loadTimeData); 453 i18nTemplate.process($('oauth-enrollment'), loadTimeData);
426 // Delayed binding since this isn't defined yet. 454 // Delayed binding since this isn't defined yet.
427 login.OAuthEnrollmentScreen.register(); 455 login.OAuthEnrollmentScreen.register();
428 }); 456 });
429 457
430 cr.ui.Oobe.initialize(); 458 cr.ui.Oobe.initialize();
431 }); 459 });
432 })(); 460 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698