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

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

Issue 93733002: [Telemetry] Refactoring in preparation for video-based Speed Index support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix lint Created 7 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
« no previous file with comments | « tools/telemetry/telemetry/core/platform/platform_backend.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/tab.py
diff --git a/tools/telemetry/telemetry/core/tab.py b/tools/telemetry/telemetry/core/tab.py
index b129a8371dead9f145043f919281080a15c7f38f..a9776573c360d542ec7d86ff88c6fb9e7a4f4821 100644
--- a/tools/telemetry/telemetry/core/tab.py
+++ b/tools/telemetry/telemetry/core/tab.py
@@ -64,13 +64,50 @@ class Tab(web_contents.WebContents):
@property
def screenshot_supported(self):
- """True if the browser instance is capable of capturing screenshots"""
+ """True if the browser instance is capable of capturing screenshots."""
return self._inspector_backend.screenshot_supported
def Screenshot(self, timeout=DEFAULT_TAB_TIMEOUT):
- """Capture a screenshot of the window for rendering validation"""
+ """Capture a screenshot of the tab's contents.
+
+ Returns:
+ A telemetry.core.backends.png_bitmap.
+ """
return self._inspector_backend.Screenshot(timeout)
+ @property
+ def video_capture_supported(self):
+ """True if the browser instance is capable of capturing video."""
+ return self.browser.platform.CanCaptureVideo()
+
+ def StartVideoCapture(self, min_bitrate_mbps):
+ """Starts capturing video of the tab's contents.
+
+ Args:
+ 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.
+ """
+ self.browser.platform.StartVideoCapture(min_bitrate_mbps)
+
+ def StopVideoCapture(self):
+ """Stops recording video of the tab's contents.
+
+ Yields:
+ (time_ms, bitmap) tuples representing each video keyframe. Only the first
+ frame in a run of sequential duplicate bitmaps is included.
+ time_ms is milliseconds since navigationStart.
+ bitmap is a telemetry.core.backends.png_bitmap.
+ """
+ # TODO(tonyg/szym): platform's video capture may include offscreen content
+ # from a webcam, OS framing and browser framing. However, this API must
+ # return only the tab contents. So we need to display a color flash in the
+ # tab and then crop out all the other pixels. We also need to translate that
+ # initial flash time into navigationStart timespace.
+
+ for t in self.browser.platform.StopVideoCapture():
+ return t
slamm 2013/12/03 01:17:32 yield t or return (t for t in self.browser.platf
+
def PerformActionAndWaitForNavigate(
self, action_function, timeout=DEFAULT_TAB_TIMEOUT):
"""Executes action_function, and waits for the navigation to complete.
« no previous file with comments | « tools/telemetry/telemetry/core/platform/platform_backend.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698