| 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;
|
| +});
|
|
|