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

Side by Side Diff: content/test/gpu/gpu_tests/screenshot_sync_integration_test.py

Issue 2719853003: [Telemetry refactor] Drop "2" from method calls to JS API (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 # Copyright 2017 The Chromium Authors. All rights reserved. 1 # Copyright 2017 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 import os 6 import os
7 import random 7 import random
8 import sys 8 import sys
9 9
10 from gpu_tests import gpu_integration_test 10 from gpu_tests import gpu_integration_test
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 x, y, expectedRGB.r, expectedRGB.g, expectedRGB.b, 108 x, y, expectedRGB.r, expectedRGB.g, expectedRGB.b,
109 pixel_value.r, pixel_value.g, pixel_value.b) 109 pixel_value.r, pixel_value.g, pixel_value.b)
110 self.fail(error_message) 110 self.fail(error_message)
111 111
112 def _CheckScreenshot(self): 112 def _CheckScreenshot(self):
113 canvasRGB = rgba_color.RgbaColor(random.randint(0, 255), 113 canvasRGB = rgba_color.RgbaColor(random.randint(0, 255),
114 random.randint(0, 255), 114 random.randint(0, 255),
115 random.randint(0, 255), 115 random.randint(0, 255),
116 255) 116 255)
117 tab = self.tab 117 tab = self.tab
118 tab.EvaluateJavaScript2( 118 tab.EvaluateJavaScript(
119 "window.draw({{ red }}, {{ green }}, {{ blue }});", 119 "window.draw({{ red }}, {{ green }}, {{ blue }});",
120 red=canvasRGB.r, green=canvasRGB.g, blue=canvasRGB.b) 120 red=canvasRGB.r, green=canvasRGB.g, blue=canvasRGB.b)
121 screenshot = tab.Screenshot(5) 121 screenshot = tab.Screenshot(5)
122 start_x = 10 122 start_x = 10
123 start_y = 0 123 start_y = 0
124 outer_size = 256 124 outer_size = 256
125 skip = 10 125 skip = 10
126 for y in range(start_y, outer_size, skip): 126 for y in range(start_y, outer_size, skip):
127 for x in range(start_x, outer_size, skip): 127 for x in range(start_x, outer_size, skip):
128 self._CheckColorMatchAtLocation(canvasRGB, screenshot, x, y) 128 self._CheckColorMatchAtLocation(canvasRGB, screenshot, x, y)
129 129
130 def RunActualGpuTest(self, test_path, *args): 130 def RunActualGpuTest(self, test_path, *args):
131 browser_arg = args[0] 131 browser_arg = args[0]
132 self.RestartBrowserIfNecessaryWithArgs([browser_arg]) 132 self.RestartBrowserIfNecessaryWithArgs([browser_arg])
133 self._Navigate(test_path) 133 self._Navigate(test_path)
134 repetitions = 20 134 repetitions = 20
135 for _ in range(0, repetitions): 135 for _ in range(0, repetitions):
136 self._CheckScreenshot() 136 self._CheckScreenshot()
137 137
138 def load_tests(loader, tests, pattern): 138 def load_tests(loader, tests, pattern):
139 del loader, tests, pattern # Unused. 139 del loader, tests, pattern # Unused.
140 return gpu_integration_test.LoadAllTestsInModule(sys.modules[__name__]) 140 return gpu_integration_test.LoadAllTestsInModule(sys.modules[__name__])
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/pixel_integration_test.py ('k') | content/test/gpu/gpu_tests/trace_integration_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698