goog.net.MockIFrameIo
Classgoog.net.MockIFrameIo
> goog.events.EventTarget
> goog.Disposable
goog.net.MockIFrameIo(testQueue)
Mock implenetation of goog.net.IframeIo. This doesn't provide a mock implementation for all cases, but it's not too hard to add them as needed.
testQueue
{goog.testing.TestQueue
}
.abort(opt_failureCode)
Simulates aborting the current Iframe request.
opt_failureCode
{goog.net.ErrorCode
=}
.addEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
Adds an event listener to the event target. The same handler can only be added once per the type. Even if you add the same handler multiple times using the same type then it will only be called once when the event is dispatched. Supported for legacy but use goog.events.listen(src, type, handler) instead.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.addOnDisposeCallback(callback, opt_scope)
Inherited from goog.Disposable
.
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
callback
{!Function
}
opt_scope
{Object
=}
.creationStack
{string
}Inherited from goog.Disposable
.
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
.dispatchEvent(e)
Inherited from goog.events.EventTarget
.
Dispatches an event (or event like object) and calls all listeners listening for events of this type. The type of the event is decided by the type property on the event object. If any of the listeners returns false OR calls preventDefault then this function will return false. If one of the capture listeners calls stopPropagation, then the bubble listeners won't fire.
e
{string
|Object
|goog.events.Event
}
boolean
}
.dispose()
Inherited from goog.Disposable
.
Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
void
}
.disposeInternal()
[protected]Inherited from goog.events.EventTarget
.
Unattach listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners, it should be something like this:
MyClass.prototype.disposeInternal = function() { MyClass.superClass_.disposeInternal.call(this); // Dispose logic for MyClass };
.getDisposed
[deprecated]Deprecated. Use {@link #isDisposed} instead.
Inherited from goog.Disposable
.
boolean
}
.getErrorChecker()
Gets the callback function used to check if a loaded IFrame is in an error state.
Function
}
.getLastCustomError()
Gets the last custom error.
Object
}
.getLastError()
Gets the last error message.
string
}
.getLastErrorCode()
Gets the last error code.
goog.net.ErrorCode
}
.getLastUri()
Get the uri of the last request.
goog.Uri
}
.getParentEventTarget()
Inherited from goog.events.EventTarget
.
Returns the parent of this event target to use for bubbling.
goog.events.EventTarget
}
.getResponseJson()
Parses the content as JSON. This is a safe parse and may throw an error if the response is malformed.
Object
}
.getResponseText()
Returns the last response text (i.e. the text content of the iframe). Assumes plain text!
string
}
.getTimeoutInterval()
Returns the number of milliseconds after which an incomplete request will be aborted, or 0 if no timeout is set.
number
}
.isActive()
boolean
}
.isComplete()
boolean
}
.isDisposed()
Inherited from goog.Disposable
.
boolean
}
.isSuccess()
boolean
}
.registerDisposable(disposable)
Inherited from goog.Disposable
.
Associates a disposable object with this object so that they will be disposed together.
disposable
{goog.disposable.IDisposable
}
.removeEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
Removes an event listener from the event target. The handler must be the same object as the one added. If the handler has not been added then nothing is done.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.send(uri, opt_method, opt_noCache, opt_data)
Simulates the iframe send.
uri
{goog.Uri
|string
}
opt_method
{string
=}
opt_noCache
{boolean
=}
opt_data
{Object
|goog.structs.Map
=}
.sendFromForm(form, opt_uri, opt_noCache)
Simulates the iframe send from a form.
form
{Element
}
opt_uri
{string
=}
opt_noCache
{boolean
=}
.setErrorChecker(fn)
Sets the callback function used to check if a loaded IFrame is in an error state.
fn
{Function
}
.setParentEventTarget(parent)
Inherited from goog.events.EventTarget
.
Sets the parent of this event target to use for bubbling.
parent
{goog.events.EventTarget
?}
.setTimeoutInterval(ms)
Sets the number of milliseconds after which an incomplete request will be aborted and a {@link goog.net.EventType.TIMEOUT} event raised; 0 means no timeout is set.
ms
{number
}
.simulateDone(errorCode)
Simulates the iframe is done.
errorCode
{goog.net.ErrorCode
}
.simulateIncrementalData(data)
Simulates receive of incremental data.
data
{Object
}
.simulateReady()
Simulates the IFrame is ready for the next request.