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 PixelTestsPage(page_module.Page):
9
10  def __init__(self, url, name, test_rect, revision, page_set):
11    super(PixelTestsPage, self).__init__(url=url, page_set=page_set, name=name)
12    self.user_agent_type = 'desktop'
13    self.test_rect = test_rect
14    self.revision = revision
15
16  def RunNavigateSteps(self, action_runner):
17    action_runner.NavigateToPage(self)
18    action_runner.WaitForJavaScriptCondition(
19        'domAutomationController._finished', timeout_in_seconds=30)
20
21
22class PixelTestsPageSet(page_set_module.PageSet):
23
24  """ Some basic test cases for GPU. """
25
26  def __init__(self):
27    super(PixelTestsPageSet, self).__init__(
28      user_agent_type='desktop')
29    self.AddPage(PixelTestsPage(
30      url='file://../../data/gpu/pixel_canvas2d.html',
31      name='Pixel.Canvas2DRedBox',
32      test_rect=[0, 0, 300, 300],
33      revision=4,
34      page_set=self))
35
36    self.AddPage(PixelTestsPage(
37      url='file://../../data/gpu/pixel_css3d.html',
38      name='Pixel.CSS3DBlueBox',
39      test_rect=[0, 0, 300, 300],
40      revision=11,
41      page_set=self))
42
43    self.AddPage(PixelTestsPage(
44      url='file://../../data/gpu/pixel_webgl.html',
45      name='Pixel.WebGLGreenTriangle',
46      test_rect=[0, 0, 300, 300],
47      revision=8,
48      page_set=self))
49