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

Unified Diff: content/test/gpu/gpu_tests/screenshot_sync.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
Index: content/test/gpu/gpu_tests/screenshot_sync.py
diff --git a/content/test/gpu/gpu_tests/screenshot_sync.py b/content/test/gpu/gpu_tests/screenshot_sync.py
index a2d8abb540e8600ac06380697eb439e9b34ee75f..8575789db16a51aec16695e029c38878fc3dfd4d 100644
--- a/content/test/gpu/gpu_tests/screenshot_sync.py
+++ b/content/test/gpu/gpu_tests/screenshot_sync.py
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
+import random
import screenshot_sync_expectations as expectations
@@ -17,14 +18,27 @@ data_path = os.path.join(
util.GetChromiumSrcDir(), 'content', 'test', 'data', 'gpu')
class _ScreenshotSyncValidator(page_test.PageTest):
- def CustomizeBrowserOptions(self, options):
- options.AppendExtraBrowserArgs('--enable-gpu-benchmarking')
-
def ValidatePage(self, page, tab, results):
- test_success = tab.EvaluateJavaScript('window.__testSuccess')
- if not test_success:
- message = tab.EvaluateJavaScript('window.__testMessage')
- raise page_test.Failure(message)
+ if not tab.screenshot_supported:
+ raise page_test.Failure('Browser does not support screenshot capture')
+
+ def CheckColorMatch(canvasRGB, screenshotRGB):
+ for i in range(0, 3):
+ if abs(canvasRGB[i] - screenshotRGB[i]) > 1:
+ raise page_test.Failure('Color mismatch in component #%d: %d vs %d' %
+ (i, canvasRGB[i], screenshotRGB[i]))
+
+ def CheckScreenshot():
+ canvasRGB = [];
+ for i in range(0, 3):
+ canvasRGB.append(random.randint(0, 255))
+ tab.EvaluateJavaScript("window.draw(%d, %d, %d);" % tuple(canvasRGB))
+ screenshot = tab.Screenshot(5)
+ CheckColorMatch(canvasRGB, screenshot.pixels)
+
+ repetitions = 50
+ for n in range(0, repetitions):
+ CheckScreenshot()
class ScreenshotSyncPage(page.Page):
@@ -38,9 +52,6 @@ class ScreenshotSyncPage(page.Page):
def RunNavigateSteps(self, action_runner):
action_runner.NavigateToPage(self)
- action_runner.RunAction(WaitAction({
- 'javascript': 'window.__testComplete',
- 'timeout': 120}))
class ScreenshotSyncProcess(test.Test):
« no previous file with comments | « content/test/data/gpu/screenshot_sync.html ('k') | tools/telemetry/telemetry/core/backends/chrome/inspector_backend.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698