Fixes for enterprise_RemoraRequisition.
BUG=chromium:495847
TEST=enterprise_RemoraRequisition
Change-Id: I26adc9bd1f37e8289ed724ded068f29123a5eca6
Reviewed-on: https://chromium-review.googlesource.com/285652
Commit-Queue: Achuith Bhandarkar <achuith@chromium.org>
Trybot-Ready: Achuith Bhandarkar <achuith@chromium.org>
Tested-by: Achuith Bhandarkar <achuith@chromium.org>
Reviewed-by: David Abrahams <resetswitch@chromium.org>
Reviewed-by: Achuith Bhandarkar <achuith@chromium.org>
diff --git a/client/common_lib/cros/enrollment.py b/client/common_lib/cros/enrollment.py
index fda488f..66f112a 100644
--- a/client/common_lib/cros/enrollment.py
+++ b/client/common_lib/cros/enrollment.py
@@ -5,8 +5,7 @@
import logging
from autotest_lib.client.bin import utils
-from autotest_lib.client.common_lib.cros import chrome, tpm_utils
-from telemetry.core.platform import cros_interface
+from autotest_lib.client.common_lib.cros import chrome
def _ExecuteOobeCmd(browser, cmd):
@@ -21,29 +20,11 @@
@param browser: telemetry browser object.
"""
- _cri = cros_interface.CrOSInterface()
- pid = _cri.GetChromePid()
- # This will restart the browser.
- chrome.Chrome.did_browser_crash(
+ chrome.Chrome.wait_for_browser_restart(
lambda: _ExecuteOobeCmd(browser,
'Oobe.remoraRequisitionForTesting();'))
- utils.poll_for_condition(lambda: pid != _cri.GetChromePid(), timeout=60)
utils.poll_for_condition(lambda: browser.oobe_exists, timeout=30)
- _ExecuteOobeCmd(browser, 'Oobe.skipToLoginForTesting();')
- tpm_utils.SaveTPMPassword()
-
-
-def FinishEnrollment(oobe):
- """Wait for enrollment to finish and dismiss the last enrollment screen.
-
- @param oobe: telemetry oobe object.
- """
- oobe.WaitForJavaScriptExpression(
- "document.getElementById('oauth-enrollment').className."
- "search('oauth-enroll-state-success') != -1", 30)
- oobe.EvaluateJavaScript('Oobe.enterpriseEnrollmentDone();')
-
def RemoraEnrollment(browser, user_id, password):
"""Enterprise login for a Remora device.
@@ -53,5 +34,7 @@
@param password: login credentials password.
"""
SwitchToRemora(browser)
- browser.oobe.NavigateGaiaLogin(user_id, password)
- FinishEnrollment(browser.oobe)
+ chrome.Chrome.wait_for_browser_restart(
+ lambda: browser.oobe.NavigateGaiaLogin(
+ user_id, password, enterprise_enroll=True,
+ for_user_triggered_enrollment=False))