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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/test/data/gpu/webgl.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/gpu/gpu_tests/context_lost.py
diff --git a/content/test/gpu/gpu_tests/context_lost.py b/content/test/gpu/gpu_tests/context_lost.py
index 0acab358ee00628994ed35df12ba30b461d58e25..633df6022bc1c19eb7ba24a77f5a1f9e2f211968 100644
--- a/content/test/gpu/gpu_tests/context_lost.py
+++ b/content/test/gpu/gpu_tests/context_lost.py
@@ -102,6 +102,27 @@ class _ContextLostValidator(page_test.PageTest):
'window.domAutomationController._succeeded'):
raise page_test.Failure(
'Test failed (context not restored properly?)')
+ elif page.force_garbage_collection:
+ # Try to corce GC to clean up any contexts not attached to the page.
+ # This method seem unreliable, so the page will also attempt to force
+ # GC through excessive allocations.
+ tab.CollectGarbage()
+ completed = False
+ try:
+ print "Waiting for page to finish."
+ util.WaitFor(lambda: tab.EvaluateJavaScript(
+ 'window.domAutomationController._finished'), wait_timeout)
+ completed = True
+ except util.TimeoutException:
+ pass
+
+ if not completed:
+ raise page_test.Failure(
+ 'Test didn\'t complete (no context restored event?)')
+ if not tab.EvaluateJavaScript(
+ 'window.domAutomationController._succeeded'):
+ raise page_test.Failure(
+ 'Test failed (context not restored properly?)')
class WebGLContextLostFromGPUProcessExitPage(page.Page):
def __init__(self, page_set, base_dir):
@@ -113,6 +134,7 @@ class WebGLContextLostFromGPUProcessExitPage(page.Page):
self.script_to_evaluate_on_commit = harness_script
self.kill_gpu_process = True
self.number_of_gpu_process_kills = 1
+ self.force_garbage_collection = False
def RunNavigateSteps(self, action_runner):
action_runner.RunAction(NavigateAction())
@@ -129,12 +151,28 @@ class WebGLContextLostFromLoseContextExtensionPage(page.Page):
self.name = 'ContextLost.WebGLContextLostFromLoseContextExtension',
self.script_to_evaluate_on_commit = harness_script
self.kill_gpu_process = False
+ self.force_garbage_collection = False
def RunNavigateSteps(self, action_runner):
action_runner.RunAction(NavigateAction())
action_runner.RunAction(WaitAction(
{'javascript': 'window.domAutomationController._finished'}))
+class WebGLContextLostFromQuantityPage(page.Page):
+ def __init__(self, page_set, base_dir):
+ super(WebGLContextLostFromQuantityPage, self).__init__(
+ url='file://webgl.html?query=forced_quantity_loss',
+ page_set=page_set,
+ base_dir=base_dir)
+ self.name = 'ContextLost.WebGLContextLostFromQuantity',
+ self.script_to_evaluate_on_commit = harness_script
+ self.kill_gpu_process = False
+ self.force_garbage_collection = True
+
+ def RunNavigateSteps(self, action_runner):
+ action_runner.RunAction(NavigateAction())
+ action_runner.RunAction(WaitAction(
+ {'javascript': 'window.domAutomationController._loaded'}))
class ContextLost(test_module.Test):
enabled = True
@@ -150,4 +188,7 @@ class ContextLost(test_module.Test):
serving_dirs=set(['']))
ps.AddPage(WebGLContextLostFromGPUProcessExitPage(ps, ps.base_dir))
ps.AddPage(WebGLContextLostFromLoseContextExtensionPage(ps, ps.base_dir))
+ ps.AddPage(WebGLContextLostFromQuantityPage(ps, ps.base_dir))
return ps
+
+
« 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