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

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

Issue 23604039: Include console.log output in exceptions thrown for WebGL test failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | 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
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 json 4 import json
5 import os 5 import os
6 import sys 6 import sys
7 7
8 import webgl_conformance_expectations 8 import webgl_conformance_expectations
9 9
10 from telemetry import test as test_module 10 from telemetry import test as test_module
11 from telemetry.core import util 11 from telemetry.core import util
12 from telemetry.page import page_set 12 from telemetry.page import page_set
13 from telemetry.page import page_test 13 from telemetry.page import page_test
14 14
15 conformance_path = os.path.join( 15 conformance_path = os.path.join(
16 util.GetChromiumSrcDir(), 'third_party', 'webgl_conformance') 16 util.GetChromiumSrcDir(), 'third_party', 'webgl_conformance')
17 17
18 conformance_harness_script = r""" 18 conformance_harness_script = r"""
19 var testHarness = {}; 19 var testHarness = {};
20 testHarness._allTestSucceeded = true; 20 testHarness._allTestSucceeded = true;
21 testHarness._messages = ''; 21 testHarness._messages = '';
22 testHarness._failures = 0; 22 testHarness._failures = 0;
23 testHarness._finished = false; 23 testHarness._finished = false;
24 testHarness._originalLog = window.console.log;
25
26 testHarness.log = function(msg) {
27 testHarness._messages += msg + "\n";
28 testHarness._originalLog.apply(window.console, [msg]);
29 }
24 30
25 testHarness.reportResults = function(success, msg) { 31 testHarness.reportResults = function(success, msg) {
26 testHarness._allTestSucceeded = testHarness._allTestSucceeded && !!success; 32 testHarness._allTestSucceeded = testHarness._allTestSucceeded && !!success;
27 if(!success) { 33 if(!success) {
28 testHarness._failures++; 34 testHarness._failures++;
29 if(msg) { 35 if(msg) {
30 testHarness._messages += msg + "\n"; 36 testHarness.log(msg);
31 } 37 }
32 } 38 }
33 }; 39 };
34 testHarness.notifyFinished = function() { 40 testHarness.notifyFinished = function() {
35 testHarness._finished = true; 41 testHarness._finished = true;
36 }; 42 };
37 testHarness.navigateToPage = function(src) { 43 testHarness.navigateToPage = function(src) {
38 var testFrame = document.getElementById("test-frame"); 44 var testFrame = document.getElementById("test-frame");
39 testFrame.src = src; 45 testFrame.src = src;
40 }; 46 };
41 47
42 window.webglTestHarness = testHarness; 48 window.webglTestHarness = testHarness;
43 window.parent.webglTestHarness = testHarness; 49 window.parent.webglTestHarness = testHarness;
44 console.log("Harness injected."); 50 console.log("Harness injected.");
51 window.console.log = testHarness.log;
45 """ 52 """
46 53
47 def _DidWebGLTestSucceed(tab): 54 def _DidWebGLTestSucceed(tab):
48 return tab.EvaluateJavaScript('webglTestHarness._allTestSucceeded') 55 return tab.EvaluateJavaScript('webglTestHarness._allTestSucceeded')
49 56
50 def _WebGLTestMessages(tab): 57 def _WebGLTestMessages(tab):
51 return tab.EvaluateJavaScript('webglTestHarness._messages') 58 return tab.EvaluateJavaScript('webglTestHarness._messages')
52 59
53 class WebglConformanceValidator(page_test.PageTest): 60 class WebglConformanceValidator(page_test.PageTest):
54 def __init__(self): 61 def __init__(self):
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 144
138 if '.txt' in test_name: 145 if '.txt' in test_name:
139 include_path = os.path.join(current_dir, test_name) 146 include_path = os.path.join(current_dir, test_name)
140 test_paths += WebglConformance._ParseTests( 147 test_paths += WebglConformance._ParseTests(
141 include_path, version) 148 include_path, version)
142 else: 149 else:
143 test = os.path.join(current_dir, test_name) 150 test = os.path.join(current_dir, test_name)
144 test_paths.append(test) 151 test_paths.append(test)
145 152
146 return test_paths 153 return test_paths
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