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

Side by Side Diff: content/test/gpu/page_sets/pixel_tests.py

Issue 2604153005: Port trace_test to the new gpu_integration_test harness. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « content/test/gpu/page_sets/__init__.py ('k') | testing/buildbot/chromium.gpu.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from telemetry.story import story_set as story_set_module
6
7 import sys
8
9 from gpu_tests import gpu_test_base
10
11
12 class PixelTestsPage(gpu_test_base.PageBase):
13
14 def __init__(self, url, name, test_rect, revision, story_set,
15 shared_page_state_class, expectations, expected_colors=None,
16 tolerance=2):
17 super(PixelTestsPage, self).__init__(
18 url=url, page_set=story_set, name=name,
19 shared_page_state_class=shared_page_state_class,
20 expectations=expectations)
21 self.test_rect = test_rect
22 self.revision = revision
23
24 # The tolerance when comparing against the reference image.
25 self.tolerance = tolerance
26 if expected_colors:
27 self.expected_colors = expected_colors
28
29 def RunNavigateSteps(self, action_runner):
30 super(PixelTestsPage, self).RunNavigateSteps(action_runner)
31 action_runner.WaitForJavaScriptCondition(
32 'domAutomationController._finished', timeout_in_seconds=30)
33
34
35 class PixelTestsES3SharedPageState(gpu_test_base.GpuSharedPageState):
36 def __init__(self, test, finder_options, story_set):
37 super(PixelTestsES3SharedPageState, self).__init__(
38 test, finder_options, story_set)
39 finder_options.browser_options.AppendExtraBrowserArgs(
40 ['--enable-es3-apis'])
41
42
43 class IOSurface2DCanvasSharedPageState(gpu_test_base.GpuSharedPageState):
44 def __init__(self, test, finder_options, story_set):
45 super(IOSurface2DCanvasSharedPageState, self).__init__(
46 test, finder_options, story_set)
47 finder_options.browser_options.AppendExtraBrowserArgs(
48 ['--enable-accelerated-2d-canvas',
49 '--disable-display-list-2d-canvas'])
50
51
52 class WebGLNonChromiumImageSharedPageState(gpu_test_base.GpuSharedPageState):
53 def __init__(self, test, finder_options, story_set):
54 super(WebGLNonChromiumImageSharedPageState, self).__init__(
55 test, finder_options, story_set)
56 finder_options.browser_options.AppendExtraBrowserArgs(
57 ['--disable-webgl-image-chromium'])
58
59
60 class DisableMacOverlaysSharedPageState(gpu_test_base.GpuSharedPageState):
61 def __init__(self, test, finder_options, story_set):
62 super(DisableMacOverlaysSharedPageState, self).__init__(
63 test, finder_options, story_set)
64 finder_options.browser_options.AppendExtraBrowserArgs(
65 ['--disable-mac-overlays'])
66
67
68 class EnableExperimentalCanvasFeaturesSharedPageState(
69 gpu_test_base.GpuSharedPageState):
70 def __init__(self, test, finder_options, story_set):
71 super(EnableExperimentalCanvasFeaturesSharedPageState, self).__init__(
72 test, finder_options, story_set)
73 finder_options.browser_options.AppendExtraBrowserArgs(
74 ['--enable-experimental-canvas-features'])
75
76 class PixelTestsStorySet(story_set_module.StorySet):
77
78 """ Some basic test cases for GPU. """
79 def __init__(self, expectations, base_name='Pixel', try_es3=False):
80 super(PixelTestsStorySet, self).__init__()
81 self._AddAllPages(expectations, base_name, False)
82
83 # Pages requiring the use of --enable-experimental-canvas-features
84 self.AddStory(PixelTestsPage(
85 url='file://../../data/gpu/pixel_offscreenCanvas_transferToImageBitmap_mai n.html',
86 name=base_name + '.OffscreenCanvasTransferToImageBitmap',
87 test_rect=[0, 0, 300, 300],
88 revision=1,
89 story_set=self,
90 shared_page_state_class=EnableExperimentalCanvasFeaturesSharedPageState,
91 expectations=expectations))
92
93 self.AddStory(PixelTestsPage(
94 url='file://../../data/gpu/pixel_offscreenCanvas_transferToImageBitmap_wor ker.html',
95 name=base_name + '.OffscreenCanvasTransferToImageBitmapWorker',
96 test_rect=[0, 0, 300, 300],
97 revision=1,
98 story_set=self,
99 shared_page_state_class=EnableExperimentalCanvasFeaturesSharedPageState,
100 expectations=expectations))
101
102 self.AddStory(PixelTestsPage(
103 url='file://../../data/gpu/pixel_offscreenCanvas_webgl_commit_main.html',
104 name=base_name + '.OffscreenCanvasWebGLGreenBox',
105 test_rect=[0, 0, 300, 300],
106 revision=2,
107 story_set=self,
108 shared_page_state_class=EnableExperimentalCanvasFeaturesSharedPageState,
109 expectations=expectations))
110
111 self.AddStory(PixelTestsPage(
112 url='file://../../data/gpu/pixel_offscreenCanvas_webgl_commit_worker.html' ,
113 name=base_name + '.OffscreenCanvasWebGLRedBoxWorker',
114 test_rect=[0, 0, 300, 300],
115 revision=3,
116 story_set=self,
117 shared_page_state_class=EnableExperimentalCanvasFeaturesSharedPageState,
118 expectations=expectations))
119
120 self.AddStory(PixelTestsPage(
121 url='file://../../data/gpu/pixel_offscreenCanvas_2d_commit_main.html',
122 name=base_name + '.OffscreenCanvasAccelerated2D',
123 test_rect=[0, 0, 350, 350],
124 revision=1,
125 story_set=self,
126 shared_page_state_class=EnableExperimentalCanvasFeaturesSharedPageState,
127 expectations=expectations))
128
129 self.AddStory(PixelTestsPage(
130 url='file://../../data/gpu/pixel_offscreenCanvas_2d_commit_worker.html',
131 name=base_name + '.OffscreenCanvasAccelerated2DWorker',
132 test_rect=[0, 0, 350, 350],
133 revision=1,
134 story_set=self,
135 shared_page_state_class=EnableExperimentalCanvasFeaturesSharedPageState,
136 expectations=expectations))
137
138
139 # Would be better to fetch this from Telemetry.
140 # TODO(kbr): enable this on all platforms. Don't know what will
141 # happen on Android right now.
142 if try_es3 and sys.platform.startswith('darwin'):
143 # Add all the tests again, this time with the
144 # --enable-es3-apis command line argument. This has the
145 # side-effect of enabling the Core Profile rendering path on Mac
146 # OS.
147 self._AddAllPages(expectations, base_name, True)
148
149 if sys.platform.startswith('darwin'):
150 # On OS X, test the IOSurface 2D Canvas compositing path.
151 self.AddStory(PixelTestsPage(
152 url='file://../../data/gpu/pixel_canvas2d_accelerated.html',
153 name=base_name + '.IOSurface2DCanvas',
154 test_rect=[0, 0, 400, 400],
155 revision=1,
156 story_set=self,
157 shared_page_state_class=IOSurface2DCanvasSharedPageState,
158 expectations=expectations))
159 self.AddStory(PixelTestsPage(
160 url='file://../../data/gpu/pixel_canvas2d_webgl.html',
161 name=base_name + '.IOSurface2DCanvasWebGL',
162 test_rect=[0, 0, 300, 300],
163 revision=2,
164 story_set=self,
165 shared_page_state_class=IOSurface2DCanvasSharedPageState,
166 expectations=expectations))
167
168 # On OS X, test WebGL non-Chromium Image compositing path.
169 self.AddStory(PixelTestsPage(
170 url='file://../../data/gpu/pixel_webgl_aa_alpha.html',
171 name=base_name + '.WebGLGreenTriangle.NonChromiumImage.AA.Alpha',
172 test_rect=[0, 0, 300, 300],
173 revision=1,
174 story_set=self,
175 shared_page_state_class=WebGLNonChromiumImageSharedPageState,
176 expectations=expectations))
177
178 self.AddStory(PixelTestsPage(
179 url='file://../../data/gpu/pixel_webgl_noaa_alpha.html',
180 name=base_name + '.WebGLGreenTriangle.NonChromiumImage.NoAA.Alpha',
181 test_rect=[0, 0, 300, 300],
182 revision=1,
183 story_set=self,
184 shared_page_state_class=WebGLNonChromiumImageSharedPageState,
185 expectations=expectations))
186
187 self.AddStory(PixelTestsPage(
188 url='file://../../data/gpu/pixel_webgl_aa_noalpha.html',
189 name=base_name + '.WebGLGreenTriangle.NonChromiumImage.AA.NoAlpha',
190 test_rect=[0, 0, 300, 300],
191 revision=1,
192 story_set=self,
193 shared_page_state_class=WebGLNonChromiumImageSharedPageState,
194 expectations=expectations))
195
196 self.AddStory(PixelTestsPage(
197 url='file://../../data/gpu/pixel_webgl_noaa_noalpha.html',
198 name=base_name + '.WebGLGreenTriangle.NonChromiumImage.NoAA.NoAlpha',
199 test_rect=[0, 0, 300, 300],
200 revision=1,
201 story_set=self,
202 shared_page_state_class=WebGLNonChromiumImageSharedPageState,
203 expectations=expectations))
204
205 # On macOS, test CSS filter effects with and without the CA compositor.
206 self.AddStory(PixelTestsPage(
207 url='file://../../data/gpu/filter_effects.html',
208 name=base_name + '.CSSFilterEffects',
209 test_rect=[0, 0, 300, 300],
210 revision=2,
211 story_set=self,
212 shared_page_state_class=gpu_test_base.GpuSharedPageState,
213 expectations=expectations,
214 tolerance=10))
215
216 self.AddStory(PixelTestsPage(
217 url='file://../../data/gpu/filter_effects.html',
218 name=base_name + '.CSSFilterEffects.NoOverlays',
219 test_rect=[0, 0, 300, 300],
220 revision=2,
221 story_set=self,
222 shared_page_state_class=DisableMacOverlaysSharedPageState,
223 expectations=expectations,
224 tolerance=10))
225
226 def _AddAllPages(self, expectations, base_name, use_es3):
227 if use_es3:
228 es3_suffix = 'ES3'
229 shared_page_state_class = PixelTestsES3SharedPageState
230 else:
231 es3_suffix = ''
232 shared_page_state_class = gpu_test_base.GpuSharedPageState
233
234 self.AddStory(PixelTestsPage(
235 url='file://../../data/gpu/pixel_canvas2d.html',
236 name=base_name + '.Canvas2DRedBox' + es3_suffix,
237 test_rect=[0, 0, 300, 300],
238 revision=7,
239 story_set=self,
240 shared_page_state_class=shared_page_state_class,
241 expectations=expectations))
242
243 self.AddStory(PixelTestsPage(
244 url='file://../../data/gpu/pixel_css3d.html',
245 name=base_name + '.CSS3DBlueBox' + es3_suffix,
246 test_rect=[0, 0, 300, 300],
247 revision=15,
248 story_set=self,
249 shared_page_state_class=shared_page_state_class,
250 expectations=expectations))
251
252 self.AddStory(PixelTestsPage(
253 url='file://../../data/gpu/pixel_webgl_aa_alpha.html',
254 name=base_name + '.WebGLGreenTriangle.AA.Alpha' + es3_suffix,
255 test_rect=[0, 0, 300, 300],
256 revision=1,
257 story_set=self,
258 shared_page_state_class=shared_page_state_class,
259 expectations=expectations))
260
261 self.AddStory(PixelTestsPage(
262 url='file://../../data/gpu/pixel_webgl_noaa_alpha.html',
263 name=base_name + '.WebGLGreenTriangle.NoAA.Alpha' + es3_suffix,
264 test_rect=[0, 0, 300, 300],
265 revision=1,
266 story_set=self,
267 shared_page_state_class=shared_page_state_class,
268 expectations=expectations))
269
270 self.AddStory(PixelTestsPage(
271 url='file://../../data/gpu/pixel_webgl_aa_noalpha.html',
272 name=base_name + '.WebGLGreenTriangle.AA.NoAlpha' + es3_suffix,
273 test_rect=[0, 0, 300, 300],
274 revision=1,
275 story_set=self,
276 shared_page_state_class=shared_page_state_class,
277 expectations=expectations))
278
279 self.AddStory(PixelTestsPage(
280 url='file://../../data/gpu/pixel_webgl_noaa_noalpha.html',
281 name=base_name + '.WebGLGreenTriangle.NoAA.NoAlpha' + es3_suffix,
282 test_rect=[0, 0, 300, 300],
283 revision=1,
284 story_set=self,
285 shared_page_state_class=shared_page_state_class,
286 expectations=expectations))
287
288 self.AddStory(PixelTestsPage(
289 url='file://../../data/gpu/pixel_scissor.html',
290 name=base_name + '.ScissorTestWithPreserveDrawingBuffer' + es3_suffix,
291 test_rect=[0, 0, 300, 300],
292 revision=0, # This is not used.
293 story_set=self,
294 shared_page_state_class=shared_page_state_class,
295 expectations=expectations,
296 expected_colors='../../data/gpu/pixel_scissor_expectations.json'))
297
298 self.AddStory(PixelTestsPage(
299 url='file://../../data/gpu/pixel_canvas2d_webgl.html',
300 name=base_name + '.2DCanvasWebGL' + es3_suffix,
301 test_rect=[0, 0, 300, 300],
302 revision=3,
303 story_set=self,
304 shared_page_state_class=shared_page_state_class,
305 expectations=expectations))
306
307 self.AddStory(PixelTestsPage(
308 url='file://../../data/gpu/pixel_background.html',
309 name=base_name + '.SolidColorBackground' + es3_suffix,
310 test_rect=[500, 500, 100, 100],
311 revision=1,
312 story_set=self,
313 shared_page_state_class=shared_page_state_class,
314 expectations=expectations))
315
316 @property
317 def allow_mixed_story_states(self):
318 # Return True here in order to be able to add the same tests with
319 # a different SharedPageState on Mac which tests them with the
320 # Core Profile rendering path.
321 return True
OLDNEW
« no previous file with comments | « content/test/gpu/page_sets/__init__.py ('k') | testing/buildbot/chromium.gpu.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698