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

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

Issue 1007903004: Telemetry: Finish documenting exceptions thrown by tab.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase against top of tree. Created 5 years, 9 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/telemetry/telemetry/core/tab.py
diff --git a/tools/telemetry/telemetry/core/tab.py b/tools/telemetry/telemetry/core/tab.py
index 4dc251f7c1f418eb4a0d3502dbbe95f5bc56d43e..784561be414fc020ad19e8a408b24f145c2d378c 100644
--- a/tools/telemetry/telemetry/core/tab.py
+++ b/tools/telemetry/telemetry/core/tab.py
@@ -31,6 +31,11 @@ class Tab(web_contents.WebContents):
@property
def url(self):
+ """Returns the URL of the tab, as reported by devtools.
+
+ Raises:
+ devtools_http.DevToolsClientConnectionError
+ """
return self._inspector_backend.url
@property
@@ -43,6 +48,11 @@ class Tab(web_contents.WebContents):
'node_count': integer,
'event_listener_count': integer
}
+
+ Raises:
+ inspector_memory.InspectorMemoryException
+ exceptions.TimeoutException
+ exceptions.DevtoolsTargetCrashException
"""
dom_counters = self._inspector_backend.GetDOMStats(
timeout=DEFAULT_TAB_TIMEOUT)
@@ -93,6 +103,10 @@ class Tab(web_contents.WebContents):
Returns:
A telemetry.core.Bitmap.
+ Raises:
+ exceptions.WebSocketDisconnected
+ exceptions.TimeoutException
+ exceptions.DevtoolsTargetCrashException
"""
return self._inspector_backend.Screenshot(timeout)
@@ -106,6 +120,12 @@ class Tab(web_contents.WebContents):
TODO(tonyg): It is possible that the z-index hack here might not work for
all pages. If this happens, DevTools also provides a method for this.
+
+ Raises:
+ exceptions.EvaluateException
+ exceptions.WebSocketDisconnected
+ exceptions.TimeoutException
+ exceptions.DevtoolsTargetCrashException
"""
self.ExecuteJavaScript("""
(function() {
@@ -129,7 +149,14 @@ class Tab(web_contents.WebContents):
'!!window.__telemetry_screen_%d' % int(color), 5)
def ClearHighlight(self, color):
- """Clears a highlight of the given bitmap.RgbaColor."""
+ """Clears a highlight of the given bitmap.RgbaColor.
+
+ Raises:
+ exceptions.EvaluateException
+ exceptions.WebSocketDisconnected
+ exceptions.TimeoutException
+ exceptions.DevtoolsTargetCrashException
+ """
self.ExecuteJavaScript("""
(function() {
document.body.removeChild(window.__telemetry_screen_%d);
@@ -157,6 +184,13 @@ class Tab(web_contents.WebContents):
min_bitrate_mbps: The minimum caputre bitrate in MegaBits Per Second.
The platform is free to deliver a higher bitrate if it can do so
without increasing overhead.
+
+ Raises:
+ exceptions.EvaluateException
+ exceptions.WebSocketDisconnected
+ exceptions.TimeoutException
+ exceptions.DevtoolsTargetCrashException
+ ValueError: If the required |min_bitrate_mbps| can't be achieved.
"""
self.Highlight(highlight_bitmap)
self.browser.platform.StartVideoCapture(min_bitrate_mbps)
@@ -178,10 +212,23 @@ class Tab(web_contents.WebContents):
return self.browser.platform.StopVideoCapture()
def GetCookieByName(self, name, timeout=DEFAULT_TAB_TIMEOUT):
- """Returns the value of the cookie by the given |name|."""
+ """Returns the value of the cookie by the given |name|.
+
+ Raises:
+ exceptions.WebSocketDisconnected
+ exceptions.TimeoutException
+ exceptions.DevtoolsTargetCrashException
+ """
return self._inspector_backend.GetCookieByName(name, timeout)
def CollectGarbage(self):
+ """Forces a garbage collection.
+
+ Raises:
+ exceptions.WebSocketDisconnected
+ exceptions.TimeoutException
+ exceptions.DevtoolsTargetCrashException
+ """
self._inspector_backend.CollectGarbage()
def ClearCache(self, force):
@@ -191,6 +238,13 @@ class Tab(web_contents.WebContents):
force: Iff true, navigates to about:blank which destroys the previous
renderer, ensuring that even "live" resources in the memory cache are
cleared.
+
+ Raises:
+ exceptions.EvaluateException
+ exceptions.WebSocketDisconnected
+ exceptions.TimeoutException
+ exceptions.DevtoolsTargetCrashException
+ errors.DeviceUnresponsiveError
"""
self.browser.platform.FlushDnsCache()
self.ExecuteJavaScript("""

Powered by Google App Engine
This is Rietveld 408576698