Chromium Code Reviews| Index: chrome/browser/resources/chromeos/login/login_common.js |
| diff --git a/chrome/browser/resources/chromeos/login/login_common.js b/chrome/browser/resources/chromeos/login/login_common.js |
| index cd48d356eadd9a6a01519f3fa5ad08a51899418e..99e53b85d52bec3e661d7e6bdb0c5f5893554130 100644 |
| --- a/chrome/browser/resources/chromeos/login/login_common.js |
| +++ b/chrome/browser/resources/chromeos/login/login_common.js |
| @@ -293,17 +293,45 @@ cr.define('cr.ui', function() { |
| * Login for telemetry. |
| * @param {string} username Login username. |
| * @param {string} password Login password. |
| - */ |
| - Oobe.loginForTesting = function(username, password, gaia_id) { |
| - Oobe.disableSigninUI(); |
| - chrome.send('skipToLoginForTesting', [username]); |
| + * @param {boolean} enterpriseEnroll Login as an enterprise enrollment? |
| + */ |
| + Oobe.loginForTesting = function(username, password, gaia_id, |
| + enterpriseEnroll) { |
| + // Helper method that runs |cb| after |screenName| is visible. |
| + function waitForScreen(screenName, cb) { |
| + function runner() { |
| + if ($(screenName).hidden) { |
| + 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.
|
| + return; |
| + } |
| + |
| + cb(); |
| + } |
| + runner(); |
| + } |
| + |
| if (!gaia_id) { |
| - /* TODO (alemate): Remove this backward compatibility hack when |
| - as soon as all telemetry tests will pass gaia_id directly. |
| - */ |
| + // TODO (alemate): Remove this backward compatibility hack when |
| + // as soon as all telemetry tests will pass gaia_id directly. |
| gaia_id = '12345'; |
| } |
| - chrome.send('completeLogin', [gaia_id, username, password, false]); |
| + |
| + Oobe.disableSigninUI(); |
| + chrome.send('skipToLoginForTesting', [username]); |
| + |
| + if (!enterpriseEnroll) { |
| + chrome.send('completeLogin', [gaia_id, username, password, false]); |
| + } else { |
| + waitForScreen('gaia-signin', function() { |
| + chrome.send('toggleEnrollmentScreen'); |
| + chrome.send('toggleFakeEnrollment'); |
| + }); |
| + |
| + waitForScreen('oauth-enrollment', function() { |
| + chrome.send('oauthEnrollCompleteLogin', [username, 'authcode']); |
| + chrome.send('completeLogin', ['12345', username, password, false]); |
| + }); |
| + } |
| }; |
| /** |