| 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):
|
|
|