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

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

Issue 27603004: Ported GpuCrashTest to Telemetry, renaming the test to ContextLost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed jam's review feedback. Created 7 years, 2 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/public/common/content_switches.cc ('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
(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 os
5
6 from telemetry import test as test_module
7 from telemetry.core import util
8 from telemetry.page import page_set
9 from telemetry.page import page_test
10
11 data_path = os.path.join(
12 util.GetChromiumSrcDir(), 'content', 'test', 'data', 'gpu')
13
14 wait_timeout = 20 # seconds
15
16 harness_script = r"""
17 var domAutomationController = {};
18
19 domAutomationController._loaded = false;
20 domAutomationController._succeeded = false;
21 domAutomationController._finished = false;
22
23 domAutomationController.setAutomationId = function(id) {}
24
25 domAutomationController.send = function(msg) {
26 msg = msg.toLowerCase()
27 if (msg == "loaded") {
28 domAutomationController._loaded = true;
29 } else if (msg == "success") {
30 domAutomationController._succeeded = true;
31 domAutomationController._finished = true;
32 } else {
33 domAutomationController._succeeded = false;
34 domAutomationController._finished = true;
35 }
36 }
37
38 window.domAutomationController = domAutomationController;
39 console.log("Harness injected.");
40 """
41
42 class ContextLostValidator(page_test.PageTest):
dtu 2013/10/17 21:07:19 nit: _ContextLostValidator
Ken Russell (switch to Gerrit) 2013/10/17 21:24:53 Done.
43 def __init__(self):
44 # Strictly speaking this test doesn't yet need a browser restart
45 # after each run, but if more tests are added which crash the GPU
46 # process, then it will.
47 super(ContextLostValidator, self).__init__(
48 'ValidatePage', needs_browser_restart_after_each_run=True)
49
50 def CustomizeBrowserOptions(self, options):
51 options.AppendExtraBrowserArgs(
52 '--disable-domain-blocking-for-3d-apis')
53 # Required for about:gpucrash handling from Telemetry.
54 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking')
55
56 def ValidatePage(self, page, tab, results):
57 if page.kill_gpu_process:
58 if not tab.browser.supports_tab_control:
59 raise page_test.Failure('Browser must support tab control')
60 # Crash the GPU process.
61 new_tab = tab.browser.tabs.New()
62 # To access these debug URLs from Telemetry, they have to be
63 # written using the chrome:// scheme.
64 new_tab.Navigate('chrome://gpucrash')
65 # Activate the original tab and wait for completion.
66 tab.Activate()
67 res = util.WaitFor(lambda: tab.EvaluateJavaScript(
68 'window.domAutomationController._finished'), wait_timeout)
69 new_tab.Close()
70 if not res:
71 raise page_test.Failure('Test didn\'t complete')
dtu 2013/10/17 21:07:19 WaitFor throws a TimeoutException on timeout, you
Ken Russell (switch to Gerrit) 2013/10/17 21:24:53 Done.
72 if not tab.EvaluateJavaScript('window.domAutomationController._succeeded'):
73 raise page_test.Failure('Test failed')
dtu 2013/10/17 21:07:19 More descriptive failure message?
Ken Russell (switch to Gerrit) 2013/10/17 21:24:53 Attempted.
74
75
76 class ContextLost(test_module.Test):
77 enabled = True
dtu 2013/10/17 21:07:19 Are the GPU bot scripts using this? If not, I'm go
Ken Russell (switch to Gerrit) 2013/10/17 21:24:53 I believe the Android GPU bot is using it to avoid
Sami 2013/10/18 13:05:38 To be clear, that flag was only added there to avo
78 test = ContextLostValidator
79
80 def CreatePageSet(self, options):
81 page_set_dict = {
82 'description': 'Test cases for real and synthetic context lost events',
83 'user_agent_type': 'desktop',
84 'serving_dirs': [''],
85 'pages': [
86 {
87 'name': 'ContextLost.WebGLContextLostFromGPUProcessExit',
88 'url': 'file://webgl.html?query=kill_after_notification',
89 'script_to_evaluate_on_commit': harness_script,
90 'navigate_steps': [
91 { 'action': 'navigate' },
92 { 'action': 'wait',
93 'javascript': 'window.domAutomationController._loaded' }
94 ],
95 'kill_gpu_process': True
96 },
97 {
98 'name': 'ContextLost.WebGLContextLostFromLoseContextExtension',
99 'url': 'file://webgl.html?query=WEBGL_lose_context',
100 'script_to_evaluate_on_commit': harness_script,
101 'navigate_steps': [
102 { 'action': 'navigate' },
103 { 'action': 'wait',
104 'javascript': 'window.domAutomationController._finished' }
105 ],
106 'kill_gpu_process': False
107 },
108 ]
109 }
110 return page_set.PageSet.FromDict(page_set_dict, data_path)
OLDNEW
« no previous file with comments | « content/public/common/content_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698