| Index: net/http/http_cache_unittest.cc
|
| diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
|
| index 67f8d988f68dd572f637e79f2610fd76e59fbeae..29066804daff939b08b2a3f9df265dc1fd7e9085 100644
|
| --- a/net/http/http_cache_unittest.cc
|
| +++ b/net/http/http_cache_unittest.cc
|
| @@ -32,6 +32,7 @@
|
| #include "net/http/http_util.h"
|
| #include "net/http/mock_http_cache.h"
|
| #include "net/ssl/ssl_cert_request_info.h"
|
| +#include "net/websockets/websocket_handshake_stream_base.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| using base::Time;
|
| @@ -574,6 +575,21 @@ struct Context {
|
| scoped_ptr<net::HttpTransaction> trans;
|
| };
|
|
|
| +class FakeWebSocketHandshakeStreamCreateHelper
|
| + : public net::WebSocketHandshakeStreamBase::CreateHelper {
|
| + public:
|
| + virtual ~FakeWebSocketHandshakeStreamCreateHelper() {}
|
| + virtual net::WebSocketHandshakeStreamBase* CreateBasicStream(
|
| + net::ClientSocketHandle* connect, bool using_proxy) OVERRIDE {
|
| + return NULL;
|
| + }
|
| + virtual net::WebSocketHandshakeStreamBase* CreateSpdyStream(
|
| + const base::WeakPtr<net::SpdySession>& session,
|
| + bool use_relative_url) OVERRIDE {
|
| + return NULL;
|
| + }
|
| +};
|
| +
|
| } // namespace
|
|
|
|
|
| @@ -6298,6 +6314,35 @@ TEST(HttpCache, SetPriority) {
|
| EXPECT_EQ(net::OK, callback.WaitForResult());
|
| }
|
|
|
| +// Make sure that calling SetWebSocketHandshakeStreamCreateHelper on a cache
|
| +// transaction passes on its argument to the underlying network transaction.
|
| +TEST(HttpCache, SetWebSocketHandshakeStreamCreateHelper) {
|
| + MockHttpCache cache;
|
| +
|
| + FakeWebSocketHandshakeStreamCreateHelper create_helper;
|
| + scoped_ptr<net::HttpTransaction> trans;
|
| + EXPECT_EQ(net::OK, cache.http_cache()->CreateTransaction(
|
| + net::IDLE, &trans, NULL));
|
| + ASSERT_TRUE(trans.get());
|
| +
|
| + EXPECT_FALSE(cache.network_layer()->last_transaction());
|
| +
|
| + net::HttpRequestInfo info;
|
| + info.url = GURL(kSimpleGET_Transaction.url);
|
| + net::TestCompletionCallback callback;
|
| + EXPECT_EQ(net::ERR_IO_PENDING,
|
| + trans->Start(&info, callback.callback(), net::BoundNetLog()));
|
| +
|
| + ASSERT_TRUE(cache.network_layer()->last_transaction());
|
| + EXPECT_FALSE(cache.network_layer()->last_transaction()->
|
| + websocket_handshake_stream_create_helper());
|
| + trans->SetWebSocketHandshakeStreamCreateHelper(&create_helper);
|
| + EXPECT_EQ(&create_helper,
|
| + cache.network_layer()->last_transaction()->
|
| + websocket_handshake_stream_create_helper());
|
| + EXPECT_EQ(net::OK, callback.WaitForResult());
|
| +}
|
| +
|
| // Make sure that a cache transaction passes on its priority to
|
| // newly-created network transactions.
|
| TEST(HttpCache, SetPriorityNewTransaction) {
|
|
|