The goog.net.BrowserTestChannel Class

goog.net.BrowserTestChannel(channel, channelDebug)

Encapsulates the logic for a single BrowserTestChannel.

channel {goog.net.BrowserChannel}
The BrowserChannel that owns this test channel.
channelDebug {goog.net.ChannelDebug}
A ChannelDebug to use for logging.

.abort()

Aborts the test channel.

.connect(path)

Starts the test channel. This initiates connections to the server.

path {string}
The relative uri for the test connection.

.createXhrIo(hostPrefix)

Factory method for XhrIo objects.

hostPrefix {?string}
The host prefix, if we need an XhrIo object capable of calling a secondary domain.
returns {!goog.net.XhrIo}
New XhrIo object.

.getLastStatusCode()

Returns the last status code received for a request.

returns {number}
The last status code received for a request.

.isActive(browserChannel)

Gets whether this channel is currently active. This is used to determine the length of time to wait before retrying.

browserChannel {goog.net.BrowserChannel}
The browser channel.
returns {boolean}
Whether the channel is currently active.

.isClosed()

Returns whether the test channel is closed. The ChannelRequest object expects this method to be implemented on its handler.

returns {boolean}
Whether the channel is closed.

.notifyServerReachabilityEvent(reachabilityType)

Notifies the channel of a fine grained network event.

reachabilityType {goog.net.BrowserChannel.ServerReachability}
The reachability event type.

.onRequestComplete(req)

Callback from ChannelRequest that indicates a request has completed.

req {goog.net.ChannelRequest}
The request object.

.onRequestData(req, responseText)

Callback from ChannelRequest for when new data is received

req {goog.net.ChannelRequest}
The request object.
responseText {string}
The text of the response.

.setExtraHeaders(extraHeaders)

Sets extra HTTP headers to add to all the requests sent to the server.

extraHeaders {Object}
The HTTP headers.

.setParser(parser)

Sets a new parser for the response payload. A custom parser may be set to avoid using eval(), for example. By default, the parser uses {@code goog.json.unsafeParse}.

parser {!goog.string.Parser}
Parser.

.shouldUseSecondaryDomains()

returns {boolean}
Whether we should be using secondary domains when the server instructs us to do so.