Home

Class goog.net.MockIFrameIo

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.

extends goog.events.EventTarget
Instance Method Summary
abort(?goog.net.ErrorCode= opt_failureCode)

Simulates aborting the current Iframe request.

getErrorChecker() ⇒ ?Function

Gets the callback function used to check if a loaded IFrame is in an error state.

getLastCustomError() ⇒ ?Object

Gets the last custom error.

getLastError() ⇒ string

Gets the last error message.

getLastErrorCode() ⇒ ?goog.net.ErrorCode

Gets the last error code.

getLastUri() ⇒ ?goog.Uri

Get the uri of the last request.

getResponseJson() ⇒ ?Object

Parses the content as JSON. This is a safe parse and may throw an error if the response is malformed.

getResponseText() ⇒ string

Returns the last response text (i.e. the text content of the iframe). Assumes plain text!

getTimeoutInterval() ⇒ number

Returns the number of milliseconds after which an incomplete request will be aborted, or 0 if no timeout is set.

isActive() ⇒ boolean
isComplete() ⇒ boolean
isSuccess() ⇒ boolean
send((goog.Uri|null|string) uri, string= opt_method, boolean= opt_noCache, (Object|goog.structs.Map|null=) opt_data)

Simulates the iframe send.

sendFromForm(?Element form, string= opt_uri, boolean= opt_noCache)

Simulates the iframe send from a form.

setErrorChecker(?Function fn)

Sets the callback function used to check if a loaded IFrame is in an error state.

setTimeoutInterval(number 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.

simulateDone(?goog.net.ErrorCode errorCode)

Simulates the iframe is done.

simulateIncrementalData(?Object data)

Simulates receive of incremental data.

simulateReady()

Simulates the IFrame is ready for the next request.