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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
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..71b7f14c89e201a1a83b30b5ccc2894b14a7598c 100644
--- a/chrome/browser/resources/chromeos/login/login_common.js
+++ b/chrome/browser/resources/chromeos/login/login_common.js
@@ -293,17 +293,46 @@ 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) {
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.
+ // Helper method that runs |fn| after |screenName| is visible.
+ function waitForOobeScreen(screenName, fn) {
+ if (Oobe.getInstance().currentScreen.id === screenName) {
+ fn();
+ } else {
+ $('oobe').addEventListener('screenchanged', function handler(e) {
+ if (e.detail == screenName) {
+ fn();
+ $('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
+ }
+ });
+ }
+ }
+
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 {
+ waitForOobeScreen('gaia-signin', function() {
+ chrome.send('toggleEnrollmentScreen');
+ chrome.send('toggleFakeEnrollment');
+ });
+
+ waitForOobeScreen('oauth-enrollment', function() {
+ chrome.send('oauthEnrollCompleteLogin', [username, 'authcode']);
+ 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.
+ });
+ }
};
/**

Powered by Google App Engine
This is Rietveld 408576698