diff options
author | vsankar <vsankar@google.com> | 2015-08-03 16:34:37 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-03 23:35:40 +0000 |
commit | 2121ad985525090fa7bc834ff9c0aa38668dc039 (patch) | |
tree | 8bd51a8c06dc5b377f358a1fa2517a9031ae72c4 /components/proximity_auth | |
parent | cc4d5cc2878adfa29871fc16b4805270b381daea (diff) | |
download | chromium_src-2121ad985525090fa7bc834ff9c0aa38668dc039.zip chromium_src-2121ad985525090fa7bc834ff9c0aa38668dc039.tar.gz chromium_src-2121ad985525090fa7bc834ff9c0aa38668dc039.tar.bz2 |
Handle Smart Lock for Android promotion screen.
This CL also introduces some sleeps to resolve UI race conditions.
Review URL: https://codereview.chromium.org/1261643006
Cr-Commit-Position: refs/heads/master@{#341642}
Diffstat (limited to 'components/proximity_auth')
-rw-r--r-- | components/proximity_auth/e2e_test/cros.py | 15 | ||||
-rw-r--r-- | components/proximity_auth/e2e_test/setup_test.py | 3 |
2 files changed, 15 insertions, 3 deletions
diff --git a/components/proximity_auth/e2e_test/cros.py b/components/proximity_auth/e2e_test/cros.py index 4c10226..1f3c091 100644 --- a/components/proximity_auth/e2e_test/cros.py +++ b/components/proximity_auth/e2e_test/cros.py @@ -15,11 +15,11 @@ telemetry_dir = os.path.realpath( if telemetry_dir not in sys.path: sys.path.append(telemetry_dir) -from telemetry.core import browser_options -from telemetry.core import browser_finder +from telemetry.internal.browser import browser_options +from telemetry.internal.browser import browser_finder from telemetry.core import exceptions from telemetry.core import util -from telemetry.core.platform import cros_interface +from telemetry.core import cros_interface from telemetry.internal.browser import extension_to_load logger = logging.getLogger('proximity_auth.%s' % __name__) @@ -217,6 +217,7 @@ class SmartLockApp(object): PAIR = 'pair' CLICK_FOR_TRIAL_RUN = 'click_for_trial_run' TRIAL_RUN_COMPLETED = 'trial_run_completed' + PROMOTE_SMARTLOCK_FOR_ANDROID = 'promote-smart-lock-for-android' def __init__(self, app_page, chromeos): """ @@ -240,6 +241,8 @@ class SmartLockApp(object): return SmartLockApp.PairingState.SCAN elif state == 'pair': return SmartLockApp.PairingState.PAIR + elif state == 'promote-smart-lock-for-android': + return SmartLockApp.PairingState.PROMOTE_SMARTLOCK_FOR_ANDROID elif state == 'complete': button_text = self._app_page.EvaluateJavaScript( 'document.getElementById("pairing-button").textContent') @@ -282,6 +285,8 @@ class SmartLockApp(object): """ assert(self.pairing_state == self.PairingState.PAIR) self._ClickPairingButton() + if self.pairing_state == self.PairingState.PROMOTE_SMARTLOCK_FOR_ANDROID: + self._ClickPairingButton() return self.pairing_state == self.PairingState.CLICK_FOR_TRIAL_RUN def StartTrialRun(self): @@ -309,10 +314,14 @@ class SmartLockApp(object): 'document.getElementById("pairing-button").click()') def _ClickPairingButton(self): + # Waits are needed because the clicks occur before the button label changes. + time.sleep(1) self._app_page.EvaluateJavaScript( 'document.getElementById("pairing-button").click()') + time.sleep(1) util.WaitFor(lambda: self._app_page.EvaluateJavaScript( '!document.getElementById("pairing-button").disabled'), 60) + time.sleep(1) util.WaitFor(lambda: self._app_page.EvaluateJavaScript( '!document.getElementById("pairing-button-title")' '.classList.contains("animated-fade-out")'), 5) diff --git a/components/proximity_auth/e2e_test/setup_test.py b/components/proximity_auth/e2e_test/setup_test.py index 7ef26947..9d7cf78 100644 --- a/components/proximity_auth/e2e_test/setup_test.py +++ b/components/proximity_auth/e2e_test/setup_test.py @@ -152,6 +152,9 @@ def RunSetupTest(args): logger.info('Starting Smart Lock setup flow...') app = settings.StartSetupAndReturnApp() + if app is None: + raise SmartLockSetupError('Failed to obtain set up app window') + _NavigateSetupDialog(chromeos, app) def main(): |