Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: content/test/gpu/gpu_tests/context_lost.py

Issue 259763003: Get rid of PageSet.FromDict from some simple benchmarks in gpu_tests/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set default value of page set's filepath to be location of pageset class Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/maps.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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 os 4 import os
5 5
6 from telemetry import test as test_module 6 from telemetry import test as test_module
7 from telemetry.core import util 7 from telemetry.core import util
8 from telemetry.page import page
8 from telemetry.page import page_set 9 from telemetry.page import page_set
10 # pylint: disable=W0401,W0614
9 from telemetry.page import page_test 11 from telemetry.page import page_test
12 from telemetry.page.actions.all_page_actions import *
10 13
11 data_path = os.path.join( 14 data_path = os.path.join(
12 util.GetChromiumSrcDir(), 'content', 'test', 'data', 'gpu') 15 util.GetChromiumSrcDir(), 'content', 'test', 'data', 'gpu')
13 16
14 wait_timeout = 20 # seconds 17 wait_timeout = 20 # seconds
15 18
16 harness_script = r""" 19 harness_script = r"""
17 var domAutomationController = {}; 20 var domAutomationController = {};
18 21
19 domAutomationController._loaded = false; 22 domAutomationController._loaded = false;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 pass 87 pass
85 new_tab.Close() 88 new_tab.Close()
86 if not completed: 89 if not completed:
87 raise page_test.Failure( 90 raise page_test.Failure(
88 'Test didn\'t complete (no context lost event?)') 91 'Test didn\'t complete (no context lost event?)')
89 if not tab.EvaluateJavaScript( 92 if not tab.EvaluateJavaScript(
90 'window.domAutomationController._succeeded'): 93 'window.domAutomationController._succeeded'):
91 raise page_test.Failure( 94 raise page_test.Failure(
92 'Test failed (context not restored properly?)') 95 'Test failed (context not restored properly?)')
93 96
97 class WebGLContextLostFromGPUProcessExitPage(page.Page):
Ken Russell (switch to Gerrit) 2014/04/28 20:56:21 This will collide with https://codereview.chromium
98 def __init__(self, page_set, base_dir):
99 super(WebGLContextLostFromGPUProcessExitPage, self).__init__(
100 url='file://webgl.html?query=kill_after_notification',
101 page_set=page_set,
102 base_dir=base_dir)
103 self.name = 'ContextLost.WebGLContextLostFromGPUProcessExit'
104 self.script_to_evaluate_on_commit = harness_script
105 self.kill_gpu_process = True
106 self.number_of_gpu_process_kills = 1
107
108 def RunNavigateSteps(self, action_runner):
109 action_runner.RunAction(NavigateAction())
110 action_runner.RunAction(WaitAction(
111 {'javascript': 'window.domAutomationController._loaded'}))
112
113
114 class WebGLContextLostFromLoseContextExtensionPage(page.Page):
115 def __init__(self, page_set, base_dir):
116 super(WebGLContextLostFromLoseContextExtensionPage, self).__init__(
117 url='file://webgl.html?query=WEBGL_lose_context',
118 page_set=page_set,
119 base_dir=base_dir)
120 self.name = 'ContextLost.WebGLContextLostFromLoseContextExtension',
121 self.script_to_evaluate_on_commit = harness_script
122 self.kill_gpu_process = False
123
124 def RunNavigateSteps(self, action_runner):
125 action_runner.RunAction(NavigateAction())
126 action_runner.RunAction(WaitAction(
127 {'javascript': 'window.domAutomationController._finished'}))
128
129
94 class ContextLost(test_module.Test): 130 class ContextLost(test_module.Test):
95 enabled = True 131 enabled = True
96 test = _ContextLostValidator 132 test = _ContextLostValidator
97 # For the record, this would have been another way to get the pages 133 # For the record, this would have been another way to get the pages
98 # to repeat. pageset_repeat would be another option. 134 # to repeat. pageset_repeat would be another option.
99 # options = {'page_repeat': 5} 135 # options = {'page_repeat': 5}
100 def CreatePageSet(self, options): 136 def CreatePageSet(self, options):
101 page_set_dict = { 137 ps = page_set.PageSet(
102 'description': 'Test cases for real and synthetic context lost events', 138 file_path=data_path,
103 'user_agent_type': 'desktop', 139 description='Test cases for real and synthetic context lost events',
104 'serving_dirs': [''], 140 user_agent_type='desktop',
105 'pages': [ 141 serving_dirs=set(['']))
106 { 142 ps.AddPage(WebGLContextLostFromGPUProcessExitPage(ps, ps.base_dir))
107 'name': 'ContextLost.WebGLContextLostFromGPUProcessExit', 143 ps.AddPage(WebGLContextLostFromLoseContextExtensionPage(ps, ps.base_dir))
108 'url': 'file://webgl.html?query=kill_after_notification', 144 return ps
109 'script_to_evaluate_on_commit': harness_script,
110 'navigate_steps': [
111 { 'action': 'navigate' },
112 { 'action': 'wait',
113 'javascript': 'window.domAutomationController._loaded' }
114 ],
115 'kill_gpu_process': True,
116 'number_of_gpu_process_kills': 1,
117 },
118 {
119 'name': 'ContextLost.WebGLContextLostFromLoseContextExtension',
120 'url': 'file://webgl.html?query=WEBGL_lose_context',
121 'script_to_evaluate_on_commit': harness_script,
122 'navigate_steps': [
123 { 'action': 'navigate' },
124 { 'action': 'wait',
125 'javascript': 'window.domAutomationController._finished' }
126 ],
127 'kill_gpu_process': False
128 },
129 ]
130 }
131 return page_set.PageSet.FromDict(page_set_dict, data_path)
OLDNEW
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/maps.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698