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

Unified Diff: chrome/test/data/third_party/spaceport/js/testRunner.js

Issue 10134041: Add test data for spaceport benchmark. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
Index: chrome/test/data/third_party/spaceport/js/testRunner.js
diff --git a/chrome/test/data/third_party/spaceport/js/testRunner.js b/chrome/test/data/third_party/spaceport/js/testRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..f082ad59a9129830b40d1a1ab2bff6480c1edf1f
--- /dev/null
+++ b/chrome/test/data/third_party/spaceport/js/testRunner.js
@@ -0,0 +1,44 @@
+define([ 'util/ensureCallback', 'util/chainAsync' ], function (ensureCallback, chainAsync) {
+ var testRunner = {
+ run: function run(name, test, callbacks) {
+ var stepCallback = callbacks.step || function () { };
+ var doneCallback = ensureCallback(callbacks.done);
+
+ if (typeof test === 'function') {
+ // We run the test twice (sadly): once to warm up the JIT and once for the actual test.
+ //test(function (_, _) {
+ test(function (err, results) {
+ stepCallback(err, name, results);
+ doneCallback(err, results);
+ });
+ //});
+ } else {
+ var allResults = { };
+
+ var subTests = Object.keys(test).map(function (subName) {
+ var newName = name ? name + '.' + subName : subName;
+ return function (next) {
+ testRunner.run(newName, test[subName], {
+ step: stepCallback,
+ done: function (err, results) {
+ if (!err) {
+ allResults[subName] = results;
+ }
+
+ next();
+ }
+ });
+ };
+ });
+
+ chainAsync(subTests.concat([
+ function () {
+ doneCallback(null, allResults);
+ }
+ ]));
+ }
+ }
+ };
+
+ return testRunner;
+});
« no previous file with comments | « chrome/test/data/third_party/spaceport/js/testDom.js ('k') | chrome/test/data/third_party/spaceport/js/tests/audioLatency.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698