OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2013 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 import os | |
5 import optparse | |
6 | |
7 from telemetry import test as test_module | |
8 from telemetry.core import util | |
9 from telemetry.page import page_set | |
10 from telemetry.page import page_test | |
11 | |
12 data_path = os.path.join( | |
13 util.GetChromiumSrcDir(), 'content', 'test', 'data', 'gpu') | |
14 | |
15 wait_timeout = 20 # seconds | |
bajones
2013/10/31 00:04:49
wait_timeout not used. Please remove it.
Zhenyao Mo
2013/10/31 00:26:13
Done.
| |
16 | |
17 harness_script = r""" | |
18 var domAutomationController = {}; | |
19 | |
20 domAutomationController._succeeded = false; | |
21 | |
22 domAutomationController.setAutomationId = function(id) {} | |
23 | |
24 domAutomationController.send = function(msg) { | |
25 msg = msg.toLowerCase() | |
26 if (msg == "success") | |
27 domAutomationController._succeeded = true; | |
28 else | |
29 domAutomationController._succeeded = false; | |
30 } | |
31 | |
32 window.domAutomationController = domAutomationController; | |
33 console.log("Harness injected."); | |
bajones
2013/10/31 00:04:49
Please remove this console.log.
Zhenyao Mo
2013/10/31 00:26:13
Done.
| |
34 """ | |
35 | |
36 class _WebGLDebugRendererInfoValidator(page_test.PageTest): | |
37 def __init__(self): | |
38 super(_WebGLDebugRendererInfoValidator, self).__init__('ValidatePage') | |
39 | |
40 def CustomizeBrowserOptions(self, options): | |
41 chrome_finch_option = options.finch_option | |
42 if options.finch_option == "bypassed": | |
43 chrome_finch_option = "enabled" | |
44 options.AppendExtraBrowserArgs( | |
45 '--force-fieldtrials=WebGLDebugRendererInfo/%s/' % | |
46 chrome_finch_option) | |
47 options.AppendExtraBrowserArgs('--google-base-url=http://127.0.0.1') | |
48 if options.finch_option == "bypassed": | |
49 options.AppendExtraBrowserArgs('--disable-webgl-debug-renderer-info') | |
bajones
2013/10/31 00:04:49
Nit: Since the order of the browser args doesn't m
Zhenyao Mo
2013/10/31 00:26:13
Done.
| |
50 | |
51 def ValidatePage(self, page, tab, results): | |
52 if not tab.EvaluateJavaScript('window.domAutomationController._succeeded'): | |
53 raise page_test.Failure('Test failed') | |
54 | |
55 class WebGLDebugRendererInfo(test_module.Test): | |
56 enabled = True | |
bajones
2013/10/31 00:04:49
Nit: This enabled=True is not necessary. Remove it
Zhenyao Mo
2013/10/31 00:26:13
Done.
| |
57 test = _WebGLDebugRendererInfoValidator | |
58 | |
59 @staticmethod | |
60 def AddTestCommandLineOptions(parser): | |
61 group = optparse.OptionGroup(parser, 'WebGL conformance options') | |
bajones
2013/10/31 00:04:49
Give the options group a better name. "Finch exper
Zhenyao Mo
2013/10/31 00:26:13
Done.
| |
62 group.add_option('--finch-option', | |
63 help='Enable or disable WebGLDebugRendererInfo finch experiment', | |
bajones
2013/10/31 00:04:49
Would it be more helpful to have this read "Enable
Zhenyao Mo
2013/10/31 00:26:13
Done.
| |
64 default='enabled') | |
65 parser.add_option_group(group) | |
66 | |
67 def CreatePageSet(self, options): | |
68 page_set_dict = { | |
69 'description': 'Test cases for WEBGL_debug_renderer_info extension', | |
70 'user_agent_type': 'desktop', | |
71 'serving_dirs': [''], | |
72 'pages': [ | |
73 { | |
74 'name': 'WEBGL_debug_render_info.%s' % | |
75 options.finch_option, | |
76 'url': 'file://webgl_debug_renderer_info.html?query=%s' % | |
77 options.finch_option, | |
78 'script_to_evaluate_on_commit': harness_script, | |
79 'navigate_steps': [ | |
80 { 'action': 'navigate' } | |
81 ] | |
82 } | |
83 ] | |
84 } | |
85 return page_set.PageSet.FromDict(page_set_dict, data_path) | |
OLD | NEW |