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

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

Issue 2299083002: Switch context_lost test to gpu_integration_test harness. (Closed)
Patch Set: Rebased. Created 4 years, 3 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
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 4
5 import os 5 import os
6 import time 6 import time
7 7
8 from gpu_tests import gpu_integration_test 8 from gpu_tests import gpu_integration_test
9 from gpu_tests import context_lost_expectations 9 from gpu_tests import context_lost_expectations
10 from gpu_tests import path_util 10 from gpu_tests import path_util
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 options = cls._finder_options.browser_options 63 options = cls._finder_options.browser_options
64 options.AppendExtraBrowserArgs( 64 options.AppendExtraBrowserArgs(
65 '--disable-domain-blocking-for-3d-apis') 65 '--disable-domain-blocking-for-3d-apis')
66 options.AppendExtraBrowserArgs( 66 options.AppendExtraBrowserArgs(
67 '--disable-gpu-process-crash-limit') 67 '--disable-gpu-process-crash-limit')
68 # Required for about:gpucrash handling from Telemetry. 68 # Required for about:gpucrash handling from Telemetry.
69 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') 69 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking')
70 70
71 @classmethod 71 @classmethod
72 def GenerateGpuTests(cls, options): 72 def GenerateGpuTests(cls, options):
73 tests = (('GPUProcessCrashesExactlyOncePerVisitToAboutGpuCrash', 73 tests = (('GpuCrash_GPUProcessCrashesExactlyOncePerVisitToAboutGpuCrash',
74 'gpu_process_crash.html'), 74 'gpu_process_crash.html'),
75 ('WebGLContextLostFromGPUProcessExit', 75 ('ContextLost_WebGLContextLostFromGPUProcessExit',
76 'webgl.html?query=kill_after_notification'), 76 'webgl.html?query=kill_after_notification'),
77 ('WebGLContextLostFromLoseContextExtension', 77 ('ContextLost_WebGLContextLostFromLoseContextExtension',
78 'webgl.html?query=WEBGL_lose_context'), 78 'webgl.html?query=WEBGL_lose_context'),
79 ('WebGLContextLostFromQuantity', 79 ('ContextLost_WebGLContextLostFromQuantity',
80 'webgl.html?query=forced_quantity_loss'), 80 'webgl.html?query=forced_quantity_loss'),
81 ('WebGLContextLostFromSelectElement', 81 ('ContextLost_WebGLContextLostFromSelectElement',
82 'webgl_with_select_element.html'), 82 'webgl_with_select_element.html'),
83 ('WebGLContextLostInHiddenTab', 83 ('ContextLost_WebGLContextLostInHiddenTab',
84 'webgl.html?query=kill_after_notification')) 84 'webgl.html?query=kill_after_notification'))
85 for t in tests: 85 for t in tests:
86 yield (t[0], t[1], ('_' + t[0])) 86 yield (t[0], t[1], ('_' + t[0]))
87 87
88 def RunActualGpuTest(self, test_path, *args): 88 def RunActualGpuTest(self, test_path, *args):
89 test_name = args[0] 89 test_name = args[0]
90 tab = self.tab 90 tab = self.tab
91 if not tab.browser.supports_tab_control: 91 if not tab.browser.supports_tab_control:
92 self.fail('Browser must support tab control') 92 self.fail('Browser must support tab control')
93 getattr(self, test_name)(test_path) 93 getattr(self, test_name)(test_path)
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 completed = self._WaitForPageToFinish(tab) 205 completed = self._WaitForPageToFinish(tab)
206 if not completed: 206 if not completed:
207 self.fail('Test didn\'t complete (no context restored event?)') 207 self.fail('Test didn\'t complete (no context restored event?)')
208 if not tab.EvaluateJavaScript('window.domAutomationController._succeeded'): 208 if not tab.EvaluateJavaScript('window.domAutomationController._succeeded'):
209 self.fail('Test failed (context not restored properly?)') 209 self.fail('Test failed (context not restored properly?)')
210 210
211 # The browser test runner synthesizes methods with the exact name 211 # The browser test runner synthesizes methods with the exact name
212 # given in GenerateGpuTests, so in order to hand-write our tests but 212 # given in GenerateGpuTests, so in order to hand-write our tests but
213 # also go through the _RunGpuTest trampoline, the test needs to be 213 # also go through the _RunGpuTest trampoline, the test needs to be
214 # slightly differently named. 214 # slightly differently named.
215 def _GPUProcessCrashesExactlyOncePerVisitToAboutGpuCrash(self, test_path): 215 def _GpuCrash_GPUProcessCrashesExactlyOncePerVisitToAboutGpuCrash(
216 self, test_path):
216 self._NavigateAndWaitForLoad(test_path) 217 self._NavigateAndWaitForLoad(test_path)
217 self._KillGPUProcess(2, True) 218 self._KillGPUProcess(2, True)
218 self._RestartBrowser('must restart after tests that kill the GPU process') 219 self._RestartBrowser('must restart after tests that kill the GPU process')
219 220
220 def _WebGLContextLostFromGPUProcessExit(self, test_path): 221 def _ContextLost_WebGLContextLostFromGPUProcessExit(self, test_path):
221 self._NavigateAndWaitForLoad(test_path) 222 self._NavigateAndWaitForLoad(test_path)
222 self._KillGPUProcess(1, False) 223 self._KillGPUProcess(1, False)
223 self._RestartBrowser('must restart after tests that kill the GPU process') 224 self._RestartBrowser('must restart after tests that kill the GPU process')
224 225
225 def _WebGLContextLostFromLoseContextExtension(self, test_path): 226 def _ContextLost_WebGLContextLostFromLoseContextExtension(self, test_path):
226 url = self.UrlOfStaticFilePath(test_path) 227 url = self.UrlOfStaticFilePath(test_path)
227 tab = self.tab 228 tab = self.tab
228 tab.Navigate(url, script_to_evaluate_on_commit=harness_script) 229 tab.Navigate(url, script_to_evaluate_on_commit=harness_script)
229 tab.action_runner.WaitForJavaScriptCondition( 230 tab.action_runner.WaitForJavaScriptCondition(
230 'window.domAutomationController._finished') 231 'window.domAutomationController._finished')
231 232
232 def _WebGLContextLostFromQuantity(self, test_path): 233 def _ContextLost_WebGLContextLostFromQuantity(self, test_path):
233 self._NavigateAndWaitForLoad(test_path) 234 self._NavigateAndWaitForLoad(test_path)
234 # Try to coerce GC to clean up any contexts not attached to the page. 235 # Try to coerce GC to clean up any contexts not attached to the page.
235 # This method seems unreliable, so the page will also attempt to 236 # This method seems unreliable, so the page will also attempt to
236 # force GC through excessive allocations. 237 # force GC through excessive allocations.
237 self.tab.CollectGarbage() 238 self.tab.CollectGarbage()
238 self._WaitForTabAndCheckCompletion() 239 self._WaitForTabAndCheckCompletion()
239 240
240 def _WebGLContextLostFromSelectElement(self, test_path): 241 def _ContextLost_WebGLContextLostFromSelectElement(self, test_path):
241 self._NavigateAndWaitForLoad(test_path) 242 self._NavigateAndWaitForLoad(test_path)
242 self._WaitForTabAndCheckCompletion() 243 self._WaitForTabAndCheckCompletion()
243 244
244 def _WebGLContextLostInHiddenTab(self, test_path): 245 def _ContextLost_WebGLContextLostInHiddenTab(self, test_path):
245 self._NavigateAndWaitForLoad(test_path) 246 self._NavigateAndWaitForLoad(test_path)
246 # Test losing a context in a hidden tab. This test passes if the tab 247 # Test losing a context in a hidden tab. This test passes if the tab
247 # doesn't crash. 248 # doesn't crash.
248 tab = self.tab 249 tab = self.tab
249 dummy_tab = tab.browser.tabs.New() 250 dummy_tab = tab.browser.tabs.New()
250 tab.EvaluateJavaScript('loseContextUsingExtension()') 251 tab.EvaluateJavaScript('loseContextUsingExtension()')
251 tab.Activate() 252 tab.Activate()
252 self._WaitForTabAndCheckCompletion() 253 self._WaitForTabAndCheckCompletion()
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/context_lost_expectations.py ('k') | testing/buildbot/chromium.gpu.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698