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

Unified Diff: tools/telemetry/telemetry/core/chrome/misc_web_contents_backend.py

Issue 13836002: Fix navigation of chrome://oobe/login. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 7 years, 8 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/telemetry/core/chrome/cros_util.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/chrome/misc_web_contents_backend.py
===================================================================
--- tools/telemetry/telemetry/core/chrome/misc_web_contents_backend.py (revision 0)
+++ tools/telemetry/telemetry/core/chrome/misc_web_contents_backend.py (revision 0)
@@ -0,0 +1,46 @@
+# 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 httplib
+import json
+import socket
+import urllib2
+
+from telemetry.core import exceptions
+from telemetry.core import web_contents
+from telemetry.core.chrome import inspector_backend
+
+class MiscWebContentsBackend(object):
+ """Provides acccess to chrome://oobe/login page, which is neither an extension
+ nor a tab."""
+ def __init__(self, browser_backend):
+ self._browser_backend = browser_backend
+
+ def GetOobe(self):
+ oobe_web_contents_info = self._FindWebContentsInfo('chrome://oobe/login')
+ if oobe_web_contents_info:
+ debugger_url = oobe_web_contents_info.get('webSocketDebuggerUrl')
+ if debugger_url:
+ inspector = self._CreateInspectorBackend(debugger_url)
+ return web_contents.WebContents(inspector)
+ return None
+
+ def _CreateInspectorBackend(self, debugger_url):
+ return inspector_backend.InspectorBackend(self._browser_backend.browser,
+ self._browser_backend,
+ debugger_url)
+
+ def _ListWebContents(self, timeout=None):
+ try:
+ data = self._browser_backend.Request('', timeout=timeout)
+ return json.loads(data)
+ except (socket.error, httplib.BadStatusLine, urllib2.URLError):
+ if not self._browser_backend.IsBrowserRunning():
+ raise exceptions.BrowserGoneException()
+ raise exceptions.BrowserConnectionGoneException()
+
+ def _FindWebContentsInfo(self, url):
+ for web_contents_info in self._ListWebContents():
+ if web_contents_info.get('url') == url:
+ return web_contents_info
+ return None
« no previous file with comments | « tools/telemetry/telemetry/core/chrome/cros_util.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698