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

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

Issue 263523002: Added test to ensure context restoration due to GC doesn't crash (Take 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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 | Annotate | Revision Log
« no previous file with comments | « content/test/data/gpu/webgl.html ('k') | no next file » | 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 exceptions 7 from telemetry.core import exceptions
8 from telemetry.core import util 8 from telemetry.core import util
9 from telemetry.page import page 9 from telemetry.page import page
10 from telemetry.page import page_set 10 from telemetry.page import page_set
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 new_tab.Close() 95 new_tab.Close()
96 except (exceptions.TabCrashException, Exception): 96 except (exceptions.TabCrashException, Exception):
97 print 'Tab crashed while closing chrome://gpucrash' 97 print 'Tab crashed while closing chrome://gpucrash'
98 if not completed: 98 if not completed:
99 raise page_test.Failure( 99 raise page_test.Failure(
100 'Test didn\'t complete (no context lost event?)') 100 'Test didn\'t complete (no context lost event?)')
101 if not tab.EvaluateJavaScript( 101 if not tab.EvaluateJavaScript(
102 'window.domAutomationController._succeeded'): 102 'window.domAutomationController._succeeded'):
103 raise page_test.Failure( 103 raise page_test.Failure(
104 'Test failed (context not restored properly?)') 104 'Test failed (context not restored properly?)')
105 elif page.force_garbage_collection:
106 # Try to corce GC to clean up any contexts not attached to the page.
107 # This method seem unreliable, so the page will also attempt to force
108 # GC through excessive allocations.
109 tab.CollectGarbage()
110 completed = False
111 try:
112 print "Waiting for page to finish."
113 util.WaitFor(lambda: tab.EvaluateJavaScript(
114 'window.domAutomationController._finished'), wait_timeout)
115 completed = True
116 except util.TimeoutException:
117 pass
118
119 if not completed:
120 raise page_test.Failure(
121 'Test didn\'t complete (no context restored event?)')
122 if not tab.EvaluateJavaScript(
123 'window.domAutomationController._succeeded'):
124 raise page_test.Failure(
125 'Test failed (context not restored properly?)')
105 126
106 class WebGLContextLostFromGPUProcessExitPage(page.Page): 127 class WebGLContextLostFromGPUProcessExitPage(page.Page):
107 def __init__(self, page_set, base_dir): 128 def __init__(self, page_set, base_dir):
108 super(WebGLContextLostFromGPUProcessExitPage, self).__init__( 129 super(WebGLContextLostFromGPUProcessExitPage, self).__init__(
109 url='file://webgl.html?query=kill_after_notification', 130 url='file://webgl.html?query=kill_after_notification',
110 page_set=page_set, 131 page_set=page_set,
111 base_dir=base_dir) 132 base_dir=base_dir)
112 self.name = 'ContextLost.WebGLContextLostFromGPUProcessExit' 133 self.name = 'ContextLost.WebGLContextLostFromGPUProcessExit'
113 self.script_to_evaluate_on_commit = harness_script 134 self.script_to_evaluate_on_commit = harness_script
114 self.kill_gpu_process = True 135 self.kill_gpu_process = True
115 self.number_of_gpu_process_kills = 1 136 self.number_of_gpu_process_kills = 1
137 self.force_garbage_collection = False
116 138
117 def RunNavigateSteps(self, action_runner): 139 def RunNavigateSteps(self, action_runner):
118 action_runner.RunAction(NavigateAction()) 140 action_runner.RunAction(NavigateAction())
119 action_runner.RunAction(WaitAction( 141 action_runner.RunAction(WaitAction(
120 {'javascript': 'window.domAutomationController._loaded'})) 142 {'javascript': 'window.domAutomationController._loaded'}))
121 143
122 144
123 class WebGLContextLostFromLoseContextExtensionPage(page.Page): 145 class WebGLContextLostFromLoseContextExtensionPage(page.Page):
124 def __init__(self, page_set, base_dir): 146 def __init__(self, page_set, base_dir):
125 super(WebGLContextLostFromLoseContextExtensionPage, self).__init__( 147 super(WebGLContextLostFromLoseContextExtensionPage, self).__init__(
126 url='file://webgl.html?query=WEBGL_lose_context', 148 url='file://webgl.html?query=WEBGL_lose_context',
127 page_set=page_set, 149 page_set=page_set,
128 base_dir=base_dir) 150 base_dir=base_dir)
129 self.name = 'ContextLost.WebGLContextLostFromLoseContextExtension', 151 self.name = 'ContextLost.WebGLContextLostFromLoseContextExtension',
130 self.script_to_evaluate_on_commit = harness_script 152 self.script_to_evaluate_on_commit = harness_script
131 self.kill_gpu_process = False 153 self.kill_gpu_process = False
154 self.force_garbage_collection = False
132 155
133 def RunNavigateSteps(self, action_runner): 156 def RunNavigateSteps(self, action_runner):
134 action_runner.RunAction(NavigateAction()) 157 action_runner.RunAction(NavigateAction())
135 action_runner.RunAction(WaitAction( 158 action_runner.RunAction(WaitAction(
136 {'javascript': 'window.domAutomationController._finished'})) 159 {'javascript': 'window.domAutomationController._finished'}))
137 160
161 class WebGLContextLostFromQuantityPage(page.Page):
162 def __init__(self, page_set, base_dir):
163 super(WebGLContextLostFromQuantityPage, self).__init__(
164 url='file://webgl.html?query=forced_quantity_loss',
165 page_set=page_set,
166 base_dir=base_dir)
167 self.name = 'ContextLost.WebGLContextLostFromQuantity',
168 self.script_to_evaluate_on_commit = harness_script
169 self.kill_gpu_process = False
170 self.force_garbage_collection = True
171
172 def RunNavigateSteps(self, action_runner):
173 action_runner.RunAction(NavigateAction())
174 action_runner.RunAction(WaitAction(
175 {'javascript': 'window.domAutomationController._loaded'}))
138 176
139 class ContextLost(test_module.Test): 177 class ContextLost(test_module.Test):
140 enabled = True 178 enabled = True
141 test = _ContextLostValidator 179 test = _ContextLostValidator
142 # For the record, this would have been another way to get the pages 180 # For the record, this would have been another way to get the pages
143 # to repeat. pageset_repeat would be another option. 181 # to repeat. pageset_repeat would be another option.
144 # options = {'page_repeat': 5} 182 # options = {'page_repeat': 5}
145 def CreatePageSet(self, options): 183 def CreatePageSet(self, options):
146 ps = page_set.PageSet( 184 ps = page_set.PageSet(
147 file_path=data_path, 185 file_path=data_path,
148 description='Test cases for real and synthetic context lost events', 186 description='Test cases for real and synthetic context lost events',
149 user_agent_type='desktop', 187 user_agent_type='desktop',
150 serving_dirs=set([''])) 188 serving_dirs=set(['']))
151 ps.AddPage(WebGLContextLostFromGPUProcessExitPage(ps, ps.base_dir)) 189 ps.AddPage(WebGLContextLostFromGPUProcessExitPage(ps, ps.base_dir))
152 ps.AddPage(WebGLContextLostFromLoseContextExtensionPage(ps, ps.base_dir)) 190 ps.AddPage(WebGLContextLostFromLoseContextExtensionPage(ps, ps.base_dir))
191 ps.AddPage(WebGLContextLostFromQuantityPage(ps, ps.base_dir))
153 return ps 192 return ps
193
194
OLDNEW
« no previous file with comments | « content/test/data/gpu/webgl.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698