summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorbajones@chromium.org <bajones@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-26 04:38:54 +0000
committerbajones@chromium.org <bajones@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-26 04:38:54 +0000
commitf242dbdcb9413db54a5df6cb3703f20840ecc833 (patch)
tree578c792fa413f3f687ac6cf675471564f8df673f /content
parent38f118b3f788a3326c1bae943841364eddacfd69 (diff)
downloadchromium_src-f242dbdcb9413db54a5df6cb3703f20840ecc833.zip
chromium_src-f242dbdcb9413db54a5df6cb3703f20840ecc833.tar.gz
chromium_src-f242dbdcb9413db54a5df6cb3703f20840ecc833.tar.bz2
Adding Telemetry driven WebGL conformance tests
We hope to eventually use this on the buildbots BUG=225939 Review URL: https://chromiumcodereview.appspot.com/13465022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196606 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/test/gpu/gpu_tests/bootstrap_deps2
-rw-r--r--content/test/gpu/gpu_tests/webgl_conformance_test.py137
2 files changed, 139 insertions, 0 deletions
diff --git a/content/test/gpu/gpu_tests/bootstrap_deps b/content/test/gpu/gpu_tests/bootstrap_deps
index c56d53b..2e683cb 100644
--- a/content/test/gpu/gpu_tests/bootstrap_deps
+++ b/content/test/gpu/gpu_tests/bootstrap_deps
@@ -12,6 +12,8 @@ deps = {
"https://src.chromium.org/chrome/trunk/src/content/test/gpu/gpu_tests",
"src/content/test/gpu/page_sets":
"https://src.chromium.org/chrome/trunk/src/content/test/gpu/page_sets",
+ "src/third_party/webgl_conformance":
+ "https://src.chromium.org/chrome/trunk/deps/third_party/webgl/sdk/tests",
}
# gpu_tests depends on Telemetry, so pull in the Telemetry deps, too.
diff --git a/content/test/gpu/gpu_tests/webgl_conformance_test.py b/content/test/gpu/gpu_tests/webgl_conformance_test.py
new file mode 100644
index 0000000..29abd02
--- /dev/null
+++ b/content/test/gpu/gpu_tests/webgl_conformance_test.py
@@ -0,0 +1,137 @@
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+import os
+import sys
+import json
+
+from telemetry.page import page_set
+from telemetry.page import page_test
+from telemetry.core import util
+
+src_path = os.path.join(os.path.dirname(__file__), '..', '..', '..', '..')
+conformance_path = os.path.join(src_path, 'third_party', 'webgl_conformance')
+
+conformance_harness_script = r'''
+var testHarness = {};
+testHarness._allTestSucceeded = true;
+testHarness._messages = '';
+testHarness._failures = 0;
+testHarness._finished = false;
+
+testHarness.reportResults = function(success, msg) {
+ testHarness._allTestSucceeded = testHarness._allTestSucceeded && !!success;
+ if(!success) {
+ testHarness._failures++;
+ if(msg) {
+ testHarness._messages += msg + "\n";
+ }
+ }
+};
+testHarness.notifyFinished = function() {
+ testHarness._finished = true;
+};
+testHarness.navigateToPage = function(src) {
+ var testFrame = document.getElementById("test-frame");
+ testFrame.src = src;
+};
+
+window.webglTestHarness = testHarness;
+window.parent.webglTestHarness = testHarness;
+console.log("Harness injected.");
+'''
+
+class WebGLConformanceTest(page_test.PageTest):
+ def __init__(self):
+ super(WebGLConformanceTest, self).__init__('ValidatePage')
+
+ def CreatePageSet(self, options):
+ tests = WebGLConformanceTest._ParseTests('00_test_list.txt')
+
+ page_set_dict = {
+ 'description': 'Executes WebGL conformance tests',
+ 'user_agent_type': 'desktop',
+ 'serving_dirs': [
+ '../../../third_party/webgl_conformance'
+ ],
+ 'pages': []
+ }
+
+ pages = page_set_dict['pages']
+
+ for test in tests:
+ pages.append({
+ 'url': 'file:///../../../third_party/webgl_conformance/' + test,
+ 'script_to_evaluate_on_commit': conformance_harness_script
+ })
+
+ return page_set.PageSet.FromDict(page_set_dict)
+
+ def CanRunForPage(self, page):
+ page.base_dir = os.getcwd()
+ return True
+
+ def ValidatePage(self, page, tab, results):
+ util.WaitFor(lambda: WebGLConformanceTest._CheckTestFinished(tab), 60)
+
+ if WebGLConformanceTest._TestSucceeded(tab):
+ results.AddSuccess(page)
+ else:
+ results.AddFailure(page, WebGLConformanceTest._TestMessage(tab), None)
+
+ @staticmethod
+ def _CheckTestFinished(tab):
+ return tab.EvaluateJavaScript('webglTestHarness._finished')
+
+ @staticmethod
+ def _TestSucceeded(tab):
+ return tab.EvaluateJavaScript('webglTestHarness._allTestSucceeded')
+
+ @staticmethod
+ def _TestMessage(tab):
+ return tab.EvaluateJavaScript('webglTestHarness._messages')
+
+ @staticmethod
+ def _ParseTests(path, version = None):
+ test_paths = []
+ current_dir = os.path.dirname(path)
+ full_path = os.path.normpath(os.path.join(conformance_path, path))
+
+ if not os.path.exists(full_path):
+ raise Exception('The WebGL conformance test path specified ' +
+ 'does not exist: ' + full_path)
+
+ with open(full_path, 'r') as f:
+ for line in f:
+ line = line.strip()
+
+ if not line:
+ continue
+
+ if line.startswith('//') or line.startswith('#'):
+ continue
+
+ line_tokens = line.split(' ')
+
+ i = 0
+ while i < len(line_tokens):
+ token = line_tokens[i]
+ if token == '--min-version':
+ i += 1
+ min_version = line_tokens[i]
+ i += 1
+
+ if version and version < min_version:
+ continue
+
+ test_name = line_tokens[-1]
+
+ if '.txt' in test_name:
+ include_path = os.path.join(current_dir, test_name)
+ test_paths += WebGLConformanceTest._ParseTests(
+ include_path, version)
+ else:
+ test = os.path.join(current_dir, test_name)
+ test_paths.append(test)
+
+ return test_paths