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

Unified Diff: tools/chrome_remote_control/chrome_remote_control/page_runner.py

Issue 10914237: Port perf.py's _LoginToGoogleAccount to chrome_remote_control (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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: tools/chrome_remote_control/chrome_remote_control/page_runner.py
diff --git a/tools/chrome_remote_control/chrome_remote_control/page_runner.py b/tools/chrome_remote_control/chrome_remote_control/page_runner.py
index a3344144d0432a76e6d3b23d3398ff58a2cf6b47..edd66ccfb2515b5d5ac7d759cfe93938521ecf16 100644
--- a/tools/chrome_remote_control/chrome_remote_control/page_runner.py
+++ b/tools/chrome_remote_control/chrome_remote_control/page_runner.py
@@ -9,6 +9,7 @@ import urlparse
from chrome_remote_control import page_test
from chrome_remote_control import util
+from chrome_remote_control import credentials_backend
class PageRunner(object):
"""Runs a given test against a given test."""
@@ -26,6 +27,8 @@ class PageRunner(object):
self.Close()
def Run(self, options, possible_browser, test, results):
+ credentials_backend.CredentialsBackend.SetCredentialsConfigFile(
nduca 2012/10/02 18:02:10 Why are you making this a static method? This shou
hartmanng 2012/10/02 20:18:16 Done.
+ self.page_set.credentials_path)
nduca 2012/10/02 18:02:10 what if the credentials_path is none?
hartmanng 2012/10/02 20:18:16 Then we're assuming that no credentials are needed
with possible_browser.Create() as browser:
with browser.ConnectToNthTab(0) as tab:
for page in self.page_set:
@@ -41,7 +44,7 @@ class PageRunner(object):
page.url, traceback.format_exc())
raise
finally:
- self.CleanUpPage()
+ self.CleanUpPage(page, tab)
try:
test.Run(options, page, tab, results)
@@ -58,7 +61,7 @@ class PageRunner(object):
page.url, traceback.format_exc())
raise
finally:
- self.CleanUpPage()
+ self.CleanUpPage(page, tab)
def Close(self):
if self._server:
@@ -78,6 +81,9 @@ class PageRunner(object):
self._server = tab.browser.CreateTemporaryHTTPServer(dirname)
page.url = self._server.UrlOf(filename)
+ if page.credentials:
+ tab.LoginNeeded(page.credentials)
+
tab.page.Navigate(page.url)
# TODO(dtu): Detect HTTP redirects.
if page.wait_time_after_navigate:
@@ -85,5 +91,6 @@ class PageRunner(object):
time.sleep(page.wait_time_after_navigate)
tab.WaitForDocumentReadyStateToBeInteractiveOrBetter()
- def CleanUpPage(self):
- pass
+ def CleanUpPage(self, page, tab): # pylint: disable=R0201
+ if page.credentials:
+ tab.LoginNoLongerNeeded(page.credentials)

Powered by Google App Engine
This is Rietveld 408576698