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

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

Issue 21150015: gpu: Add WebGL robustness telemetry test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added requestAnimationFrame loop. Created 7 years, 4 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 | « no previous file | 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 from telemetry import test
5 from telemetry.page import page_set
6 from webgl_conformance import WebglConformanceValidator
7 from webgl_conformance import conformance_harness_script
8 from webgl_conformance import conformance_path
9
10
11 robustness_harness_script = conformance_harness_script + r"""
12 var robustnessTestHarness = {};
13 robustnessTestHarness._contextLost = false;
14 robustnessTestHarness.initialize = function() {
15 var canvas = document.getElementById('example');
16 canvas.addEventListener('webglcontextlost', function() {
17 robustnessTestHarness._contextLost = true;
18 });
19 }
20 robustnessTestHarness.runTestLoop = function() {
21 // Run the test in a loop until the context is lost.
22 main();
23 if (!robustnessTestHarness._contextLost)
24 window.requestAnimationFrame(robustnessTestHarness.runTestLoop);
25 else
26 robustnessTestHarness.notifyFinished();
27 }
28 robustnessTestHarness.notifyFinished = function() {
29 // The test may fail in unpredictable ways depending on when the context is
30 // lost. We ignore such errors and only require that the browser doesn't
31 // crash.
32 webglTestHarness._allTestSucceeded = true;
33 // Notify test completion after a delay to make sure the browser is able to
34 // recover from the lost context.
35 setTimeout(webglTestHarness.notifyFinished, 3000);
36 }
37
38 window.confirm = function() {
39 robustnessTestHarness.initialize();
40 robustnessTestHarness.runTestLoop();
41 return false;
42 }
43 window.webglRobustnessTestHarness = robustnessTestHarness;
44 """
45
46
47 class WebglRobustness(test.Test):
48 enabled = False
49 test = WebglConformanceValidator
50
51 def CreatePageSet(self, options):
52 page_set_dict = {
53 'description': 'Test cases for WebGL robustness',
54 'user_agent_type': 'desktop',
55 'serving_dirs': [''],
56 'pages': [
57 {
58 'url': 'file:///extra/lots-of-polys-example.html',
59 'script_to_evaluate_on_commit': robustness_harness_script,
60 'wait_for_javascript_expression': 'webglTestHarness._finished'
61 }
62 ]
63 }
64 return page_set.PageSet.FromDict(page_set_dict, conformance_path)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698