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

Unified Diff: tools/telemetry_auto/telemetry_auto/oobe_page.py

Issue 11412238: Proof of concept for running extension API stack through dev tools. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 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
« no previous file with comments | « tools/telemetry_auto/telemetry_auto/__init__.py ('k') | tools/telemetry_auto/telemetry_auto/webui_page.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry_auto/telemetry_auto/oobe_page.py
diff --git a/tools/telemetry_auto/telemetry_auto/oobe_page.py b/tools/telemetry_auto/telemetry_auto/oobe_page.py
new file mode 100644
index 0000000000000000000000000000000000000000..94fc297876a94d8e884d242fbc06b76ea76050e6
--- /dev/null
+++ b/tools/telemetry_auto/telemetry_auto/oobe_page.py
@@ -0,0 +1,97 @@
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+import os
+import sys
+
+import telemetry
+from telemetry import tab_crash_exception
+from telemetry import util
+from telemetry_auto.webui_page import WebUIPage
+
+class OobePage(WebUIPage):
+ def __init__(self, browser):
+ self.current_screen = None
+ self.page_urls = ["chrome://oobe/", "chrome://oobe/login"]
+ super(OobePage, self).__init__(browser)
+
+ def GetCurrentScreenId(self):
+ try:
+ self.current_screen = self.page.runtime.Evaluate(
+ 'cr.ui.Oobe.getInstance().currentScreen.id')
+ except:
+ return None
+ return self.current_screen
+
+ def WaitForStartupScreen(self):
+ # Wait for any OOBE screen to show up .
+ util.WaitFor(lambda:
+ not self.GetCurrentScreenId() is None,
+ timeout = 30)
+ return self.current_screen
+
+ def WaitUntilScreenChanges(self, last_screen):
+ # Wait for any OOBE screen to show up .
+ util.WaitFor(lambda:
+ self.GetCurrentScreenId() != last_screen,
+ timeout = 30)
+ return self.current_screen
+
+ def AttachTestHooks(self):
+ # Wait for any OOBE screen to show up.
+ screen_id = self.WaitForStartupScreen()
+ self.AddTestHelperMethods()
+ return screen_id
+
+ def _WaitForScreen(self, screen_id):
+ util.WaitFor(
+ lambda: self.page.runtime.Evaluate(
+ 'cr.ui.Oobe.getInstance().currentScreen.id') == screen_id,
+ timeout = 30)
+
+ def LoginUser(self, email, password):
+ self.WaitForPageToLoad(self.page_urls)
+ # Get the initial screen id and set up helper functions.
+ screen_id = self.AttachTestHooks()
+ print 'Starting at screen %s' % screen_id
+ if screen_id == 'account-picker':
+ # We want to add a new user here.
+ self.ClickOnButton('add-user-button')
+ elif screen_id == 'connect':
+ # Pass user network selection screen.
+ self.ClickOnButton('continue-button')
+
+ screen_id = self.WaitUntilScreenChanges(screen_id);
+ print 'At screen %s' % screen_id
+
+ if screen_id == 'eula':
+ self.ClickOnButton('accept-button')
+ screen_id = self.WaitUntilScreenChanges(screen_id);
+ print 'At screen %s' % screen_id
+
+ # Trigger GAIA login event.
+ self._WaitForScreen('gaia-signin')
+ self._LoginAs(email, password)
+ try:
+ # Pass user avatar image selection.
+ self._WaitForScreen('user-image')
+ self.ClickOnButton('ok-button')
+ except(tab_crash_exception.TabCrashException):
+ # Since OOBE is going away here, there is a chance that its debugger
+ # handler might disappear while we are still waiting for its response.
+ pass
+
+ def _LoginAs(self, email, password):
+ login_command = """
+ $('gaia-signin').onMessage_(
+ { origin:
+ 'chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/main.html',
+ source: $('signin-frame').contentWindow,
+ data: {
+ method: 'completeLogin',
+ email: '%s',
+ password: '%s'
+ }
+ });
+ """ % (email, password)
+ self.page.runtime.Execute(login_command)
« no previous file with comments | « tools/telemetry_auto/telemetry_auto/__init__.py ('k') | tools/telemetry_auto/telemetry_auto/webui_page.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698