Chromium Code Reviews| 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 optparse | |
| 5 import os | |
| 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 harness_script = r""" | |
| 16 var domAutomationController = {}; | |
| 17 | |
| 18 domAutomationController._succeeded = false; | |
| 19 | |
| 20 domAutomationController.setAutomationId = function(id) {} | |
| 21 | |
| 22 domAutomationController.send = function(msg) { | |
| 23 msg = msg.toLowerCase() | |
| 24 if (msg == "success") | |
| 25 domAutomationController._succeeded = true; | |
| 26 else | |
| 27 domAutomationController._succeeded = false; | |
| 28 } | |
| 29 | |
| 30 window.domAutomationController = domAutomationController; | |
| 31 """ | |
|
Ken Russell (switch to Gerrit)
2013/10/31 21:22:00
A CL was landed yesterday which changes how the ha
| |
| 32 | |
| 33 class _WebGLDebugRendererInfoValidator(page_test.PageTest): | |
| 34 def __init__(self): | |
| 35 super(_WebGLDebugRendererInfoValidator, self).__init__('ValidatePage') | |
| 36 | |
| 37 def CustomizeBrowserOptions(self, options): | |
| 38 chrome_finch_option = options.finch_option | |
| 39 if options.finch_option == "bypassed": | |
| 40 chrome_finch_option = "enabled" | |
| 41 options.AppendExtraBrowserArgs('--disable-webgl-debug-renderer-info') | |
| 42 options.AppendExtraBrowserArgs( | |
| 43 '--force-fieldtrials=WebGLDebugRendererInfo/%s/' % | |
| 44 chrome_finch_option) | |
| 45 options.AppendExtraBrowserArgs('--google-base-url=http://127.0.0.1') | |
| 46 | |
| 47 def ValidatePage(self, page, tab, results): | |
| 48 if not tab.EvaluateJavaScript('window.domAutomationController._succeeded'): | |
| 49 raise page_test.Failure('Test failed') | |
| 50 | |
| 51 class WebGLDebugRendererInfo(test_module.Test): | |
| 52 test = _WebGLDebugRendererInfoValidator | |
| 53 | |
| 54 @staticmethod | |
| 55 def AddTestCommandLineOptions(parser): | |
| 56 group = optparse.OptionGroup(parser, 'Finch experiment options') | |
| 57 group.add_option('--finch-option', | |
| 58 help='Options: enabled, disabled, bypassed', | |
|
Ken Russell (switch to Gerrit)
2013/10/31 21:22:00
Please add documentation for what these mean.
en
| |
| 59 default='enabled') | |
| 60 parser.add_option_group(group) | |
| 61 | |
| 62 def CreatePageSet(self, options): | |
| 63 page_set_dict = { | |
| 64 'description': 'Test cases for WEBGL_debug_renderer_info extension', | |
| 65 'user_agent_type': 'desktop', | |
| 66 'serving_dirs': [''], | |
| 67 'pages': [ | |
| 68 { | |
| 69 'name': 'WEBGL_debug_render_info.%s' % | |
| 70 options.finch_option, | |
| 71 'url': 'file://webgl_debug_renderer_info.html?query=%s' % | |
| 72 options.finch_option, | |
| 73 'script_to_evaluate_on_commit': harness_script, | |
| 74 'navigate_steps': [ | |
| 75 { 'action': 'navigate' } | |
| 76 ] | |
| 77 } | |
| 78 ] | |
| 79 } | |
| 80 return page_set.PageSet.FromDict(page_set_dict, data_path) | |
| OLD | NEW |