OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 from telemetry import test | 4 from telemetry import test |
| 5 from telemetry.page import page |
5 from telemetry.page import page_set | 6 from telemetry.page import page_set |
| 7 from telemetry.page import page_test |
| 8 # pylint: disable=W0401,W0614 |
| 9 from telemetry.page.actions.all_page_actions import * |
| 10 |
6 from webgl_conformance import WebglConformanceValidator | 11 from webgl_conformance import WebglConformanceValidator |
7 from webgl_conformance import conformance_harness_script | 12 from webgl_conformance import conformance_harness_script |
8 from webgl_conformance import conformance_path | 13 from webgl_conformance import conformance_path |
9 | 14 |
10 | 15 |
11 robustness_harness_script = conformance_harness_script + r""" | 16 robustness_harness_script = conformance_harness_script + r""" |
12 var robustnessTestHarness = {}; | 17 var robustnessTestHarness = {}; |
13 robustnessTestHarness._contextLost = false; | 18 robustnessTestHarness._contextLost = false; |
14 robustnessTestHarness.initialize = function() { | 19 robustnessTestHarness.initialize = function() { |
15 var canvas = document.getElementById('example'); | 20 var canvas = document.getElementById('example'); |
(...skipping 20 matching lines...) Expand all Loading... |
36 } | 41 } |
37 | 42 |
38 window.confirm = function() { | 43 window.confirm = function() { |
39 robustnessTestHarness.initialize(); | 44 robustnessTestHarness.initialize(); |
40 robustnessTestHarness.runTestLoop(); | 45 robustnessTestHarness.runTestLoop(); |
41 return false; | 46 return false; |
42 } | 47 } |
43 window.webglRobustnessTestHarness = robustnessTestHarness; | 48 window.webglRobustnessTestHarness = robustnessTestHarness; |
44 """ | 49 """ |
45 | 50 |
| 51 class WebglRobustnessPage(page.Page): |
| 52 def __init__(self, page_set, base_dir): |
| 53 super(WebglRobustnessPage, self).__init__( |
| 54 url='file://extra/lots-of-polys-example.html', |
| 55 page_set=page_set, |
| 56 base_dir=base_dir) |
| 57 self.script_to_evaluate_on_commit = robustness_harness_script |
| 58 |
| 59 def RunNavigateSteps(self, action_runner): |
| 60 action_runner.RunAction(NavigateAction()) |
| 61 action_runner.RunAction( |
| 62 WaitAction({'javascript': 'webglTestHarness._finished'})) |
46 | 63 |
47 class WebglRobustness(test.Test): | 64 class WebglRobustness(test.Test): |
48 test = WebglConformanceValidator | 65 test = WebglConformanceValidator |
49 | 66 |
50 def CreatePageSet(self, options): | 67 def CreatePageSet(self, options): |
51 page_set_dict = { | 68 ps = page_set.PageSet( |
52 'description': 'Test cases for WebGL robustness', | 69 file_path=conformance_path, |
53 'user_agent_type': 'desktop', | 70 description='Test cases for WebGL robustness', |
54 'serving_dirs': [''], | 71 user_agent_type='desktop', |
55 'pages': [ | 72 serving_dirs=['']) |
56 { | 73 ps.AddPage(WebglRobustnessPage(ps, ps.base_dir)) |
57 'url': 'file://extra/lots-of-polys-example.html', | 74 return ps |
58 'script_to_evaluate_on_commit': robustness_harness_script, | |
59 'navigate_steps': [ | |
60 { 'action': 'navigate' }, | |
61 { 'action': 'wait', 'javascript': 'webglTestHarness._finished' } | |
62 ] | |
63 } | |
64 ] | |
65 } | |
66 return page_set.PageSet.FromDict(page_set_dict, conformance_path) | |
OLD | NEW |