tough_webgl_cases.py revision 010d83a9304c5a91596085d917d248abff47903a
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# pylint: disable=W0401,W0614
5from telemetry.page.actions.all_page_actions import *
6from telemetry.page import page as page_module
7from telemetry.page import page_set as page_set_module
8
9
10class ToughWebglCasesPage(page_module.Page):
11
12  def __init__(self, url, page_set):
13    super(ToughWebglCasesPage, self).__init__(url=url, page_set=page_set)
14    self.archive_data_file = 'data/tough_webgl_cases.json'
15
16  def RunNavigateSteps(self, action_runner):
17    action_runner.RunAction(NavigateAction())
18    action_runner.RunAction(WaitAction(
19      {
20        'javascript': 'document.readyState == "complete"'
21      }))
22    action_runner.RunAction(WaitAction({'seconds': 2}))
23
24  def RunSmoothness(self, action_runner):
25    action_runner.RunAction(WaitAction({'seconds': 5}))
26
27
28class Page1(ToughWebglCasesPage):
29
30  """
31  Why: Observed performance regression with this demo in M33
32  """
33
34  def __init__(self, page_set):
35    super(Page1, self).__init__(
36      url='http://montagestudio.com/demos/eco-homes/',
37      page_set=page_set)
38
39  def RunNavigateSteps(self, action_runner):
40    action_runner.RunAction(NavigateAction())
41    action_runner.RunAction(WaitAction(
42      {
43        'javascript': 'document.readyState == "complete"'
44      }))
45    action_runner.RunAction(WaitAction({'seconds': 15}))
46
47
48class Page2(ToughWebglCasesPage):
49
50  def __init__(self, page_set):
51    super(Page2, self).__init__(
52      url='http://helloracer.com/racer-s/',
53      page_set=page_set)
54
55  def RunNavigateSteps(self, action_runner):
56    action_runner.RunAction(NavigateAction())
57    action_runner.RunAction(WaitAction(
58      {
59        'javascript': 'document.readyState == "complete"'
60      }))
61    action_runner.RunAction(WaitAction({'seconds': 10}))
62
63
64class ToughWebglCasesPageSet(page_set_module.PageSet):
65
66  """
67  Description: Self-driven WebGL animation examples
68  """
69
70  def __init__(self):
71    super(ToughWebglCasesPageSet, self).__init__(
72      archive_data_file='data/tough_webgl_cases.json')
73
74    self.AddPage(Page1(self))
75    self.AddPage(Page2(self))
76    urls_list = [
77      # pylint: disable=C0301
78      'http://www.khronos.org/registry/webgl/sdk/demos/google/nvidia-vertex-buffer-object/index.html',
79      # pylint: disable=C0301
80      'http://www.khronos.org/registry/webgl/sdk/demos/google/san-angeles/index.html',
81      # pylint: disable=C0301
82      'http://www.khronos.org/registry/webgl/sdk/demos/google/particles/index.html',
83      'http://www.khronos.org/registry/webgl/sdk/demos/webkit/Earth.html',
84      # pylint: disable=C0301
85      'http://www.khronos.org/registry/webgl/sdk/demos/webkit/ManyPlanetsDeep.html',
86      'http://webglsamples.googlecode.com/hg/aquarium/aquarium.html',
87      'http://webglsamples.googlecode.com/hg/blob/blob.html',
88      # pylint: disable=C0301
89      'http://webglsamples.googlecode.com/hg/dynamic-cubemap/dynamic-cubemap.html'
90    ]
91    for url in urls_list:
92      self.AddPage(ToughWebglCasesPage(url, self))
93