net.BrowserTestChannel Extends
Encapsulates the logic for a single BrowserTestChannel.

Inheritance

Constructor

goog.net.BrowserTestChannel(channelchannelDebug)

Parameters

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

Instance Methods

Public Protected Private
abort()
Aborts the test channel.
code »
checkBlockedCallback_(succeeded)
Callback for testLoadImageWithRetries to check if browser channel is blocked.
Arguments:
succeeded : boolean
Whether the request succeeded.
code »
checkBlocked_()
Checks to see whether the channel is blocked. This is for implementing the feature that allows network administrators to block Gmail Chat. The strategy to determine if we're blocked is to try to load an image off a special subdomain that network administrators will block access to if they are trying to block chat. For Gmail Chat, the subdomain is chatenabled.mail.google.com.
code »
checkForEarlyNonBuffered_() boolean
No description.
Returns: boolean  True if test stage 2 detected a non-buffered channel early and early no buffering detection is enabled.
code »
connect(path)
Starts the test channel. This initiates connections to the server.
Arguments:
path : string
The relative uri for the test connection.
code »
connectStage2_()
Begins the second stage of the test channel where we test to see if we're behind a buffering proxy. The server sends back a multi-chunked response with the first chunk containing the content '1' and then two seconds later sending the second chunk containing the content '2'. Depending on how we receive the content, we can tell if we're behind a buffering proxy.
code »
createXhrIo(hostPrefix) !goog.net.XhrIo
Factory method for XhrIo objects.
Arguments:
hostPrefix : ?string
The host prefix, if we need an XhrIo object capable of calling a secondary domain.
Returns: !goog.net.XhrIo  New XhrIo object.
code »
getLastStatusCode() number
Returns the last status code received for a request.
Returns: number  The last status code received for a request.
code »
isActive(browserChannel) boolean
Gets whether this channel is currently active. This is used to determine the length of time to wait before retrying.
Arguments:
browserChannel : goog.net.BrowserChannel
The browser channel.
Returns: boolean  Whether the channel is currently active.
code »
isClosed() boolean
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.
code »
notifyServerReachabilityEvent(reachabilityType)
Notifies the channel of a fine grained network event.
Arguments:
reachabilityType : goog.net.BrowserChannel.ServerReachability
The reachability event type.
code »
onRequestComplete(req)
Callback from ChannelRequest that indicates a request has completed.
Arguments:
req : goog.net.ChannelRequest
The request object.
code »
onRequestData(reqresponseText)
Callback from ChannelRequest for when new data is received
Arguments:
req : goog.net.ChannelRequest
The request object.
responseText : string
The text of the response.
code »
setExtraHeaders(extraHeaders)
Sets extra HTTP headers to add to all the requests sent to the server.
Arguments:
extraHeaders : Object
The HTTP headers.
code »
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 goog.json.unsafeParse.
Arguments:
parser : !goog.string.Parser
Parser.
code »
shouldUseSecondaryDomains() boolean
No description.
Returns: boolean  Whether we should be using secondary domains when the server instructs us to do so.
code »

Instance Properties

blockedPrefix_ :
A subdomain prefix for testing whether the channel was disabled by a network administrator;
Code »
channelDebug_ : goog.net.ChannelDebug
The channel debug to use for logging
Code »
The BrowserChannel that owns this test channel
Code »
extraHeaders_ :
Extra HTTP headers to add to all the requests sent to the server.
Code »
firstTime_ :
The time for of the first result part. We use timing in IE as a heuristic for whether we're behind a buffering proxy.
Code »
hostPrefix_ :
A subdomain prefix for using a subdomain in IE for the backchannel requests.
Code »
lastStatusCode_ :
The last status code received.
Code »
lastTime_ :
The time for of the last result part. We use timing in IE as a heuristic for whether we're behind a buffering proxy.
Code »
Parser for a response payload. Defaults to use goog.json.unsafeParse. The parser should return an array.
Code »
path_ :
The relative path for test requests.
Code »
receivedIntermediateResult_ :
Whether we have received the first result as an intermediate result. This helps us determine whether we're behind a buffering proxy.
Code »
The test request.
Code »
startTime_ :
The time when the test request was started. We use timing in IE as a heuristic for whether we're behind a buffering proxy.
Code »
state_ :
The state of the state machine for this object.
Code »

Static Properties

goog.net.BrowserTestChannel.BLOCKED_PAUSE_BETWEEN_RETRIES_ :
Time in ms between retries of the blocked request
Code »
goog.net.BrowserTestChannel.BLOCKED_RETRIES_ :
Number of attempts to try to see if the check to see if we're blocked succeeds. Sometimes the request can fail because of flaky network conditions and checking multiple times reduces false positives.
Code »
goog.net.BrowserTestChannel.BLOCKED_TIMEOUT_ :
Time in MS for waiting for the request to see if the channel is blocked. If the response takes longer than this many ms, we assume the request has failed.
Code »
goog.net.BrowserTestChannel.MIN_TIME_EXPECTED_BETWEEN_DATA_ :
Time between chunks in the test connection that indicates that we are not behind a buffering proxy. This value should be less than or equals to the time between chunks sent from the server.
Code »

Enumerations

goog.net.BrowserTestChannel.State_ :
Enum type for the browser test channel state machine
Constants:
CHECKING_BLOCKED
No description.
CONNECTION_TESTING
No description.
INIT
No description.
Code »

Package net

Package Reference