Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(876)

Unified Diff: net/websockets/websocket_job_spdy2_unittest.cc

Issue 14853005: Move static functions in WebSocketJobTest into namespace net (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/websockets/websocket_job_spdy3_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_job_spdy2_unittest.cc
diff --git a/net/websockets/websocket_job_spdy2_unittest.cc b/net/websockets/websocket_job_spdy2_unittest.cc
index 24ca09863b3c76ed52f2c1aae28e48ac5609063b..7825c7775a98cfe0a873712597a039826dce55d7 100644
--- a/net/websockets/websocket_job_spdy2_unittest.cc
+++ b/net/websockets/websocket_job_spdy2_unittest.cc
@@ -38,11 +38,13 @@
using namespace net::test_spdy2;
+namespace net {
+
namespace {
-class MockSocketStream : public net::SocketStream {
+class MockSocketStream : public SocketStream {
public:
- MockSocketStream(const GURL& url, net::SocketStream::Delegate* delegate)
+ MockSocketStream(const GURL& url, SocketStream::Delegate* delegate)
: SocketStream(url, delegate) {}
virtual void Connect() OVERRIDE {}
@@ -53,7 +55,7 @@ class MockSocketStream : public net::SocketStream {
virtual void Close() OVERRIDE {}
virtual void RestartWithAuth(
- const net::AuthCredentials& credentials) OVERRIDE {
+ const AuthCredentials& credentials) OVERRIDE {
}
virtual void DetachDelegate() OVERRIDE {
@@ -71,7 +73,7 @@ class MockSocketStream : public net::SocketStream {
std::string sent_data_;
};
-class MockSocketStreamDelegate : public net::SocketStream::Delegate {
+class MockSocketStreamDelegate : public SocketStream::Delegate {
public:
MockSocketStreamDelegate()
: amount_sent_(0), allow_all_cookies_(true) {}
@@ -97,41 +99,41 @@ class MockSocketStreamDelegate : public net::SocketStream::Delegate {
}
virtual int OnStartOpenConnection(
- net::SocketStream* socket,
- const net::CompletionCallback& callback) OVERRIDE {
+ SocketStream* socket,
+ const CompletionCallback& callback) OVERRIDE {
if (!on_start_open_connection_.is_null())
on_start_open_connection_.Run();
- return net::OK;
+ return OK;
}
- virtual void OnConnected(net::SocketStream* socket,
+ virtual void OnConnected(SocketStream* socket,
int max_pending_send_allowed) OVERRIDE {
if (!on_connected_.is_null())
on_connected_.Run();
}
- virtual void OnSentData(net::SocketStream* socket,
+ virtual void OnSentData(SocketStream* socket,
int amount_sent) OVERRIDE {
amount_sent_ += amount_sent;
if (!on_sent_data_.is_null())
on_sent_data_.Run();
}
- virtual void OnReceivedData(net::SocketStream* socket,
+ virtual void OnReceivedData(SocketStream* socket,
const char* data, int len) OVERRIDE {
received_data_ += std::string(data, len);
if (!on_received_data_.is_null())
on_received_data_.Run();
}
- virtual void OnClose(net::SocketStream* socket) OVERRIDE {
+ virtual void OnClose(SocketStream* socket) OVERRIDE {
if (!on_close_.is_null())
on_close_.Run();
}
- virtual bool CanGetCookies(net::SocketStream* socket,
+ virtual bool CanGetCookies(SocketStream* socket,
const GURL& url) OVERRIDE {
return allow_all_cookies_;
}
- virtual bool CanSetCookie(net::SocketStream* request,
+ virtual bool CanSetCookie(SocketStream* request,
const GURL& url,
const std::string& cookie_line,
- net::CookieOptions* options) OVERRIDE {
+ CookieOptions* options) OVERRIDE {
return allow_all_cookies_;
}
@@ -149,19 +151,19 @@ class MockSocketStreamDelegate : public net::SocketStream::Delegate {
base::Closure on_close_;
};
-class MockCookieStore : public net::CookieStore {
+class MockCookieStore : public CookieStore {
public:
struct Entry {
GURL url;
std::string cookie_line;
- net::CookieOptions options;
+ CookieOptions options;
};
MockCookieStore() {}
bool SetCookieWithOptions(const GURL& url,
const std::string& cookie_line,
- const net::CookieOptions& options) {
+ const CookieOptions& options) {
Entry entry;
entry.url = url;
entry.cookie_line = cookie_line;
@@ -171,7 +173,7 @@ class MockCookieStore : public net::CookieStore {
}
std::string GetCookiesWithOptions(const GURL& url,
- const net::CookieOptions& options) {
+ const CookieOptions& options) {
std::string result;
for (size_t i = 0; i < entries_.size(); i++) {
Entry& entry = entries_[i];
@@ -189,7 +191,7 @@ class MockCookieStore : public net::CookieStore {
virtual void SetCookieWithOptionsAsync(
const GURL& url,
const std::string& cookie_line,
- const net::CookieOptions& options,
+ const CookieOptions& options,
const SetCookiesCallback& callback) OVERRIDE {
bool result = SetCookieWithOptions(url, cookie_line, options);
if (!callback.is_null())
@@ -198,7 +200,7 @@ class MockCookieStore : public net::CookieStore {
virtual void GetCookiesWithOptionsAsync(
const GURL& url,
- const net::CookieOptions& options,
+ const CookieOptions& options,
const GetCookiesCallback& callback) OVERRIDE {
if (!callback.is_null())
callback.Run(GetCookiesWithOptions(url, options));
@@ -221,7 +223,7 @@ class MockCookieStore : public net::CookieStore {
ADD_FAILURE();
}
- virtual net::CookieMonster* GetCookieMonster() OVERRIDE { return NULL; }
+ virtual CookieMonster* GetCookieMonster() OVERRIDE { return NULL; }
const std::vector<Entry>& entries() const { return entries_; }
@@ -232,17 +234,17 @@ class MockCookieStore : public net::CookieStore {
std::vector<Entry> entries_;
};
-class MockSSLConfigService : public net::SSLConfigService {
+class MockSSLConfigService : public SSLConfigService {
public:
- virtual void GetSSLConfig(net::SSLConfig* config) OVERRIDE {}
+ virtual void GetSSLConfig(SSLConfig* config) OVERRIDE {}
protected:
virtual ~MockSSLConfigService() {}
};
-class MockURLRequestContext : public net::URLRequestContext {
+class MockURLRequestContext : public URLRequestContext {
public:
- explicit MockURLRequestContext(net::CookieStore* cookie_store)
+ explicit MockURLRequestContext(CookieStore* cookie_store)
: transport_security_state_() {
set_cookie_store(cookie_store);
set_transport_security_state(&transport_security_state_);
@@ -255,79 +257,77 @@ class MockURLRequestContext : public net::URLRequestContext {
virtual ~MockURLRequestContext() {}
private:
- net::TransportSecurityState transport_security_state_;
+ TransportSecurityState transport_security_state_;
};
-class MockHttpTransactionFactory : public net::HttpTransactionFactory {
+class MockHttpTransactionFactory : public HttpTransactionFactory {
public:
- explicit MockHttpTransactionFactory(net::OrderedSocketData* data) {
+ explicit MockHttpTransactionFactory(OrderedSocketData* data) {
data_ = data;
- net::MockConnect connect_data(net::SYNCHRONOUS, net::OK);
+ MockConnect connect_data(SYNCHRONOUS, OK);
data_->set_connect_data(connect_data);
- session_deps_.reset(new net::SpdySessionDependencies(net::kProtoSPDY2));
+ session_deps_.reset(new SpdySessionDependencies(kProtoSPDY2));
session_deps_->socket_factory->AddSocketDataProvider(data_);
http_session_ =
- net::SpdySessionDependencies::SpdyCreateSession(session_deps_.get());
+ SpdySessionDependencies::SpdyCreateSession(session_deps_.get());
host_port_pair_.set_host("example.com");
host_port_pair_.set_port(80);
host_port_proxy_pair_.first = host_port_pair_;
- host_port_proxy_pair_.second = net::ProxyServer::Direct();
- net::SpdySessionPool* spdy_session_pool =
+ host_port_proxy_pair_.second = ProxyServer::Direct();
+ SpdySessionPool* spdy_session_pool =
http_session_->spdy_session_pool();
DCHECK(spdy_session_pool);
EXPECT_FALSE(spdy_session_pool->HasSession(host_port_proxy_pair_));
session_ =
- spdy_session_pool->Get(host_port_proxy_pair_, net::BoundNetLog());
+ spdy_session_pool->Get(host_port_proxy_pair_, BoundNetLog());
EXPECT_TRUE(spdy_session_pool->HasSession(host_port_proxy_pair_));
transport_params_ =
- new net::TransportSocketParams(host_port_pair_,
- net::MEDIUM,
+ new TransportSocketParams(host_port_pair_,
+ MEDIUM,
false,
false,
- net::OnHostResolutionCallback());
- net::ClientSocketHandle* connection = new net::ClientSocketHandle;
- EXPECT_EQ(net::OK,
+ OnHostResolutionCallback());
+ ClientSocketHandle* connection = new ClientSocketHandle;
+ EXPECT_EQ(OK,
connection->Init(host_port_pair_.ToString(), transport_params_,
- net::MEDIUM, net::CompletionCallback(),
+ MEDIUM, CompletionCallback(),
http_session_->GetTransportSocketPool(
- net::HttpNetworkSession::NORMAL_SOCKET_POOL),
- net::BoundNetLog()));
- EXPECT_EQ(net::OK,
- session_->InitializeWithSocket(connection, false, net::OK));
+ HttpNetworkSession::NORMAL_SOCKET_POOL),
+ BoundNetLog()));
+ EXPECT_EQ(OK,
+ session_->InitializeWithSocket(connection, false, OK));
}
virtual int CreateTransaction(
- net::RequestPriority priority,
- scoped_ptr<net::HttpTransaction>* trans,
- net::HttpTransactionDelegate* delegate) OVERRIDE {
+ RequestPriority priority,
+ scoped_ptr<HttpTransaction>* trans,
+ HttpTransactionDelegate* delegate) OVERRIDE {
NOTREACHED();
- return net::ERR_UNEXPECTED;
+ return ERR_UNEXPECTED;
}
- virtual net::HttpCache* GetCache() OVERRIDE {
+ virtual HttpCache* GetCache() OVERRIDE {
NOTREACHED();
return NULL;
}
- virtual net::HttpNetworkSession* GetSession() OVERRIDE {
+ virtual HttpNetworkSession* GetSession() OVERRIDE {
return http_session_.get();
}
private:
- net::OrderedSocketData* data_;
- scoped_ptr<net::SpdySessionDependencies> session_deps_;
- scoped_refptr<net::HttpNetworkSession> http_session_;
- scoped_refptr<net::TransportSocketParams> transport_params_;
- scoped_refptr<net::SpdySession> session_;
- net::HostPortPair host_port_pair_;
- net::HostPortProxyPair host_port_proxy_pair_;
+ OrderedSocketData* data_;
+ scoped_ptr<SpdySessionDependencies> session_deps_;
+ scoped_refptr<HttpNetworkSession> http_session_;
+ scoped_refptr<TransportSocketParams> transport_params_;
+ scoped_refptr<SpdySession> session_;
+ HostPortPair host_port_pair_;
+ HostPortProxyPair host_port_proxy_pair_;
};
} // namespace
-namespace net {
-
class WebSocketJobSpdy2Test : public PlatformTest {
public:
virtual void SetUp() OVERRIDE {
@@ -388,9 +388,9 @@ class WebSocketJobSpdy2Test : public PlatformTest {
ssl_config_service_ = new MockSSLConfigService();
context_->set_ssl_config_service(ssl_config_service_);
- proxy_service_.reset(net::ProxyService::CreateDirect());
+ proxy_service_.reset(ProxyService::CreateDirect());
context_->set_proxy_service(proxy_service_.get());
- host_resolver_.reset(new net::MockHostResolver);
+ host_resolver_.reset(new MockHostResolver);
context_->set_host_resolver(host_resolver_.get());
socket_ = new SocketStream(url, websocket_.get());
@@ -462,8 +462,8 @@ class WebSocketJobSpdy2Test : public PlatformTest {
scoped_ptr<OrderedSocketData> data_;
TestCompletionCallback sync_test_callback_;
scoped_refptr<MockSSLConfigService> ssl_config_service_;
- scoped_ptr<net::ProxyService> proxy_service_;
- scoped_ptr<net::MockHostResolver> host_resolver_;
+ scoped_ptr<ProxyService> proxy_service_;
+ scoped_ptr<MockHostResolver> host_resolver_;
scoped_ptr<MockHttpTransactionFactory> http_factory_;
static const char kHandshakeRequestWithoutCookie[];
@@ -637,11 +637,11 @@ TEST_F(WebSocketJobSpdy2Test, DelayedCookies) {
context_->set_cookie_store(cookie_store);
cookie_store->SetCookieWithOptionsAsync(
cookieUrl, "CR-test=1", cookie_options,
- net::CookieMonster::SetCookiesCallback());
+ CookieMonster::SetCookiesCallback());
cookie_options.set_include_httponly();
cookie_store->SetCookieWithOptionsAsync(
cookieUrl, "CR-test-httponly=1", cookie_options,
- net::CookieMonster::SetCookiesCallback());
+ CookieMonster::SetCookiesCallback());
MockSocketStreamDelegate delegate;
InitWebSocketJob(url, &delegate, STREAM_MOCK_SOCKET);
« no previous file with comments | « no previous file | net/websockets/websocket_job_spdy3_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698