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

Unified Diff: tools/telemetry/telemetry/core/backends/chrome/inspector_backend.py

Issue 190693002: Migrate Telemetry from beginWindowSnapshotPNG to Page.captureScreenshot (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 7 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 | « content/test/gpu/gpu_tests/screenshot_sync.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/backends/chrome/inspector_backend.py
diff --git a/tools/telemetry/telemetry/core/backends/chrome/inspector_backend.py b/tools/telemetry/telemetry/core/backends/chrome/inspector_backend.py
index bd7680c073da3163389ecb311ae6b015ebe2c0e8..07acc758bb9c9cbf87a876331bb9e67e4a544f6c 100644
--- a/tools/telemetry/telemetry/core/backends/chrome/inspector_backend.py
+++ b/tools/telemetry/telemetry/core/backends/chrome/inspector_backend.py
@@ -96,44 +96,14 @@ class InspectorBackend(inspector_websocket.InspectorWebsocket):
# Displays other than 0 mean we are likely running in something like
# xvfb where screenshotting doesn't work.
return False
- return not self.EvaluateJavaScript("""
- window.chrome.gpuBenchmarking === undefined ||
- window.chrome.gpuBenchmarking.beginWindowSnapshotPNG === undefined
- """)
+ return True
def Screenshot(self, timeout):
assert self.screenshot_supported, 'Browser does not support screenshotting'
- self.EvaluateJavaScript("""
- if(!window.__telemetry) {
- window.__telemetry = {}
- }
- window.__telemetry.snapshotComplete = false;
- window.__telemetry.snapshotData = null;
- window.chrome.gpuBenchmarking.beginWindowSnapshotPNG(
- function(snapshot) {
- window.__telemetry.snapshotData = snapshot;
- window.__telemetry.snapshotComplete = true;
- }
- );
- """)
-
- def IsSnapshotComplete():
- return self.EvaluateJavaScript(
- 'window.__telemetry.snapshotComplete')
-
- util.WaitFor(IsSnapshotComplete, timeout)
-
- snap = self.EvaluateJavaScript("""
- (function() {
- var data = window.__telemetry.snapshotData;
- delete window.__telemetry.snapshotComplete;
- delete window.__telemetry.snapshotData;
- return data;
- })()
- """)
- if snap:
- return bitmap.Bitmap.FromBase64Png(snap['data'])
+ response = self.SyncRequest({'method': 'Page.captureScreenshot'}, timeout)
+ if response:
+ return bitmap.Bitmap.FromBase64Png(response['result']['data'])
return None
# Console public methods.
« no previous file with comments | « content/test/gpu/gpu_tests/screenshot_sync.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698