Index: net/spdy/spdy_websocket_stream_spdy2_unittest.cc |
=================================================================== |
--- net/spdy/spdy_websocket_stream_spdy2_unittest.cc (revision 124690) |
+++ net/spdy/spdy_websocket_stream_spdy2_unittest.cc (working copy) |
@@ -14,10 +14,12 @@ |
#include "net/spdy/spdy_http_utils.h" |
#include "net/spdy/spdy_protocol.h" |
#include "net/spdy/spdy_session.h" |
-#include "net/spdy/spdy_test_util.h" |
-#include "net/spdy/spdy_websocket_test_util.h" |
+#include "net/spdy/spdy_test_util_spdy2.h" |
+#include "net/spdy/spdy_websocket_test_util_spdy2.h" |
#include "testing/gtest/include/gtest/gtest.h" |
+using namespace net::test_spdy2; |
+ |
namespace { |
struct SpdyWebSocketStreamEvent { |
@@ -48,6 +50,8 @@ |
namespace net { |
+namespace { |
+ |
class SpdyWebSocketStreamEventRecorder : public SpdyWebSocketStream::Delegate { |
public: |
explicit SpdyWebSocketStreamEventRecorder(const CompletionCallback& callback) |
@@ -157,7 +161,9 @@ |
DISALLOW_COPY_AND_ASSIGN(SpdyWebSocketStreamEventRecorder); |
}; |
-class SpdyWebSocketStreamTest : public testing::Test { |
+} // namespace |
+ |
+class SpdyWebSocketStreamSpdy2Test : public testing::Test { |
public: |
OrderedSocketData* data() { return data_.get(); } |
@@ -178,8 +184,8 @@ |
} |
protected: |
- SpdyWebSocketStreamTest() {} |
- virtual ~SpdyWebSocketStreamTest() {} |
+ SpdyWebSocketStreamSpdy2Test() {} |
+ virtual ~SpdyWebSocketStreamSpdy2Test() {} |
virtual void SetUp() { |
EnableCompression(false); |
@@ -311,14 +317,14 @@ |
static const size_t kClosingFrameLength; |
}; |
-const char SpdyWebSocketStreamTest::kMessageFrame[] = "\0hello\xff"; |
-const char SpdyWebSocketStreamTest::kClosingFrame[] = "\xff\0"; |
-const size_t SpdyWebSocketStreamTest::kMessageFrameLength = |
- arraysize(SpdyWebSocketStreamTest::kMessageFrame) - 1; |
-const size_t SpdyWebSocketStreamTest::kClosingFrameLength = |
- arraysize(SpdyWebSocketStreamTest::kClosingFrame) - 1; |
+const char SpdyWebSocketStreamSpdy2Test::kMessageFrame[] = "\0hello\xff"; |
+const char SpdyWebSocketStreamSpdy2Test::kClosingFrame[] = "\xff\0"; |
+const size_t SpdyWebSocketStreamSpdy2Test::kMessageFrameLength = |
+ arraysize(SpdyWebSocketStreamSpdy2Test::kMessageFrame) - 1; |
+const size_t SpdyWebSocketStreamSpdy2Test::kClosingFrameLength = |
+ arraysize(SpdyWebSocketStreamSpdy2Test::kClosingFrame) - 1; |
-TEST_F(SpdyWebSocketStreamTest, Basic) { |
+TEST_F(SpdyWebSocketStreamSpdy2Test, Basic) { |
Prepare(1); |
MockWrite writes[] = { |
CreateMockWrite(*request_frame_.get(), 1), |
@@ -339,10 +345,10 @@ |
SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback()); |
delegate.SetOnReceivedHeader( |
- base::Bind(&SpdyWebSocketStreamTest::DoSendHelloFrame, |
+ base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendHelloFrame, |
base::Unretained(this))); |
delegate.SetOnReceivedData( |
- base::Bind(&SpdyWebSocketStreamTest::DoSendClosingFrame, |
+ base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendClosingFrame, |
base::Unretained(this))); |
websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate)); |
@@ -393,7 +399,7 @@ |
EXPECT_TRUE(data()->at_write_eof()); |
} |
-TEST_F(SpdyWebSocketStreamTest, DestructionBeforeClose) { |
+TEST_F(SpdyWebSocketStreamSpdy2Test, DestructionBeforeClose) { |
Prepare(1); |
MockWrite writes[] = { |
CreateMockWrite(*request_frame_.get(), 1), |
@@ -411,10 +417,11 @@ |
SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback()); |
delegate.SetOnReceivedHeader( |
- base::Bind(&SpdyWebSocketStreamTest::DoSendHelloFrame, |
+ base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendHelloFrame, |
base::Unretained(this))); |
delegate.SetOnReceivedData( |
- base::Bind(&SpdyWebSocketStreamTest::DoSync, base::Unretained(this))); |
+ base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSync, |
+ base::Unretained(this))); |
websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate)); |
@@ -454,7 +461,7 @@ |
EXPECT_TRUE(data()->at_write_eof()); |
} |
-TEST_F(SpdyWebSocketStreamTest, DestructionAfterExplicitClose) { |
+TEST_F(SpdyWebSocketStreamSpdy2Test, DestructionAfterExplicitClose) { |
Prepare(1); |
MockWrite writes[] = { |
CreateMockWrite(*request_frame_.get(), 1), |
@@ -473,10 +480,11 @@ |
SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback()); |
delegate.SetOnReceivedHeader( |
- base::Bind(&SpdyWebSocketStreamTest::DoSendHelloFrame, |
+ base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendHelloFrame, |
base::Unretained(this))); |
delegate.SetOnReceivedData( |
- base::Bind(&SpdyWebSocketStreamTest::DoClose, base::Unretained(this))); |
+ base::Bind(&SpdyWebSocketStreamSpdy2Test::DoClose, |
+ base::Unretained(this))); |
websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate)); |
@@ -514,7 +522,7 @@ |
host_port_proxy_pair_)); |
} |
-TEST_F(SpdyWebSocketStreamTest, IOPending) { |
+TEST_F(SpdyWebSocketStreamSpdy2Test, IOPending) { |
Prepare(3); |
scoped_ptr<spdy::SpdyFrame> settings_frame( |
ConstructSpdySettings(spdy_settings_to_send_)); |
@@ -553,12 +561,13 @@ |
// Create a WebSocketStream under test. |
SpdyWebSocketStreamEventRecorder delegate(completion_callback_.callback()); |
delegate.SetOnCreated( |
- base::Bind(&SpdyWebSocketStreamTest::DoSync, base::Unretained(this))); |
+ base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSync, |
+ base::Unretained(this))); |
delegate.SetOnReceivedHeader( |
- base::Bind(&SpdyWebSocketStreamTest::DoSendHelloFrame, |
+ base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendHelloFrame, |
base::Unretained(this))); |
delegate.SetOnReceivedData( |
- base::Bind(&SpdyWebSocketStreamTest::DoSendClosingFrame, |
+ base::Bind(&SpdyWebSocketStreamSpdy2Test::DoSendClosingFrame, |
base::Unretained(this))); |
websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate)); |