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

Unified Diff: net/spdy/spdy_websocket_stream_spdy3_unittest.cc

Issue 9582034: Fork SPDY/2 and SPDY/3 versions of our SPDY tests, in preparation for landing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix merge bug Created 8 years, 10 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 | « net/spdy/spdy_websocket_stream_spdy2_unittest.cc ('k') | net/spdy/spdy_websocket_stream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_websocket_stream_spdy3_unittest.cc
===================================================================
--- net/spdy/spdy_websocket_stream_spdy3_unittest.cc (revision 124690)
+++ net/spdy/spdy_websocket_stream_spdy3_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_spdy3.h"
+#include "net/spdy/spdy_websocket_test_util_spdy3.h"
#include "testing/gtest/include/gtest/gtest.h"
+using namespace net::test_spdy3;
+
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 SpdyWebSocketStreamSpdy3Test : public testing::Test {
public:
OrderedSocketData* data() { return data_.get(); }
@@ -178,8 +184,8 @@
}
protected:
- SpdyWebSocketStreamTest() {}
- virtual ~SpdyWebSocketStreamTest() {}
+ SpdyWebSocketStreamSpdy3Test() {}
+ virtual ~SpdyWebSocketStreamSpdy3Test() {}
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 SpdyWebSocketStreamSpdy3Test::kMessageFrame[] = "\0hello\xff";
+const char SpdyWebSocketStreamSpdy3Test::kClosingFrame[] = "\xff\0";
+const size_t SpdyWebSocketStreamSpdy3Test::kMessageFrameLength =
+ arraysize(SpdyWebSocketStreamSpdy3Test::kMessageFrame) - 1;
+const size_t SpdyWebSocketStreamSpdy3Test::kClosingFrameLength =
+ arraysize(SpdyWebSocketStreamSpdy3Test::kClosingFrame) - 1;
-TEST_F(SpdyWebSocketStreamTest, Basic) {
+TEST_F(SpdyWebSocketStreamSpdy3Test, 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(&SpdyWebSocketStreamSpdy3Test::DoSendHelloFrame,
base::Unretained(this)));
delegate.SetOnReceivedData(
- base::Bind(&SpdyWebSocketStreamTest::DoSendClosingFrame,
+ base::Bind(&SpdyWebSocketStreamSpdy3Test::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(SpdyWebSocketStreamSpdy3Test, 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(&SpdyWebSocketStreamSpdy3Test::DoSendHelloFrame,
base::Unretained(this)));
delegate.SetOnReceivedData(
- base::Bind(&SpdyWebSocketStreamTest::DoSync, base::Unretained(this)));
+ base::Bind(&SpdyWebSocketStreamSpdy3Test::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(SpdyWebSocketStreamSpdy3Test, 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(&SpdyWebSocketStreamSpdy3Test::DoSendHelloFrame,
base::Unretained(this)));
delegate.SetOnReceivedData(
- base::Bind(&SpdyWebSocketStreamTest::DoClose, base::Unretained(this)));
+ base::Bind(&SpdyWebSocketStreamSpdy3Test::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(SpdyWebSocketStreamSpdy3Test, 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(&SpdyWebSocketStreamSpdy3Test::DoSync,
+ base::Unretained(this)));
delegate.SetOnReceivedHeader(
- base::Bind(&SpdyWebSocketStreamTest::DoSendHelloFrame,
+ base::Bind(&SpdyWebSocketStreamSpdy3Test::DoSendHelloFrame,
base::Unretained(this)));
delegate.SetOnReceivedData(
- base::Bind(&SpdyWebSocketStreamTest::DoSendClosingFrame,
+ base::Bind(&SpdyWebSocketStreamSpdy3Test::DoSendClosingFrame,
base::Unretained(this)));
websocket_stream_.reset(new SpdyWebSocketStream(session_, &delegate));
« no previous file with comments | « net/spdy/spdy_websocket_stream_spdy2_unittest.cc ('k') | net/spdy/spdy_websocket_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698