summaryrefslogtreecommitdiffstats
path: root/net/http
diff options
context:
space:
mode:
authorricea@chromium.org <ricea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-30 12:08:49 +0000
committerricea@chromium.org <ricea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-30 12:08:49 +0000
commita9cf2b958d433646fa76a60e6777939ee62fcab4 (patch)
tree21f7cc785e7db72f5e04e4db0363aabc6a54929e /net/http
parentc4c6dfd201e0e0d7e72d90fc7a16928c3ff78ee2 (diff)
downloadchromium_src-a9cf2b958d433646fa76a60e6777939ee62fcab4.zip
chromium_src-a9cf2b958d433646fa76a60e6777939ee62fcab4.tar.gz
chromium_src-a9cf2b958d433646fa76a60e6777939ee62fcab4.tar.bz2
Rename WebSocketStreamBase to WebSocketHandshakeStreamBase in order to better reflect its new function.
This name change previously was done in CL https://codereview.chromium.org/25417005/ but it caused numerous merge conflicts. So it has been split out into this CL. Also add an Upgrade() method which produces a WebSocketStream from a WebSocketHandshakeStreamBase. This is for use inside the implementation of WebSocketStream::CreateAndConnectStream(). BUG=312515 Review URL: https://codereview.chromium.org/49043009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r--net/http/http_network_session.cc3
-rw-r--r--net/http/http_network_session.h6
-rw-r--r--net/http/http_network_session_peer.cc2
-rw-r--r--net/http/http_network_session_peer.h3
-rw-r--r--net/http/http_network_transaction.cc4
-rw-r--r--net/http/http_network_transaction.h4
-rw-r--r--net/http/http_network_transaction_unittest.cc4
-rw-r--r--net/http/http_stream_base.h2
-rw-r--r--net/http/http_stream_factory.h17
-rw-r--r--net/http/http_stream_factory_impl.cc14
-rw-r--r--net/http/http_stream_factory_impl.h9
-rw-r--r--net/http/http_stream_factory_impl_job.cc29
-rw-r--r--net/http/http_stream_factory_impl_job.h4
-rw-r--r--net/http/http_stream_factory_impl_request.cc19
-rw-r--r--net/http/http_stream_factory_impl_request.h26
-rw-r--r--net/http/http_stream_factory_impl_request_unittest.cc4
-rw-r--r--net/http/http_stream_factory_impl_unittest.cc124
17 files changed, 143 insertions, 131 deletions
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc
index 1c2f898..3924082 100644
--- a/net/http/http_network_session.cc
+++ b/net/http/http_network_session.cc
@@ -126,7 +126,8 @@ HttpNetworkSession::HttpNetworkSession(const Params& params)
params.time_func,
params.trusted_spdy_proxy),
http_stream_factory_(new HttpStreamFactoryImpl(this, false)),
- websocket_stream_factory_(new HttpStreamFactoryImpl(this, true)),
+ websocket_handshake_stream_factory_(
+ new HttpStreamFactoryImpl(this, true)),
params_(params) {
DCHECK(proxy_service_);
DCHECK(ssl_config_service_.get());
diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h
index 20e23a0..5d0a7b9 100644
--- a/net/http/http_network_session.h
+++ b/net/http/http_network_session.h
@@ -140,8 +140,8 @@ class NET_EXPORT HttpNetworkSession
HttpStreamFactory* http_stream_factory() {
return http_stream_factory_.get();
}
- HttpStreamFactory* websocket_stream_factory() {
- return websocket_stream_factory_.get();
+ HttpStreamFactory* websocket_handshake_stream_factory() {
+ return websocket_handshake_stream_factory_.get();
}
NetLog* net_log() {
return net_log_;
@@ -197,7 +197,7 @@ class NET_EXPORT HttpNetworkSession
QuicStreamFactory quic_stream_factory_;
SpdySessionPool spdy_session_pool_;
scoped_ptr<HttpStreamFactory> http_stream_factory_;
- scoped_ptr<HttpStreamFactory> websocket_stream_factory_;
+ scoped_ptr<HttpStreamFactory> websocket_handshake_stream_factory_;
std::set<HttpResponseBodyDrainer*> response_drainers_;
Params params_;
diff --git a/net/http/http_network_session_peer.cc b/net/http/http_network_session_peer.cc
index 74b0d41..2a4ad33 100644
--- a/net/http/http_network_session_peer.cc
+++ b/net/http/http_network_session_peer.cc
@@ -36,7 +36,7 @@ void HttpNetworkSessionPeer::SetHttpStreamFactory(
void HttpNetworkSessionPeer::SetWebSocketStreamFactory(
HttpStreamFactory* http_stream_factory) {
- session_->websocket_stream_factory_.reset(http_stream_factory);
+ session_->websocket_handshake_stream_factory_.reset(http_stream_factory);
}
} // namespace net
diff --git a/net/http/http_network_session_peer.h b/net/http/http_network_session_peer.h
index eeccfef..ebe1af1 100644
--- a/net/http/http_network_session_peer.h
+++ b/net/http/http_network_session_peer.h
@@ -27,7 +27,8 @@ class NET_EXPORT_PRIVATE HttpNetworkSessionPeer {
void SetProxyService(ProxyService* proxy_service);
void SetHttpStreamFactory(HttpStreamFactory* http_stream_factory);
- void SetWebSocketStreamFactory(HttpStreamFactory* websocket_stream_factory);
+ void SetWebSocketStreamFactory(
+ HttpStreamFactory* websocket_handshake_stream_factory);
private:
const scoped_refptr<HttpNetworkSession> session_;
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 95b9a48..fcad53a 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -447,10 +447,10 @@ void HttpNetworkTransaction::OnStreamReady(const SSLConfig& used_ssl_config,
OnIOComplete(OK);
}
-void HttpNetworkTransaction::OnWebSocketStreamReady(
+void HttpNetworkTransaction::OnWebSocketHandshakeStreamReady(
const SSLConfig& used_ssl_config,
const ProxyInfo& used_proxy_info,
- WebSocketStreamBase* stream) {
+ WebSocketHandshakeStreamBase* stream) {
NOTREACHED() << "This function should never be called.";
}
diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h
index 1c584ed..b0950a2 100644
--- a/net/http/http_network_transaction.h
+++ b/net/http/http_network_transaction.h
@@ -73,10 +73,10 @@ class NET_EXPORT_PRIVATE HttpNetworkTransaction
virtual void OnStreamReady(const SSLConfig& used_ssl_config,
const ProxyInfo& used_proxy_info,
HttpStreamBase* stream) OVERRIDE;
- virtual void OnWebSocketStreamReady(
+ virtual void OnWebSocketHandshakeStreamReady(
const SSLConfig& used_ssl_config,
const ProxyInfo& used_proxy_info,
- WebSocketStreamBase* stream) OVERRIDE;
+ WebSocketHandshakeStreamBase* stream) OVERRIDE;
virtual void OnStreamFailed(int status,
const SSLConfig& used_ssl_config) OVERRIDE;
virtual void OnCertificateError(int status,
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index aee02b2..7846028 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -12032,13 +12032,13 @@ class FakeStreamFactory : public HttpStreamFactory {
return fake_request;
}
- virtual HttpStreamRequest* RequestWebSocketStream(
+ virtual HttpStreamRequest* RequestWebSocketHandshakeStream(
const HttpRequestInfo& info,
RequestPriority priority,
const SSLConfig& server_ssl_config,
const SSLConfig& proxy_ssl_config,
HttpStreamRequest::Delegate* delegate,
- WebSocketStreamBase::Factory* factory,
+ WebSocketHandshakeStreamBase::Factory* factory,
const BoundNetLog& net_log) OVERRIDE {
ADD_FAILURE();
return NULL;
diff --git a/net/http/http_stream_base.h b/net/http/http_stream_base.h
index 596ed75..f973f01 100644
--- a/net/http/http_stream_base.h
+++ b/net/http/http_stream_base.h
@@ -5,7 +5,7 @@
// HttpStreamBase is an interface for reading and writing data to an
// HTTP-like stream that keeps the client agnostic of the actual underlying
// transport layer. This provides an abstraction for HttpStream and
-// WebSocketStream.
+// WebSocketHandshakeStreamBase.
#ifndef NET_HTTP_HTTP_STREAM_BASE_H_
#define NET_HTTP_HTTP_STREAM_BASE_H_
diff --git a/net/http/http_stream_factory.h b/net/http/http_stream_factory.h
index 2e83b10..d3f9686 100644
--- a/net/http/http_stream_factory.h
+++ b/net/http/http_stream_factory.h
@@ -21,7 +21,7 @@
// This file can be included from net/http even though
// it is in net/websockets because it doesn't
// introduce any link dependency to net/websockets.
-#include "net/websockets/websocket_stream_base.h"
+#include "net/websockets/websocket_handshake_stream_base.h"
class GURL;
@@ -71,17 +71,17 @@ class NET_EXPORT_PRIVATE HttpStreamRequest {
const ProxyInfo& used_proxy_info,
HttpStreamBase* stream) = 0;
- // This is the success case for RequestWebSocketStream.
+ // This is the success case for RequestWebSocketHandshakeStream.
// |stream| is now owned by the delegate.
// |used_ssl_config| indicates the actual SSL configuration used for this
// stream, since the HttpStreamRequest may have modified the configuration
// during stream processing.
// |used_proxy_info| indicates the actual ProxyInfo used for this stream,
// since the HttpStreamRequest performs the proxy resolution.
- virtual void OnWebSocketStreamReady(
+ virtual void OnWebSocketHandshakeStreamReady(
const SSLConfig& used_ssl_config,
const ProxyInfo& used_proxy_info,
- WebSocketStreamBase* stream) = 0;
+ WebSocketHandshakeStreamBase* stream) = 0;
// This is the failure to create a stream case.
// |used_ssl_config| indicates the actual SSL configuration used for this
@@ -197,15 +197,16 @@ class NET_EXPORT HttpStreamFactory {
HttpStreamRequest::Delegate* delegate,
const BoundNetLog& net_log) = 0;
- // Request a WebSocket stream.
- // Will call delegate->OnWebSocketStreamReady on successful completion.
- virtual HttpStreamRequest* RequestWebSocketStream(
+ // Request a WebSocket handshake stream.
+ // Will call delegate->OnWebSocketHandshakeStreamReady on successful
+ // completion.
+ virtual HttpStreamRequest* RequestWebSocketHandshakeStream(
const HttpRequestInfo& info,
RequestPriority priority,
const SSLConfig& server_ssl_config,
const SSLConfig& proxy_ssl_config,
HttpStreamRequest::Delegate* delegate,
- WebSocketStreamBase::Factory* factory,
+ WebSocketHandshakeStreamBase::Factory* factory,
const BoundNetLog& net_log) = 0;
// Requests that enough connections for |num_streams| be opened.
diff --git a/net/http/http_stream_factory_impl.cc b/net/http/http_stream_factory_impl.cc
index 1d413f5..1d5a826 100644
--- a/net/http/http_stream_factory_impl.cc
+++ b/net/http/http_stream_factory_impl.cc
@@ -82,13 +82,13 @@ HttpStreamRequest* HttpStreamFactoryImpl::RequestStream(
net_log);
}
-HttpStreamRequest* HttpStreamFactoryImpl::RequestWebSocketStream(
+HttpStreamRequest* HttpStreamFactoryImpl::RequestWebSocketHandshakeStream(
const HttpRequestInfo& request_info,
RequestPriority priority,
const SSLConfig& server_ssl_config,
const SSLConfig& proxy_ssl_config,
HttpStreamRequest::Delegate* delegate,
- WebSocketStreamBase::Factory* factory,
+ WebSocketHandshakeStreamBase::Factory* factory,
const BoundNetLog& net_log) {
DCHECK(for_websockets_);
DCHECK(factory);
@@ -107,12 +107,12 @@ HttpStreamRequest* HttpStreamFactoryImpl::RequestStreamInternal(
const SSLConfig& server_ssl_config,
const SSLConfig& proxy_ssl_config,
HttpStreamRequest::Delegate* delegate,
- WebSocketStreamBase::Factory* websocket_stream_factory,
+ WebSocketHandshakeStreamBase::Factory* websocket_handshake_stream_factory,
const BoundNetLog& net_log) {
Request* request = new Request(request_info.url,
this,
delegate,
- websocket_stream_factory,
+ websocket_handshake_stream_factory,
net_log);
GURL alternate_url;
@@ -289,11 +289,11 @@ void HttpStreamFactoryImpl::OnNewSpdySessionReady(
using_spdy,
net_log);
if (for_websockets_) {
- WebSocketStreamBase::Factory* factory =
- request->websocket_stream_factory();
+ WebSocketHandshakeStreamBase::Factory* factory =
+ request->websocket_handshake_stream_factory();
DCHECK(factory);
bool use_relative_url = direct || request->url().SchemeIs("wss");
- request->OnWebSocketStreamReady(
+ request->OnWebSocketHandshakeStreamReady(
NULL,
used_ssl_config,
used_proxy_info,
diff --git a/net/http/http_stream_factory_impl.h b/net/http/http_stream_factory_impl.h
index 4339fd3..e234242 100644
--- a/net/http/http_stream_factory_impl.h
+++ b/net/http/http_stream_factory_impl.h
@@ -30,7 +30,8 @@ class NET_EXPORT_PRIVATE HttpStreamFactoryImpl :
public HttpPipelinedHostPool::Delegate {
public:
// RequestStream may only be called if |for_websockets| is false.
- // RequestWebSocketStream may only be called if |for_websockets| is true.
+ // RequestWebSocketHandshakeStream may only be called if |for_websockets|
+ // is true.
HttpStreamFactoryImpl(HttpNetworkSession* session, bool for_websockets);
virtual ~HttpStreamFactoryImpl();
@@ -43,13 +44,13 @@ class NET_EXPORT_PRIVATE HttpStreamFactoryImpl :
HttpStreamRequest::Delegate* delegate,
const BoundNetLog& net_log) OVERRIDE;
- virtual HttpStreamRequest* RequestWebSocketStream(
+ virtual HttpStreamRequest* RequestWebSocketHandshakeStream(
const HttpRequestInfo& info,
RequestPriority priority,
const SSLConfig& server_ssl_config,
const SSLConfig& proxy_ssl_config,
HttpStreamRequest::Delegate* delegate,
- WebSocketStreamBase::Factory* factory,
+ WebSocketHandshakeStreamBase::Factory* factory,
const BoundNetLog& net_log) OVERRIDE;
virtual void PreconnectStreams(int num_streams,
@@ -84,7 +85,7 @@ class NET_EXPORT_PRIVATE HttpStreamFactoryImpl :
const SSLConfig& server_ssl_config,
const SSLConfig& proxy_ssl_config,
HttpStreamRequest::Delegate* delegate,
- WebSocketStreamBase::Factory* factory,
+ WebSocketHandshakeStreamBase::Factory* factory,
const BoundNetLog& net_log);
PortAlternateProtocolPair GetAlternateProtocolRequestFor(
diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc
index cd04339..500c737 100644
--- a/net/http/http_stream_factory_impl_job.cc
+++ b/net/http/http_stream_factory_impl_job.cc
@@ -221,9 +221,9 @@ void HttpStreamFactoryImpl::Job::Orphan(const Request* request) {
connection_->socket()->Disconnect();
stream_factory_->OnOrphanedJobComplete(this);
} else if (stream_factory_->for_websockets_) {
- // We cancel this job because WebSocketStream can't be created
- // without a WebSocketStreamBase::Factory which is stored in Request class
- // and isn't accessible from this job.
+ // We cancel this job because a WebSocketHandshakeStream can't be created
+ // without a WebSocketHandshakeStreamBase::Factory which is stored in the
+ // Request class and isn't accessible from this job.
if (connection_ && connection_->socket())
connection_->socket()->Disconnect();
stream_factory_->OnOrphanedJobComplete(this);
@@ -314,7 +314,7 @@ void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() {
// |this| may be deleted after this call.
}
-void HttpStreamFactoryImpl::Job::OnWebSocketStreamReadyCallback() {
+void HttpStreamFactoryImpl::Job::OnWebSocketHandshakeStreamReadyCallback() {
DCHECK(websocket_stream_);
DCHECK(!IsPreconnecting());
DCHECK(stream_factory_->for_websockets_);
@@ -325,10 +325,10 @@ void HttpStreamFactoryImpl::Job::OnWebSocketStreamReadyCallback() {
protocol_negotiated(),
using_spdy(),
net_log_);
- request_->OnWebSocketStreamReady(this,
- server_ssl_config_,
- proxy_info_,
- websocket_stream_.release());
+ request_->OnWebSocketHandshakeStreamReady(this,
+ server_ssl_config_,
+ proxy_info_,
+ websocket_stream_.release());
// |this| may be deleted after this call.
}
@@ -532,9 +532,8 @@ int HttpStreamFactoryImpl::Job::RunLoop(int result) {
DCHECK(websocket_stream_);
base::MessageLoop::current()->PostTask(
FROM_HERE,
- base::Bind(
- &Job::OnWebSocketStreamReadyCallback,
- ptr_factory_.GetWeakPtr()));
+ base::Bind(&Job::OnWebSocketHandshakeStreamReadyCallback,
+ ptr_factory_.GetWeakPtr()));
} else {
DCHECK(stream_.get());
base::MessageLoop::current()->PostTask(
@@ -1065,9 +1064,9 @@ int HttpStreamFactoryImpl::Job::DoCreateStream() {
CHECK(stream_.get());
} else if (stream_factory_->for_websockets_) {
DCHECK(request_);
- DCHECK(request_->websocket_stream_factory());
+ DCHECK(request_->websocket_handshake_stream_factory());
websocket_stream_.reset(
- request_->websocket_stream_factory()->CreateBasicStream(
+ request_->websocket_handshake_stream_factory()->CreateBasicStream(
connection_.release(), using_proxy));
} else if (!using_proxy && IsRequestEligibleForPipelining()) {
// TODO(simonjam): Support proxies.
@@ -1142,10 +1141,10 @@ int HttpStreamFactoryImpl::Job::DoCreateStream() {
if (stream_factory_->for_websockets_) {
DCHECK(request_);
- DCHECK(request_->websocket_stream_factory());
+ DCHECK(request_->websocket_handshake_stream_factory());
bool use_relative_url = direct || request_info_.url.SchemeIs("wss");
websocket_stream_.reset(
- request_->websocket_stream_factory()->CreateSpdyStream(
+ request_->websocket_handshake_stream_factory()->CreateSpdyStream(
spdy_session, use_relative_url));
} else {
bool use_relative_url = direct || request_info_.url.SchemeIs("https");
diff --git a/net/http/http_stream_factory_impl_job.h b/net/http/http_stream_factory_impl_job.h
index 01a794a..1970b5b 100644
--- a/net/http/http_stream_factory_impl_job.h
+++ b/net/http/http_stream_factory_impl_job.h
@@ -130,7 +130,7 @@ class HttpStreamFactoryImpl::Job {
};
void OnStreamReadyCallback();
- void OnWebSocketStreamReadyCallback();
+ void OnWebSocketHandshakeStreamReadyCallback();
// This callback function is called when a new SPDY session is created.
void OnNewSpdySessionReadyCallback();
void OnStreamFailedCallback(int result);
@@ -297,7 +297,7 @@ class HttpStreamFactoryImpl::Job {
bool establishing_tunnel_;
scoped_ptr<HttpStream> stream_;
- scoped_ptr<WebSocketStreamBase> websocket_stream_;
+ scoped_ptr<WebSocketHandshakeStreamBase> websocket_stream_;
// True if we negotiated NPN.
bool was_npn_negotiated_;
diff --git a/net/http/http_stream_factory_impl_request.cc b/net/http/http_stream_factory_impl_request.cc
index 57190ed..ea4ca9b 100644
--- a/net/http/http_stream_factory_impl_request.cc
+++ b/net/http/http_stream_factory_impl_request.cc
@@ -17,11 +17,11 @@ HttpStreamFactoryImpl::Request::Request(
const GURL& url,
HttpStreamFactoryImpl* factory,
HttpStreamRequest::Delegate* delegate,
- WebSocketStreamBase::Factory* websocket_stream_factory,
+ WebSocketHandshakeStreamBase::Factory* websocket_handshake_stream_factory,
const BoundNetLog& net_log)
: url_(url),
factory_(factory),
- websocket_stream_factory_(websocket_stream_factory),
+ websocket_handshake_stream_factory_(websocket_handshake_stream_factory),
delegate_(delegate),
net_log_(net_log),
completed_(false),
@@ -110,17 +110,18 @@ void HttpStreamFactoryImpl::Request::OnStreamReady(
delegate_->OnStreamReady(used_ssl_config, used_proxy_info, stream);
}
-void HttpStreamFactoryImpl::Request::OnWebSocketStreamReady(
+void HttpStreamFactoryImpl::Request::OnWebSocketHandshakeStreamReady(
Job* job,
const SSLConfig& used_ssl_config,
const ProxyInfo& used_proxy_info,
- WebSocketStreamBase* stream) {
+ WebSocketHandshakeStreamBase* stream) {
DCHECK(factory_->for_websockets_);
DCHECK(stream);
DCHECK(completed_);
OnJobSucceeded(job);
- delegate_->OnWebSocketStreamReady(used_ssl_config, used_proxy_info, stream);
+ delegate_->OnWebSocketHandshakeStreamReady(
+ used_ssl_config, used_proxy_info, stream);
}
void HttpStreamFactoryImpl::Request::OnStreamFailed(
@@ -315,13 +316,13 @@ void HttpStreamFactoryImpl::Request::OnNewSpdySessionReady(
// Cache this so we can still use it if the request is deleted.
HttpStreamFactoryImpl* factory = factory_;
if (factory->for_websockets_) {
- DCHECK(websocket_stream_factory_);
+ DCHECK(websocket_handshake_stream_factory_);
bool use_relative_url = direct || url().SchemeIs("wss");
- delegate_->OnWebSocketStreamReady(
+ delegate_->OnWebSocketHandshakeStreamReady(
job->server_ssl_config(),
job->proxy_info(),
- websocket_stream_factory_->CreateSpdyStream(spdy_session,
- use_relative_url));
+ websocket_handshake_stream_factory_->CreateSpdyStream(
+ spdy_session, use_relative_url));
} else {
bool use_relative_url = direct || url().SchemeIs("https");
delegate_->OnStreamReady(
diff --git a/net/http/http_stream_factory_impl_request.h b/net/http/http_stream_factory_impl_request.h
index d6f9b02..a8a3c7d 100644
--- a/net/http/http_stream_factory_impl_request.h
+++ b/net/http/http_stream_factory_impl_request.h
@@ -20,11 +20,12 @@ class SpdySession;
class HttpStreamFactoryImpl::Request : public HttpStreamRequest {
public:
- Request(const GURL& url,
- HttpStreamFactoryImpl* factory,
- HttpStreamRequest::Delegate* delegate,
- WebSocketStreamBase::Factory* websocket_stream_factory,
- const BoundNetLog& net_log);
+ Request(
+ const GURL& url,
+ HttpStreamFactoryImpl* factory,
+ HttpStreamRequest::Delegate* delegate,
+ WebSocketHandshakeStreamBase::Factory* websocket_handshake_stream_factory,
+ const BoundNetLog& net_log);
virtual ~Request();
// The GURL from the HttpRequestInfo the started the Request.
@@ -66,8 +67,8 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest {
const base::WeakPtr<SpdySession>& spdy_session,
bool direct);
- WebSocketStreamBase::Factory* websocket_stream_factory() {
- return websocket_stream_factory_;
+ WebSocketHandshakeStreamBase::Factory* websocket_handshake_stream_factory() {
+ return websocket_handshake_stream_factory_;
}
// HttpStreamRequest::Delegate methods which we implement. Note we don't
@@ -77,10 +78,10 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest {
const SSLConfig& used_ssl_config,
const ProxyInfo& used_proxy_info,
HttpStreamBase* stream);
- void OnWebSocketStreamReady(Job* job,
- const SSLConfig& used_ssl_config,
- const ProxyInfo& used_proxy_info,
- WebSocketStreamBase* stream);
+ void OnWebSocketHandshakeStreamReady(Job* job,
+ const SSLConfig& used_ssl_config,
+ const ProxyInfo& used_proxy_info,
+ WebSocketHandshakeStreamBase* stream);
void OnStreamFailed(Job* job, int status, const SSLConfig& used_ssl_config);
void OnCertificateError(Job* job,
int status,
@@ -124,7 +125,8 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest {
const GURL url_;
HttpStreamFactoryImpl* const factory_;
- WebSocketStreamBase::Factory* const websocket_stream_factory_;
+ WebSocketHandshakeStreamBase::Factory* const
+ websocket_handshake_stream_factory_;
HttpStreamRequest::Delegate* const delegate_;
const BoundNetLog net_log_;
diff --git a/net/http/http_stream_factory_impl_request_unittest.cc b/net/http/http_stream_factory_impl_request_unittest.cc
index 5e96c3a..b3b12bf 100644
--- a/net/http/http_stream_factory_impl_request_unittest.cc
+++ b/net/http/http_stream_factory_impl_request_unittest.cc
@@ -36,10 +36,10 @@ class DoNothingRequestDelegate : public HttpStreamRequest::Delegate {
const SSLConfig& used_ssl_config,
const ProxyInfo& used_proxy_info,
HttpStreamBase* stream) OVERRIDE {}
- virtual void OnWebSocketStreamReady(
+ virtual void OnWebSocketHandshakeStreamReady(
const SSLConfig& used_ssl_config,
const ProxyInfo& used_proxy_info,
- WebSocketStreamBase* stream) OVERRIDE {}
+ WebSocketHandshakeStreamBase* stream) OVERRIDE {}
virtual void OnStreamFailed(
int status,
const SSLConfig& used_ssl_config) OVERRIDE {}
diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc
index b5c772e..0cf9e69 100644
--- a/net/http/http_stream_factory_impl_unittest.cc
+++ b/net/http/http_stream_factory_impl_unittest.cc
@@ -36,7 +36,7 @@
// This file can be included from net/http even though
// it is in net/websockets because it doesn't
// introduce any link dependency to net/websockets.
-#include "net/websockets/websocket_stream_base.h"
+#include "net/websockets/websocket_handshake_stream_base.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
@@ -57,7 +57,7 @@ class UseAlternateProtocolsScopedSetter {
bool use_alternate_protocols_;
};
-class MockWebSocketHandshakeStream : public WebSocketStreamBase {
+class MockWebSocketHandshakeStream : public WebSocketHandshakeStreamBase {
public:
enum StreamType {
kStreamTypeBasic,
@@ -112,6 +112,10 @@ class MockWebSocketHandshakeStream : public WebSocketStreamBase {
virtual void Drain(HttpNetworkSession* session) OVERRIDE {}
virtual void SetPriority(RequestPriority priority) OVERRIDE {}
+ virtual scoped_ptr<WebSocketStream> Upgrade() OVERRIDE {
+ return scoped_ptr<WebSocketStream>();
+ }
+
private:
const StreamType type_;
};
@@ -166,9 +170,10 @@ class StreamRequestWaiter : public HttpStreamRequest::Delegate {
used_proxy_info_ = used_proxy_info;
}
- virtual void OnWebSocketStreamReady(const SSLConfig& used_ssl_config,
- const ProxyInfo& used_proxy_info,
- WebSocketStreamBase* stream) OVERRIDE {
+ virtual void OnWebSocketHandshakeStreamReady(
+ const SSLConfig& used_ssl_config,
+ const ProxyInfo& used_proxy_info,
+ WebSocketHandshakeStreamBase* stream) OVERRIDE {
stream_done_ = true;
if (waiting_for_stream_)
base::MessageLoop::current()->Quit();
@@ -229,7 +234,7 @@ class StreamRequestWaiter : public HttpStreamRequest::Delegate {
bool waiting_for_stream_;
bool stream_done_;
scoped_ptr<HttpStreamBase> stream_;
- scoped_ptr<WebSocketStreamBase> websocket_stream_;
+ scoped_ptr<WebSocketHandshakeStreamBase> websocket_stream_;
SSLConfig used_ssl_config_;
ProxyInfo used_proxy_info_;
@@ -267,16 +272,17 @@ class WebSocketBasicHandshakeStream : public MockWebSocketHandshakeStream {
scoped_ptr<ClientSocketHandle> connection_;
};
-class WebSocketStreamFactory : public WebSocketStreamBase::Factory {
+class WebSocketStreamFactory : public WebSocketHandshakeStreamBase::Factory {
public:
virtual ~WebSocketStreamFactory() {}
- virtual WebSocketStreamBase* CreateBasicStream(ClientSocketHandle* connection,
- bool using_proxy) OVERRIDE {
+ virtual WebSocketHandshakeStreamBase* CreateBasicStream(
+ ClientSocketHandle* connection,
+ bool using_proxy) OVERRIDE {
return new WebSocketBasicHandshakeStream(connection);
}
- virtual WebSocketStreamBase* CreateSpdyStream(
+ virtual WebSocketHandshakeStreamBase* CreateSpdyStream(
const base::WeakPtr<SpdySession>& spdy_session,
bool use_relative_url) OVERRIDE {
return new WebSocketSpdyHandshakeStream(spdy_session);
@@ -926,14 +932,14 @@ TEST_P(HttpStreamFactoryTest, RequestWebSocketBasicHandshakeStream) {
StreamRequestWaiter waiter;
WebSocketStreamFactory factory;
scoped_ptr<HttpStreamRequest> request(
- session->websocket_stream_factory()->RequestWebSocketStream(
- request_info,
- DEFAULT_PRIORITY,
- ssl_config,
- ssl_config,
- &waiter,
- &factory,
- BoundNetLog()));
+ session->websocket_handshake_stream_factory()
+ ->RequestWebSocketHandshakeStream(request_info,
+ DEFAULT_PRIORITY,
+ ssl_config,
+ ssl_config,
+ &waiter,
+ &factory,
+ BoundNetLog()));
waiter.WaitForStream();
EXPECT_TRUE(waiter.stream_done());
EXPECT_TRUE(NULL == waiter.stream());
@@ -977,14 +983,14 @@ TEST_P(HttpStreamFactoryTest, RequestWebSocketBasicHandshakeStreamOverSSL) {
StreamRequestWaiter waiter;
WebSocketStreamFactory factory;
scoped_ptr<HttpStreamRequest> request(
- session->websocket_stream_factory()->RequestWebSocketStream(
- request_info,
- DEFAULT_PRIORITY,
- ssl_config,
- ssl_config,
- &waiter,
- &factory,
- BoundNetLog()));
+ session->websocket_handshake_stream_factory()
+ ->RequestWebSocketHandshakeStream(request_info,
+ DEFAULT_PRIORITY,
+ ssl_config,
+ ssl_config,
+ &waiter,
+ &factory,
+ BoundNetLog()));
waiter.WaitForStream();
EXPECT_TRUE(waiter.stream_done());
EXPECT_TRUE(NULL == waiter.stream());
@@ -1025,14 +1031,14 @@ TEST_P(HttpStreamFactoryTest, RequestWebSocketBasicHandshakeStreamOverProxy) {
StreamRequestWaiter waiter;
WebSocketStreamFactory factory;
scoped_ptr<HttpStreamRequest> request(
- session->websocket_stream_factory()->RequestWebSocketStream(
- request_info,
- DEFAULT_PRIORITY,
- ssl_config,
- ssl_config,
- &waiter,
- &factory,
- BoundNetLog()));
+ session->websocket_handshake_stream_factory()
+ ->RequestWebSocketHandshakeStream(request_info,
+ DEFAULT_PRIORITY,
+ ssl_config,
+ ssl_config,
+ &waiter,
+ &factory,
+ BoundNetLog()));
waiter.WaitForStream();
EXPECT_TRUE(waiter.stream_done());
EXPECT_TRUE(NULL == waiter.stream());
@@ -1139,14 +1145,14 @@ TEST_P(HttpStreamFactoryTest, RequestWebSocketSpdyHandshakeStream) {
StreamRequestWaiter waiter1;
WebSocketStreamFactory factory;
scoped_ptr<HttpStreamRequest> request1(
- session->websocket_stream_factory()->RequestWebSocketStream(
- request_info,
- DEFAULT_PRIORITY,
- ssl_config,
- ssl_config,
- &waiter1,
- &factory,
- BoundNetLog()));
+ session->websocket_handshake_stream_factory()
+ ->RequestWebSocketHandshakeStream(request_info,
+ DEFAULT_PRIORITY,
+ ssl_config,
+ ssl_config,
+ &waiter1,
+ &factory,
+ BoundNetLog()));
waiter1.WaitForStream();
EXPECT_TRUE(waiter1.stream_done());
ASSERT_TRUE(NULL != waiter1.websocket_stream());
@@ -1156,14 +1162,14 @@ TEST_P(HttpStreamFactoryTest, RequestWebSocketSpdyHandshakeStream) {
StreamRequestWaiter waiter2;
scoped_ptr<HttpStreamRequest> request2(
- session->websocket_stream_factory()->RequestWebSocketStream(
- request_info,
- DEFAULT_PRIORITY,
- ssl_config,
- ssl_config,
- &waiter2,
- &factory,
- BoundNetLog()));
+ session->websocket_handshake_stream_factory()
+ ->RequestWebSocketHandshakeStream(request_info,
+ DEFAULT_PRIORITY,
+ ssl_config,
+ ssl_config,
+ &waiter2,
+ &factory,
+ BoundNetLog()));
waiter2.WaitForStream();
EXPECT_TRUE(waiter2.stream_done());
ASSERT_TRUE(NULL != waiter2.websocket_stream());
@@ -1229,14 +1235,14 @@ TEST_P(HttpStreamFactoryTest, OrphanedWebSocketStream) {
StreamRequestWaiter waiter;
WebSocketStreamFactory factory;
scoped_ptr<HttpStreamRequest> request(
- session->websocket_stream_factory()->RequestWebSocketStream(
- request_info,
- DEFAULT_PRIORITY,
- ssl_config,
- ssl_config,
- &waiter,
- &factory,
- BoundNetLog()));
+ session->websocket_handshake_stream_factory()
+ ->RequestWebSocketHandshakeStream(request_info,
+ DEFAULT_PRIORITY,
+ ssl_config,
+ ssl_config,
+ &waiter,
+ &factory,
+ BoundNetLog()));
waiter.WaitForStream();
EXPECT_TRUE(waiter.stream_done());
EXPECT_TRUE(NULL == waiter.stream());
@@ -1259,7 +1265,7 @@ TEST_P(HttpStreamFactoryTest, OrphanedWebSocketStream) {
// Make sure there is no orphaned job. it is already canceled.
ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>(
- session->websocket_stream_factory())->num_orphaned_jobs());
+ session->websocket_handshake_stream_factory())->num_orphaned_jobs());
}
} // namespace