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

Unified Diff: tools/telemetry/telemetry/browser_backend.py

Issue 11663011: Adds function for activating a tab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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/telemetry/telemetry/browser_backend.py
diff --git a/tools/telemetry/telemetry/browser_backend.py b/tools/telemetry/telemetry/browser_backend.py
index 702f249d95d9cd2b202b6ecd36c566a2af3b495a..80b356408ce5532c2dd18858ca0fe1061ca17a81 100644
--- a/tools/telemetry/telemetry/browser_backend.py
+++ b/tools/telemetry/telemetry/browser_backend.py
@@ -43,6 +43,21 @@ class TabController(object):
self._UpdateTabList()
return url in self._tab_list
+ def ActivateTab(self, debugger_url, timeout=None):
+ """Activates a tab.
+
nduca 2012/12/21 22:15:23 This doesn't make sense on the tab controller. br
Danh Nguyen 2012/12/26 19:13:04 Done.
Danh Nguyen 2012/12/26 19:13:04 Done. I'm moving this function to tab.py as you s
dtu 2012/12/27 18:57:25 This is actually similar to how Close() works. tab
+ Args:
+ debugger_url: webSocketDebuggerUrl of the tab.
+ """
+ tab_id = debugger_url.split('/')[-1]
+ try:
+ response = self._browser_backend.Request('activate/%s' % tab_id,
+ timeout=timeout)
+ except urllib2.HTTPError:
+ raise Exception('Unable to activate tab, tab id not found: %s' % tab_id)
+ assert response == 'Target activated'
+ self._UpdateTabList()
+
def CloseTab(self, debugger_url, timeout=None):
# TODO(dtu): crbug.com/160946, allow closing the last tab on some platforms.
# For now, just create a new tab before closing the last tab.

Powered by Google App Engine
This is Rietveld 408576698