Mock implementation of goog.net.XhrIo. 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)Abort the current XMLHttpRequest | |
createXhr() ⇒ (GearsHttpRequest|XMLHttpRequest|null)Creates a new XHR object. | |
getAllResponseHeaders() ⇒ stringGets the text of all the headers in the response. Will only return correct result when called from the context of a callback and the request has completed | |
getLastContent() ⇒ (string|undefined)Gets the last POST content that was requested. | |
getLastError() ⇒ stringGets the last error message. | |
getLastErrorCode() ⇒ ?goog.net.ErrorCodeGets the last error message. | |
getLastMethod() ⇒ (string|undefined)Gets the last HTTP method that was requested. | |
getLastRequestHeaders() ⇒ (Object|goog.structs.Map|null|undefined)Gets the headers of the last request. | |
getLastUri() ⇒ stringGets the last URI that was requested. | |
getReadyState() ⇒ numberReturns the readystate. | |
getResponse() ⇒ <Any Type>Get the response as the type specificed by {@link #setResponseType}. At time of writing, this is only supported in very recent versions of WebKit (10.0.612.1 dev and later). | |
getResponseHeader(string key) ⇒ (string|undefined)Get the value of the response-header with the given name from the Xhr object Will only return correct result when called from the context of a callback and the request has completed | |
getResponseJson(string= opt_xssiPrefix) ⇒ ?ObjectGets the response and evaluates it as JSON from the Xhr object. Will only return correct result when called from the context of a callback. | |
getResponseText() ⇒ stringGets the response text from the Xhr object. Will only return correct result when called from the context of a callback. | |
getResponseType() ⇒ ?goog.net.XhrIo.ResponseTypeGets the desired type for the response. | |
getResponseXml() ⇒ ?DocumentGets the response XML from the Xhr object. Will only return correct result when called from the context of a callback. | |
getStatus() ⇒ numberGet the status from the Xhr object. Will only return correct result when called from the context of a callback. | |
getStatusText() ⇒ stringGet the status text from the Xhr object. Will only return correct result when called from the context of a callback. | |
getTimeoutInterval() ⇒ numberReturns the number of milliseconds after which an incomplete request will be aborted, or 0 if no timeout is set. | |
getWithCredentials() ⇒ booleanGets whether a "credentialed" request is to be sent. | |
isActive() ⇒ boolean | |
isComplete() ⇒ booleanHas the request completed. | |
isSuccess() ⇒ booleanHas the request compeleted with a success. | |
send(string url, string= opt_method, string= opt_content, (Object|goog.structs.Map|null=) opt_headers)Simulates the XhrIo send. | |
setResponseType(?goog.net.XhrIo.ResponseType type)Sets the desired type for the response. At time of writing, this is only supported in very recent versions of WebKit (10.0.612.1 dev and later). If this is used, the response may only be accessed via {@link #getResponse}. | |
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. | |
setWithCredentials(boolean withCredentials)Sets whether a "credentialed" request that is aware of cookie and authentication information should be made. This option is only supported by browsers that support HTTP Access Control. As of this writing, this option is not supported in IE. | |
simulateReady()Simulates the Xhr is ready for the next request. | |
simulateReadyStateChange(number readyState)Simulates changing to the new ready state. | |
simulateResponse(number statusCode, (Document|null|string) response, ?Object= opt_headers)Simulates receiving a response. | |
simulateTimeout()Causes timeout events to be fired. | |
| Static Method Summary | |
cleanup()Disposes all non-disposed instances of goog.testing.net.XhrIo created by {@link goog.testing.net.XhrIo.send}. | |
cleanupSend_(?goog.testing.net.XhrIo XhrIo)Disposes of the specified goog.testing.net.XhrIo created by {@link goog.testing.net.XhrIo.send} and removes it from {@link goog.testing.net.XhrIo.pendingStaticSendInstances_}. | |
getSendInstances() ⇒ ?ArrayReturns an Array containing all non-disposed instances of goog.testing.net.XhrIo created by {@link goog.testing.net.XhrIo.send}. | |
send(string url, ?Function= opt_callback, string= opt_method, string= opt_content, (Object|goog.structs.Map|null=) opt_headers, number= opt_timeoutInterval)Simulates the static XhrIo send method. | |