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.
4from telemetry.page import page as page_module
5from telemetry.page import page_set as page_set_module
6
7
8class GpuRasterizationTestsPage(page_module.Page):
9
10  def __init__(self, page_set):
11    super(GpuRasterizationTestsPage, self).__init__(
12      url='file://../../data/gpu/pixel_background.html',
13      page_set=page_set,
14      name='GpuRasterization.BlueBox')
15
16    self.expectations = [
17      {'comment': 'body-t',
18       'color': [255, 255, 255],
19       'tolerance': 0,
20       'location': [5, 5]},
21      {'comment': 'body-r',
22       'color': [255, 255, 255],
23       'tolerance': 0,
24       'location': [215, 5]},
25      {'comment': 'body-b',
26       'color': [255, 255, 255],
27       'tolerance': 0,
28       'location': [215, 215]},
29      {'comment': 'body-l',
30       'color': [255, 255, 255],
31       'tolerance': 0,
32       'location': [5, 215]},
33      {'comment': 'background-t',
34       'color': [0, 0, 0],
35       'tolerance': 0,
36       'location': [30, 30]},
37      {'comment': 'background-r',
38       'color': [0, 0, 0],
39       'tolerance': 0,
40       'location': [170, 30]},
41      {'comment': 'background-b',
42       'color': [0, 0, 0],
43       'tolerance': 0,
44       'location': [170, 170]},
45      {'comment': 'background-l',
46       'color': [0, 0, 0],
47       'tolerance': 0,
48       'location': [30, 170]},
49      {'comment': 'box-t',
50       'color': [0, 0, 255],
51       'tolerance': 0,
52       'location': [70, 70]},
53      {'comment': 'box-r',
54       'color': [0, 0, 255],
55       'tolerance': 0,
56       'location': [140, 70]},
57      {'comment': 'box-b',
58       'color': [0, 0, 255],
59       'tolerance': 0,
60       'location': [140, 140]},
61      {'comment': 'box-l',
62       'color': [0, 0, 255],
63       'tolerance': 0,
64       'location': [70, 140]}
65    ]
66    self.test_rect = [0, 0, 220, 220]
67
68  def RunNavigateSteps(self, action_runner):
69    action_runner.NavigateToPage(self)
70    action_runner.WaitForJavaScriptCondition(
71        'domAutomationController._finished', timeout_in_seconds=30)
72
73
74class GpuRasterizationTestsPageSet(page_set_module.PageSet):
75
76  """ Basic test cases for GPU rasterization. """
77
78  def __init__(self):
79    super(GpuRasterizationTestsPageSet, self).__init__()
80
81    self.AddPage(GpuRasterizationTestsPage(self))
82