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 from telemetry
.story
import story_set
as story_set_module
6 from gpu_tests
import gpu_test_base
8 class PixelTestsPage(gpu_test_base
.PageBase
):
10 def __init__(self
, url
, name
, test_rect
, revision
, story_set
, expectations
,
11 expected_colors
=None):
12 super(PixelTestsPage
, self
).__init
__(url
=url
, page_set
=story_set
, name
=name
,
13 expectations
=expectations
)
14 self
.test_rect
= test_rect
15 self
.revision
= revision
17 self
.expected_colors
= expected_colors
19 def RunNavigateStepsInner(self
, action_runner
):
20 action_runner
.WaitForJavaScriptCondition(
21 'domAutomationController._finished', timeout_in_seconds
=30)
24 class PixelTestsStorySet(story_set_module
.StorySet
):
26 """ Some basic test cases for GPU. """
28 def __init__(self
, expectations
, base_name
='Pixel'):
29 super(PixelTestsStorySet
, self
).__init
__()
30 self
.AddStory(PixelTestsPage(
31 url
='file://../../data/gpu/pixel_canvas2d.html',
32 name
=base_name
+ '.Canvas2DRedBox',
33 test_rect
=[0, 0, 300, 300],
36 expectations
=expectations
))
38 self
.AddStory(PixelTestsPage(
39 url
='file://../../data/gpu/pixel_css3d.html',
40 name
=base_name
+ '.CSS3DBlueBox',
41 test_rect
=[0, 0, 300, 300],
44 expectations
=expectations
))
46 self
.AddStory(PixelTestsPage(
47 url
='file://../../data/gpu/pixel_webgl.html',
48 name
=base_name
+ '.WebGLGreenTriangle',
49 test_rect
=[0, 0, 300, 300],
52 expectations
=expectations
))
54 self
.AddStory(PixelTestsPage(
55 url
='file://../../data/gpu/pixel_scissor.html',
56 name
=base_name
+ '.ScissorTestWithPreserveDrawingBuffer',
57 test_rect
=[0, 0, 300, 300],
58 revision
=0, # This is not used.
60 expectations
=expectations
,
61 expected_colors
='../../data/gpu/pixel_scissor_expectations.json'))