OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 import logging | 4 import logging |
5 | 5 |
6 # pylint: disable=W0401,W0614 | 6 # pylint: disable=W0401,W0614 |
7 from telemetry.page.actions.all_page_actions import * | 7 from telemetry.page.actions.all_page_actions import * |
8 from telemetry.page import page as page_module | 8 from telemetry.page import page as page_module |
9 from telemetry.page import page_set as page_set_module | 9 from telemetry.page import page_set as page_set_module |
10 | 10 |
11 | 11 |
12 class ToughWebglCasesPage(page_module.Page): | 12 class ToughWebglCasesPage(page_module.Page): |
13 | 13 |
14 def __init__(self, url, page_set): | 14 def __init__(self, url, page_set): |
15 super(ToughWebglCasesPage, self).__init__(url=url, page_set=page_set) | 15 super(ToughWebglCasesPage, self).__init__(url=url, page_set=page_set) |
16 self.archive_data_file = 'data/tough_webgl_cases.json' | 16 self.archive_data_file = 'data/tough_webgl_cases.json' |
17 | 17 |
18 def CanRunOnBrowser(self, browser_info): | 18 def CanRunOnBrowser(self, browser_info): |
19 if not browser_info.HasWebGLSupport(): | 19 if not browser_info.HasWebGLSupport(): |
20 logging.warning('Browser does not support webgl, skipping test') | 20 logging.warning('Browser does not support webgl, skipping test') |
21 return False | 21 return False |
22 return True | 22 return True |
23 | 23 |
24 def RunNavigateSteps(self, action_runner): | 24 def RunNavigateSteps(self, action_runner): |
25 action_runner.NavigateToPage(self) | 25 action_runner.NavigateToPage(self) |
26 action_runner.RunAction(WaitAction( | 26 action_runner.WaitForJavaScriptCondition( |
27 { | 27 'document.readyState == "complete"') |
28 'javascript': 'document.readyState == "complete"' | 28 action_runner.Wait(2) |
29 })) | |
30 action_runner.RunAction(WaitAction({'seconds': 2})) | |
31 | 29 |
32 def RunSmoothness(self, action_runner): | 30 def RunSmoothness(self, action_runner): |
33 action_runner.RunAction(WaitAction({'seconds': 5})) | 31 action_runner.Wait(5) |
34 | 32 |
35 | 33 |
36 class Page1(ToughWebglCasesPage): | 34 class Page1(ToughWebglCasesPage): |
37 | 35 |
38 """ | 36 """ |
39 Why: Observed performance regression with this demo in M33 | 37 Why: Observed performance regression with this demo in M33 |
40 """ | 38 """ |
41 | 39 |
42 def __init__(self, page_set): | 40 def __init__(self, page_set): |
43 super(Page1, self).__init__( | 41 super(Page1, self).__init__( |
44 url='http://montagestudio.com/demos/eco-homes/', | 42 url='http://montagestudio.com/demos/eco-homes/', |
45 page_set=page_set) | 43 page_set=page_set) |
46 | 44 |
47 def RunNavigateSteps(self, action_runner): | 45 def RunNavigateSteps(self, action_runner): |
48 action_runner.NavigateToPage(self) | 46 action_runner.NavigateToPage(self) |
49 action_runner.RunAction(WaitAction( | 47 action_runner.WaitForJavaScriptCondition( |
50 { | 48 'document.readyState == "complete"') |
51 'javascript': 'document.readyState == "complete"' | 49 action_runner.Wait(15) |
52 })) | |
53 action_runner.RunAction(WaitAction({'seconds': 15})) | |
54 | 50 |
55 | 51 |
56 class Page2(ToughWebglCasesPage): | 52 class Page2(ToughWebglCasesPage): |
57 | 53 |
58 def __init__(self, page_set): | 54 def __init__(self, page_set): |
59 super(Page2, self).__init__( | 55 super(Page2, self).__init__( |
60 url='http://helloracer.com/racer-s/', | 56 url='http://helloracer.com/racer-s/', |
61 page_set=page_set) | 57 page_set=page_set) |
62 | 58 |
63 def RunNavigateSteps(self, action_runner): | 59 def RunNavigateSteps(self, action_runner): |
64 action_runner.NavigateToPage(self) | 60 action_runner.NavigateToPage(self) |
65 action_runner.RunAction(WaitAction( | 61 action_runner.WaitForJavaScriptCondition( |
66 { | 62 'document.readyState == "complete"') |
67 'javascript': 'document.readyState == "complete"' | 63 action_runner.Wait(10) |
68 })) | |
69 action_runner.RunAction(WaitAction({'seconds': 10})) | |
70 | 64 |
71 | 65 |
72 class ToughWebglCasesPageSet(page_set_module.PageSet): | 66 class ToughWebglCasesPageSet(page_set_module.PageSet): |
73 | 67 |
74 """ | 68 """ |
75 Description: Self-driven WebGL animation examples | 69 Description: Self-driven WebGL animation examples |
76 """ | 70 """ |
77 | 71 |
78 def __init__(self): | 72 def __init__(self): |
79 super(ToughWebglCasesPageSet, self).__init__( | 73 super(ToughWebglCasesPageSet, self).__init__( |
(...skipping 11 matching lines...) Expand all Loading... |
91 'http://www.khronos.org/registry/webgl/sdk/demos/webkit/Earth.html', | 85 'http://www.khronos.org/registry/webgl/sdk/demos/webkit/Earth.html', |
92 # pylint: disable=C0301 | 86 # pylint: disable=C0301 |
93 'http://www.khronos.org/registry/webgl/sdk/demos/webkit/ManyPlanetsDeep.ht
ml', | 87 'http://www.khronos.org/registry/webgl/sdk/demos/webkit/ManyPlanetsDeep.ht
ml', |
94 'http://webglsamples.googlecode.com/hg/aquarium/aquarium.html', | 88 'http://webglsamples.googlecode.com/hg/aquarium/aquarium.html', |
95 'http://webglsamples.googlecode.com/hg/blob/blob.html', | 89 'http://webglsamples.googlecode.com/hg/blob/blob.html', |
96 # pylint: disable=C0301 | 90 # pylint: disable=C0301 |
97 'http://webglsamples.googlecode.com/hg/dynamic-cubemap/dynamic-cubemap.htm
l' | 91 'http://webglsamples.googlecode.com/hg/dynamic-cubemap/dynamic-cubemap.htm
l' |
98 ] | 92 ] |
99 for url in urls_list: | 93 for url in urls_list: |
100 self.AddPage(ToughWebglCasesPage(url, self)) | 94 self.AddPage(ToughWebglCasesPage(url, self)) |
OLD | NEW |