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

Unified Diff: tools/telemetry/telemetry/core/browser.py

Issue 161473002: [Android] Don't wait for background tabs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tonyg@ comments Created 6 years, 10 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/perf/metrics/startup_metric.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/browser.py
diff --git a/tools/telemetry/telemetry/core/browser.py b/tools/telemetry/telemetry/core/browser.py
index e05c61d7e646bbeb81a3edf9c22653c286b833db..3b477e5b88aa3dc29b6245a835c4c68aefedec8b 100644
--- a/tools/telemetry/telemetry/core/browser.py
+++ b/tools/telemetry/telemetry/core/browser.py
@@ -85,6 +85,18 @@ class Browser(object):
return self._tabs
@property
+ def foreground_tab(self):
+ for i in xrange(len(self._tabs)):
+ # The foreground tab is the first (only) one that isn't hidden.
+ # This only works through luck on Android, due to crbug.com/322544
+ # which means that tabs that have never been in the foreground return
+ # document.hidden as false; however in current code the Android foreground
+ # tab is always tab 0, which will be the first one that isn't hidden
+ if self._tabs[i].EvaluateJavaScript('!document.hidden'):
+ return self._tabs[i]
+ raise Exception("No foreground tab found")
+
+ @property
def extensions(self):
"""Returns the extension dictionary if it exists."""
if not self.supports_extensions:
@@ -392,3 +404,4 @@ class Browser(object):
See the documentation of the SystemInfo class for more details."""
return self._browser_backend.GetSystemInfo()
+
« no previous file with comments | « tools/perf/metrics/startup_metric.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698