The goog.testing.async.MockControl Class

goog.testing.async.MockControl(mockControl)

Provides asynchronous mocks and assertions controlled by a parent MockControl.

mockControl {goog.testing.MockControl}
The parent MockControl.

.assertDeferredEquals(message, expected, actual)

Asserts that a deferred object will call its callback with the given value.

message {string}
A message to print if the arguments are wrong.
expected {goog.async.Deferred|*}
The expected value. If this is a deferred object, then the expected value is the deferred value.
actual {goog.async.Deferred|*}
The actual value. If this is a deferred object, then the actual value is the deferred value. Either this or 'expected' must be deferred.

.assertDeferredError(deferred, fn)

Asserts that a deferred object will have an error and call its errback function.

deferred {goog.async.Deferred}
The deferred object.
fn {function() : void}
A function wrapping the code in which the error will occur.

.asyncAssertEquals(message, var_args)

Returns a function that will assert that its arguments are equal to the arguments given to asyncAssertEquals. In addition, the function also asserts that it will be called.

message {string}
A message to print if the arguments are wrong.
var_args {...*}
The arguments to assert.
returns {function(...[*]) : void}
The mock callback.

.createCallbackMock(name, callback, opt_selfObj)

Returns a function that will assert that it will be called, and run the given callback when it is.

name {string}
The name of the callback mock.
callback {function(...[*]) : *}
The wrapped callback. This will be called when the returned function is called.
opt_selfObj {Object=}
The object which this should point to when the callback is run.
returns {!Function}
The mock callback.
@suppress
{missingProperties} Mocks do not fit in the type system well.