From 2d61dbe3b7b94e047a1b1ccfd0e77baac4b8bcdd Mon Sep 17 00:00:00 2001 From: Robert Dionne Date: Wed, 5 Jun 2013 16:13:10 -0400 Subject: [PATCH] Sync javascript between projects. --- .../google/jstestdriver/javascript/Utils.js | 2 +- .../google/jstestdriver/javascript/config.js | 22 +++++++++---------- .../plugins/AsyncTestRunnerPlugin.js | 8 +++---- .../javascript/plugins/TestRunnerPlugin.js | 8 +++---- .../plugins/async/CallbackPoolDelegate.js | 11 ++++++++++ 5 files changed, 31 insertions(+), 20 deletions(-) diff --git a/JsTestDriver/src/com/google/jstestdriver/javascript/Utils.js b/JsTestDriver/src/com/google/jstestdriver/javascript/Utils.js index 0a99a47f..9da1ad4e 100644 --- a/JsTestDriver/src/com/google/jstestdriver/javascript/Utils.js +++ b/JsTestDriver/src/com/google/jstestdriver/javascript/Utils.js @@ -246,7 +246,7 @@ jstestdriver.utils.serializeObjectToArray = var out = opt_out || out; if (jstestdriver.utils.isNative(obj, 'Array')) { out.push('['); - var arr = obj; + var arr = /** @type {Array.} */ (obj); for ( var i = 0; i < arr.length; i++) { this.serializeObjectToArray(arr[i], out); if (i < arr.length - 1) { diff --git a/JsTestDriver/src/com/google/jstestdriver/javascript/config.js b/JsTestDriver/src/com/google/jstestdriver/javascript/config.js index ddef5b24..c78327a2 100644 --- a/JsTestDriver/src/com/google/jstestdriver/javascript/config.js +++ b/JsTestDriver/src/com/google/jstestdriver/javascript/config.js @@ -61,17 +61,17 @@ jstestdriver.config = (function(module) { stylesheetLoader, jstestdriver.now); var testRunnerPlugin = - new jstestdriver.plugins.TestRunnerPlugin( - Date, - function() { - jstestdriver.log(jstestdriver.jQuery('body')[0].innerHTML); - jstestdriver.jQuery('body').children().remove(); - jstestdriver.jQuery(document).unbind(); - jstestdriver.jQuery(document).die(); - }, - jstestdriver.pluginRegistrar, - jstestdriver.utils.serializeErrors, - runTestLoop); + new jstestdriver.plugins.TestRunnerPlugin( + Date, + function() { + jstestdriver.log(jstestdriver.jQuery('body')[0].innerHTML); + jstestdriver.jQuery('body').children().remove(); + jstestdriver.jQuery(document).unbind(); + jstestdriver.jQuery(document).die(); + }, + jstestdriver.pluginRegistrar, + jstestdriver.utils.serializeErrors, + runTestLoop); jstestdriver.pluginRegistrar.register( new jstestdriver.plugins.DefaultPlugin( diff --git a/JsTestDriver/src/com/google/jstestdriver/javascript/plugins/AsyncTestRunnerPlugin.js b/JsTestDriver/src/com/google/jstestdriver/javascript/plugins/AsyncTestRunnerPlugin.js index 62d6b70d..0c82482b 100644 --- a/JsTestDriver/src/com/google/jstestdriver/javascript/plugins/AsyncTestRunnerPlugin.js +++ b/JsTestDriver/src/com/google/jstestdriver/javascript/plugins/AsyncTestRunnerPlugin.js @@ -152,8 +152,8 @@ jstestdriver.plugins.async.AsyncTestRunnerPlugin.prototype.execute_ = function( onStageComplete, invokeMethod) { var runner = this; var onError = function(error) {runner.errors_.push(error);}; - var arguments = this.testRunConfiguration_.getArguments(); - var argument = arguments ? arguments[this.testName_] : null; + var args = this.testRunConfiguration_.getArguments(); + var argument = args ? args[this.testName_] : null; var stage = new jstestdriver.plugins.async.TestStage.Builder(). setOnError(onError). setOnStageComplete(onStageComplete). @@ -261,8 +261,8 @@ jstestdriver.plugins.async.AsyncTestRunnerPlugin.prototype.buildResult = functio jstestdriver.assertCount + "' encountered.")]); } - var arguments = this.testRunConfiguration_.getArguments(); - var argument = arguments ? arguments[this.testName_] : null; + var args = this.testRunConfiguration_.getArguments(); + var argument = args ? args[this.testName_] : null; return new jstestdriver.TestResult( this.testCaseInfo_.getTestCaseName(), this.testName_, result, message, jstestdriver.console.getAndResetLog(), end - this.start_, null, argument); diff --git a/JsTestDriver/src/com/google/jstestdriver/javascript/plugins/TestRunnerPlugin.js b/JsTestDriver/src/com/google/jstestdriver/javascript/plugins/TestRunnerPlugin.js index 57bced43..e33b3c19 100644 --- a/JsTestDriver/src/com/google/jstestdriver/javascript/plugins/TestRunnerPlugin.js +++ b/JsTestDriver/src/com/google/jstestdriver/javascript/plugins/TestRunnerPlugin.js @@ -29,10 +29,10 @@ goog.provide('jstestdriver.plugins.TestRunnerPlugin'); * @constructor */ jstestdriver.plugins.TestRunnerPlugin = function(dateObj, - clearBody, - pluginRegistrar, - serializeErrors, - opt_runTestLoop) { + clearBody, + pluginRegistrar, + serializeErrors, + opt_runTestLoop) { this.dateObj_ = dateObj; this.clearBody_ = clearBody; this.boundRunTest_ = jstestdriver.bind(this, this.runTest); diff --git a/JsTestDriver/src/com/google/jstestdriver/javascript/plugins/async/CallbackPoolDelegate.js b/JsTestDriver/src/com/google/jstestdriver/javascript/plugins/async/CallbackPoolDelegate.js index e4862616..7f117935 100644 --- a/JsTestDriver/src/com/google/jstestdriver/javascript/plugins/async/CallbackPoolDelegate.js +++ b/JsTestDriver/src/com/google/jstestdriver/javascript/plugins/async/CallbackPoolDelegate.js @@ -87,6 +87,7 @@ jstestdriver.plugins.async.CallbackPoolDelegate.prototype.addErrback = function( * @param {string=} opt_description The callback description. * @return {Function} The wrapped callback. * @export + * @deprecated Use addCallback(). */ jstestdriver.plugins.async.CallbackPoolDelegate.prototype.add = jstestdriver.plugins.async.CallbackPoolDelegate.prototype.addCallback; @@ -101,6 +102,7 @@ jstestdriver.plugins.async.CallbackPoolDelegate.prototype.add = * @param {string=} opt_description The description. * @return {Function} A noop callback. * @export + * @deprecated Use wait(). */ jstestdriver.plugins.async.CallbackPoolDelegate.prototype.noop = function( opt_n, opt_timeout, opt_description) { @@ -113,3 +115,12 @@ jstestdriver.plugins.async.CallbackPoolDelegate.prototype.noop = function( return this.pool_.addCallback( jstestdriver.EMPTY_FUNC, opt_n, opt_timeout, opt_description); }; + + +/** + * Adds an empty callback to the queue. + * @return {Function} The callback. + * @export + */ +jstestdriver.plugins.async.CallbackPoolDelegate.prototype.wait = + jstestdriver.plugins.async.CallbackPoolDelegate.prototype.noop;