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

Unified Diff: net/spdy/spdy_framer_test.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
Index: net/spdy/spdy_framer_test.cc
diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc
index 8542835b67fdc00e256998568be205f6c14f5de7..85551639412e4370be15fb542ebf1563c8cdc144 100644
--- a/net/spdy/spdy_framer_test.cc
+++ b/net/spdy/spdy_framer_test.cc
@@ -35,14 +35,16 @@ static const size_t kMaxDecompressedSize = 1024;
class MockDebugVisitor : public SpdyFramerDebugVisitorInterface {
public:
- MOCK_METHOD4(OnSendCompressedFrame, void(SpdyStreamId stream_id,
- SpdyFrameType type,
- size_t payload_len,
- size_t frame_len));
-
- MOCK_METHOD3(OnReceiveCompressedFrame, void(SpdyStreamId stream_id,
- SpdyFrameType type,
- size_t frame_len));
+ MOCK_METHOD4(OnSendCompressedFrame,
+ void(SpdyStreamId stream_id,
+ SpdyFrameType type,
+ size_t payload_len,
+ size_t frame_len));
+
+ MOCK_METHOD3(OnReceiveCompressedFrame,
+ void(SpdyStreamId stream_id,
+ SpdyFrameType type,
+ size_t frame_len));
};
class SpdyFramerTestUtil {
@@ -53,8 +55,9 @@ class SpdyFramerTestUtil {
// well-formed compressed frame.
//
// Returns a new decompressed SpdyFrame.
- template<class SpdyFrameType> static SpdyFrame* DecompressFrame(
- SpdyFramer* framer, const SpdyFrameType& frame) {
+ template <class SpdyFrameType>
+ static SpdyFrame* DecompressFrame(SpdyFramer* framer,
+ const SpdyFrameType& frame) {
DecompressionVisitor visitor(framer->protocol_version());
framer->set_visitor(&visitor);
CHECK_EQ(frame.size(), framer->ProcessInput(frame.data(), frame.size()));
@@ -227,39 +230,38 @@ class TestSpdyVisitor : public SpdyFramerVisitorInterface,
static const size_t kDefaultHeaderBufferSize = 16 * 1024 * 1024;
explicit TestSpdyVisitor(SpdyMajorVersion version)
- : framer_(version),
- use_compression_(false),
- error_count_(0),
- syn_frame_count_(0),
- syn_reply_frame_count_(0),
- headers_frame_count_(0),
- push_promise_frame_count_(0),
- goaway_count_(0),
- setting_count_(0),
- settings_ack_sent_(0),
- settings_ack_received_(0),
- continuation_count_(0),
- last_window_update_stream_(0),
- last_window_update_delta_(0),
- last_push_promise_stream_(0),
- last_push_promise_promised_stream_(0),
- data_bytes_(0),
- fin_frame_count_(0),
- fin_opaque_data_(),
- fin_flag_count_(0),
- zero_length_data_frame_count_(0),
- control_frame_header_data_count_(0),
- zero_length_control_frame_header_data_count_(0),
- data_frame_count_(0),
- last_payload_len_(0),
- last_frame_len_(0),
- header_buffer_(new char[kDefaultHeaderBufferSize]),
- header_buffer_length_(0),
- header_buffer_size_(kDefaultHeaderBufferSize),
- header_stream_id_(-1),
- header_control_type_(DATA),
- header_buffer_valid_(false) {
- }
+ : framer_(version),
+ use_compression_(false),
+ error_count_(0),
+ syn_frame_count_(0),
+ syn_reply_frame_count_(0),
+ headers_frame_count_(0),
+ push_promise_frame_count_(0),
+ goaway_count_(0),
+ setting_count_(0),
+ settings_ack_sent_(0),
+ settings_ack_received_(0),
+ continuation_count_(0),
+ last_window_update_stream_(0),
+ last_window_update_delta_(0),
+ last_push_promise_stream_(0),
+ last_push_promise_promised_stream_(0),
+ data_bytes_(0),
+ fin_frame_count_(0),
+ fin_opaque_data_(),
+ fin_flag_count_(0),
+ zero_length_data_frame_count_(0),
+ control_frame_header_data_count_(0),
+ zero_length_control_frame_header_data_count_(0),
+ data_frame_count_(0),
+ last_payload_len_(0),
+ last_frame_len_(0),
+ header_buffer_(new char[kDefaultHeaderBufferSize]),
+ header_buffer_length_(0),
+ header_buffer_size_(kDefaultHeaderBufferSize),
+ header_stream_id_(-1),
+ header_control_type_(DATA),
+ header_buffer_valid_(false) {}
virtual void OnError(SpdyFramer* f) OVERRIDE {
LOG(INFO) << "SpdyFramer Error: "
@@ -285,7 +287,7 @@ class TestSpdyVisitor : public SpdyFramerVisitorInterface,
data_bytes_ += len;
std::cerr << "OnStreamFrameData(" << stream_id << ", \"";
if (len > 0) {
- for (size_t i = 0 ; i < len; ++i) {
+ for (size_t i = 0; i < len; ++i) {
std::cerr << std::hex << (0xFF & (unsigned int)data[i]) << std::dec;
}
}
@@ -364,7 +366,9 @@ class TestSpdyVisitor : public SpdyFramerVisitorInterface,
}
virtual void OnSettingsEnd() OVERRIDE {
- if (framer_.protocol_version() <= SPDY3) { return; }
+ if (framer_.protocol_version() <= SPDY3) {
+ return;
+ }
++settings_ack_sent_;
}
@@ -430,8 +434,7 @@ class TestSpdyVisitor : public SpdyFramerVisitorInterface,
// into the framer. This simulates getting strange-sized reads from
// the socket.
const size_t kMaxReadSize = 32;
- size_t bytes_read =
- (rand() % min(input_remaining, kMaxReadSize)) + 1;
+ size_t bytes_read = (rand() % min(input_remaining, kMaxReadSize)) + 1;
size_t bytes_processed = framer_.ProcessInput(input_ptr, bytes_read);
input_remaining -= bytes_processed;
input_ptr += bytes_processed;
@@ -522,8 +525,7 @@ base::StringPiece GetSerializedHeaders(const SpdyFrame* frame,
reader.ReadUInt16(&serialized_type);
frame_type = SpdyConstants::ParseFrameType(framer.protocol_version(),
serialized_type);
- DCHECK(frame_type == HEADERS ||
- frame_type == SYN_STREAM) << frame_type;
+ DCHECK(frame_type == HEADERS || frame_type == SYN_STREAM) << frame_type;
}
if (frame_type == SYN_STREAM) {
@@ -634,13 +636,12 @@ TEST_P(SpdyFramerTest, HeaderBlockInBuffer) {
TestSpdyVisitor visitor(spdy_version_);
visitor.use_compression_ = false;
- visitor.SimulateInFramer(
- reinterpret_cast<unsigned char*>(frame->data()),
- frame->size());
+ visitor.SimulateInFramer(reinterpret_cast<unsigned char*>(frame->data()),
+ frame->size());
EXPECT_EQ(1, visitor.zero_length_control_frame_header_data_count_);
- EXPECT_TRUE(CompareHeaderBlocks(&syn_stream.name_value_block(),
- &visitor.headers_));
+ EXPECT_TRUE(
+ CompareHeaderBlocks(&syn_stream.name_value_block(), &visitor.headers_));
}
// Test that if there's not a full frame, we fail to parse it.
@@ -658,9 +659,8 @@ TEST_P(SpdyFramerTest, UndersizedHeaderBlockInBuffer) {
TestSpdyVisitor visitor(spdy_version_);
visitor.use_compression_ = false;
- visitor.SimulateInFramer(
- reinterpret_cast<unsigned char*>(frame->data()),
- frame->size() - 2);
+ visitor.SimulateInFramer(reinterpret_cast<unsigned char*>(frame->data()),
+ frame->size() - 2);
EXPECT_EQ(0, visitor.zero_length_control_frame_header_data_count_);
EXPECT_EQ(0u, visitor.headers_.size());
@@ -745,7 +745,7 @@ TEST_P(SpdyFramerTest, PushPromiseWithPromisedStreamIdZero) {
SpdyPushPromiseIR push_promise(3, 0);
push_promise.SetHeader("alpha", "beta");
scoped_ptr<SpdySerializedFrame> frame(
- framer.SerializePushPromise(push_promise));
+ framer.SerializePushPromise(push_promise));
ASSERT_TRUE(frame.get() != NULL);
// We shouldn't have to read the whole frame before we signal an error.
@@ -798,9 +798,8 @@ TEST_P(SpdyFramerTest, DuplicateHeader) {
base::StringPiece serialized_headers =
GetSerializedHeaders(control_frame.get(), framer);
// This should fail because duplicate headers are verboten by the spec.
- EXPECT_FALSE(framer.ParseHeaderBlockInBuffer(serialized_headers.data(),
- serialized_headers.size(),
- &new_headers));
+ EXPECT_FALSE(framer.ParseHeaderBlockInBuffer(
+ serialized_headers.data(), serialized_headers.size(), &new_headers));
}
TEST_P(SpdyFramerTest, MultiValueHeader) {
@@ -813,10 +812,8 @@ TEST_P(SpdyFramerTest, MultiValueHeader) {
frame.WriteUInt32(0); // associated stream id
frame.WriteUInt16(0); // Priority.
} else {
- frame.BeginNewFrame(framer,
- HEADERS,
- HEADERS_FLAG_PRIORITY | HEADERS_FLAG_END_HEADERS,
- 3);
+ frame.BeginNewFrame(
+ framer, HEADERS, HEADERS_FLAG_PRIORITY | HEADERS_FLAG_END_HEADERS, 3);
frame.WriteUInt32(framer.GetHighestPriority());
}
@@ -850,8 +847,7 @@ TEST_P(SpdyFramerTest, MultiValueHeader) {
reinterpret_cast<unsigned char*>(control_frame->data()),
control_frame->size());
- EXPECT_THAT(visitor.headers_, ElementsAre(
- Pair("name", value)));
+ EXPECT_THAT(visitor.headers_, ElementsAre(Pair("name", value)));
}
TEST_P(SpdyFramerTest, BasicCompression) {
@@ -878,14 +874,14 @@ TEST_P(SpdyFramerTest, BasicCompression) {
EXPECT_EQ(139u, uncompressed_size1);
#if defined(USE_SYSTEM_ZLIB)
EXPECT_EQ(155u, compressed_size1);
-#else // !defined(USE_SYSTEM_ZLIB)
+#else // !defined(USE_SYSTEM_ZLIB)
EXPECT_EQ(135u, compressed_size1);
#endif // !defined(USE_SYSTEM_ZLIB)
} else {
EXPECT_EQ(165u, uncompressed_size1);
#if defined(USE_SYSTEM_ZLIB)
EXPECT_EQ(181u, compressed_size1);
-#else // !defined(USE_SYSTEM_ZLIB)
+#else // !defined(USE_SYSTEM_ZLIB)
EXPECT_EQ(117u, compressed_size1);
#endif // !defined(USE_SYSTEM_ZLIB)
}
@@ -898,30 +894,29 @@ TEST_P(SpdyFramerTest, BasicCompression) {
EXPECT_LE(frame2->size(), frame1->size());
// Decompress the first frame
- scoped_ptr<SpdyFrame> frame3(SpdyFramerTestUtil::DecompressFrame(
- &framer, *frame1.get()));
+ scoped_ptr<SpdyFrame> frame3(
+ SpdyFramerTestUtil::DecompressFrame(&framer, *frame1.get()));
// Decompress the second frame
visitor.reset(new TestSpdyVisitor(spdy_version_));
framer.set_debug_visitor(visitor.get());
- scoped_ptr<SpdyFrame> frame4(SpdyFramerTestUtil::DecompressFrame(
- &framer, *frame2.get()));
- size_t uncompressed_size4 =
- frame4->size() - framer.GetSynStreamMinimumSize();
+ scoped_ptr<SpdyFrame> frame4(
+ SpdyFramerTestUtil::DecompressFrame(&framer, *frame2.get()));
+ size_t uncompressed_size4 = frame4->size() - framer.GetSynStreamMinimumSize();
size_t compressed_size4 =
visitor->last_frame_len_ - framer.GetSynStreamMinimumSize();
if (IsSpdy2()) {
EXPECT_EQ(139u, uncompressed_size4);
#if defined(USE_SYSTEM_ZLIB)
EXPECT_EQ(149u, compressed_size4);
-#else // !defined(USE_SYSTEM_ZLIB)
+#else // !defined(USE_SYSTEM_ZLIB)
EXPECT_EQ(101u, compressed_size4);
#endif // !defined(USE_SYSTEM_ZLIB)
} else {
EXPECT_EQ(165u, uncompressed_size4);
#if defined(USE_SYSTEM_ZLIB)
EXPECT_EQ(175u, compressed_size4);
-#else // !defined(USE_SYSTEM_ZLIB)
+#else // !defined(USE_SYSTEM_ZLIB)
EXPECT_EQ(102u, compressed_size4);
#endif // !defined(USE_SYSTEM_ZLIB)
}
@@ -959,162 +954,130 @@ TEST_P(SpdyFramerTest, CompressEmptyHeaders) {
TEST_P(SpdyFramerTest, Basic) {
const unsigned char kV2Input[] = {
- 0x80, spdy_version_ch_, 0x00, 0x01, // SYN Stream #1
- 0x00, 0x00, 0x00, 0x14,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x02, 'h', 'h',
- 0x00, 0x02, 'v', 'v',
-
- 0x80, spdy_version_ch_, 0x00, 0x08, // HEADERS on Stream #1
- 0x00, 0x00, 0x00, 0x18,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x02, 'h', '2',
- 0x00, 0x02, 'v', '2',
- 0x00, 0x02, 'h', '3',
- 0x00, 0x02, 'v', '3',
-
- 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1
- 0x00, 0x00, 0x00, 0x0c,
- 0xde, 0xad, 0xbe, 0xef,
- 0xde, 0xad, 0xbe, 0xef,
- 0xde, 0xad, 0xbe, 0xef,
-
- 0x80, spdy_version_ch_, 0x00, 0x01, // SYN Stream #3
- 0x00, 0x00, 0x00, 0x0c,
- 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
-
- 0x00, 0x00, 0x00, 0x03, // DATA on Stream #3
- 0x00, 0x00, 0x00, 0x08,
- 0xde, 0xad, 0xbe, 0xef,
- 0xde, 0xad, 0xbe, 0xef,
-
- 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1
- 0x00, 0x00, 0x00, 0x04,
- 0xde, 0xad, 0xbe, 0xef,
-
- 0x80, spdy_version_ch_, 0x00, 0x03, // RST_STREAM on Stream #1
- 0x00, 0x00, 0x00, 0x08,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x05, // RST_STREAM_CANCEL
-
- 0x00, 0x00, 0x00, 0x03, // DATA on Stream #3
- 0x00, 0x00, 0x00, 0x00,
-
- 0x80, spdy_version_ch_, 0x00, 0x03, // RST_STREAM on Stream #3
- 0x00, 0x00, 0x00, 0x08,
- 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x05, // RST_STREAM_CANCEL
+ 0x80, spdy_version_ch_, 0x00, 0x01, // SYN Stream #1
+ 0x00, 0x00, 0x00, 0x14,
+ 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x02, 'h', 'h',
+ 0x00, 0x02, 'v', 'v',
+ 0x80, spdy_version_ch_, 0x00, 0x08, // HEADERS on Stream #1
+ 0x00, 0x00, 0x00, 0x18,
+ 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x02,
+ 0x00, 0x02, 'h', '2',
+ 0x00, 0x02, 'v', '2',
+ 0x00, 0x02, 'h', '3',
+ 0x00, 0x02, 'v', '3',
+ 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1
+ 0x00, 0x00, 0x00, 0x0c,
+ 0xde, 0xad, 0xbe, 0xef,
+ 0xde, 0xad, 0xbe, 0xef,
+ 0xde, 0xad, 0xbe, 0xef,
+ 0x80, spdy_version_ch_, 0x00, 0x01, // SYN Stream #3
+ 0x00, 0x00, 0x00, 0x0c,
+ 0x00, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x03, // DATA on Stream #3
+ 0x00, 0x00, 0x00, 0x08,
+ 0xde, 0xad, 0xbe, 0xef,
+ 0xde, 0xad, 0xbe, 0xef,
+ 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1
+ 0x00, 0x00, 0x00, 0x04,
+ 0xde, 0xad, 0xbe, 0xef,
+ 0x80, spdy_version_ch_, 0x00, 0x03, // RST_STREAM on Stream #1
+ 0x00, 0x00, 0x00, 0x08,
+ 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x05, // RST_STREAM_CANCEL
+ 0x00, 0x00, 0x00, 0x03, // DATA on Stream #3
+ 0x00, 0x00, 0x00, 0x00,
+ 0x80, spdy_version_ch_, 0x00, 0x03, // RST_STREAM on Stream #3
+ 0x00, 0x00, 0x00, 0x08,
+ 0x00, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0x00, 0x05, // RST_STREAM_CANCEL
};
const unsigned char kV3Input[] = {
- 0x80, spdy_version_ch_, 0x00, 0x01, // SYN Stream #1
- 0x00, 0x00, 0x00, 0x1a,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00,
- 0x00, 0x02, 'h', 'h',
- 0x00, 0x00, 0x00, 0x02,
- 'v', 'v',
-
- 0x80, spdy_version_ch_, 0x00, 0x08, // HEADERS on Stream #1
- 0x00, 0x00, 0x00, 0x20,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x02,
- 'h', '2',
- 0x00, 0x00, 0x00, 0x02,
- 'v', '2', 0x00, 0x00,
- 0x00, 0x02, 'h', '3',
- 0x00, 0x00, 0x00, 0x02,
- 'v', '3',
-
- 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1
- 0x00, 0x00, 0x00, 0x0c,
- 0xde, 0xad, 0xbe, 0xef,
- 0xde, 0xad, 0xbe, 0xef,
- 0xde, 0xad, 0xbe, 0xef,
-
- 0x80, spdy_version_ch_, 0x00, 0x01, // SYN Stream #3
- 0x00, 0x00, 0x00, 0x0e,
- 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-
- 0x00, 0x00, 0x00, 0x03, // DATA on Stream #3
- 0x00, 0x00, 0x00, 0x08,
- 0xde, 0xad, 0xbe, 0xef,
- 0xde, 0xad, 0xbe, 0xef,
-
- 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1
- 0x00, 0x00, 0x00, 0x04,
- 0xde, 0xad, 0xbe, 0xef,
-
- 0x80, spdy_version_ch_, 0x00, 0x03, // RST_STREAM on Stream #1
- 0x00, 0x00, 0x00, 0x08,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x05, // RST_STREAM_CANCEL
-
- 0x00, 0x00, 0x00, 0x03, // DATA on Stream #3
- 0x00, 0x00, 0x00, 0x00,
-
- 0x80, spdy_version_ch_, 0x00, 0x03, // RST_STREAM on Stream #3
- 0x00, 0x00, 0x00, 0x08,
- 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x05, // RST_STREAM_CANCEL
+ 0x80, spdy_version_ch_, 0x00, 0x01, // SYN Stream #1
+ 0x00, 0x00, 0x00, 0x1a,
+ 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x02, 'h', 'h',
+ 0x00, 0x00, 0x00, 0x02,
+ 'v', 'v', 0x80, spdy_version_ch_,
+ 0x00, 0x08, // HEADERS on Stream #1
+ 0x00, 0x00, 0x00, 0x20,
+ 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x02,
+ 'h', '2', 0x00, 0x00,
+ 0x00, 0x02, 'v', '2',
+ 0x00, 0x00, 0x00, 0x02,
+ 'h', '3', 0x00, 0x00,
+ 0x00, 0x02, 'v', '3',
+ 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1
+ 0x00, 0x00, 0x00, 0x0c,
+ 0xde, 0xad, 0xbe, 0xef,
+ 0xde, 0xad, 0xbe, 0xef,
+ 0xde, 0xad, 0xbe, 0xef,
+ 0x80, spdy_version_ch_, 0x00, 0x01, // SYN Stream #3
+ 0x00, 0x00, 0x00, 0x0e,
+ 0x00, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x03, // DATA on Stream #3
+ 0x00, 0x00, 0x00, 0x08,
+ 0xde, 0xad, 0xbe, 0xef,
+ 0xde, 0xad, 0xbe, 0xef,
+ 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1
+ 0x00, 0x00, 0x00, 0x04,
+ 0xde, 0xad, 0xbe, 0xef,
+ 0x80, spdy_version_ch_, 0x00, 0x03, // RST_STREAM on Stream #1
+ 0x00, 0x00, 0x00, 0x08,
+ 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x05, // RST_STREAM_CANCEL
+ 0x00, 0x00, 0x00, 0x03, // DATA on Stream #3
+ 0x00, 0x00, 0x00, 0x00,
+ 0x80, spdy_version_ch_, 0x00, 0x03, // RST_STREAM on Stream #3
+ 0x00, 0x00, 0x00, 0x08,
+ 0x00, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0x00, 0x05, // RST_STREAM_CANCEL
};
// SYN_STREAM doesn't exist in SPDY4, so instead we send
// HEADERS frames with PRIORITY and END_HEADERS set.
const unsigned char kV4Input[] = {
- 0x00, 0x05, 0x01, 0x0c, // HEADERS: PRIORITY | END_HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x00, 0x00, 0x00, 0x00, // Priority 0
- 0x82, // :method: GET
-
- 0x00, 0x01, 0x01, 0x04, // HEADERS: END_HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x8c, // :status: 200
-
- 0x00, 0x0c, 0x00, 0x00, // DATA on Stream #1
- 0x00, 0x00, 0x00, 0x01,
- 0xde, 0xad, 0xbe, 0xef,
- 0xde, 0xad, 0xbe, 0xef,
- 0xde, 0xad, 0xbe, 0xef,
-
- 0x00, 0x05, 0x01, 0x0c, // HEADERS: PRIORITY | END_HEADERS
- 0x00, 0x00, 0x00, 0x03, // Stream 3
- 0x00, 0x00, 0x00, 0x00, // Priority 0
- 0x82, // :method: GET
-
- 0x00, 0x08, 0x00, 0x00, // DATA on Stream #3
- 0x00, 0x00, 0x00, 0x03,
- 0xde, 0xad, 0xbe, 0xef,
- 0xde, 0xad, 0xbe, 0xef,
-
- 0x00, 0x04, 0x00, 0x00, // DATA on Stream #1
- 0x00, 0x00, 0x00, 0x01,
- 0xde, 0xad, 0xbe, 0xef,
-
- 0x00, 0x04, 0x03, 0x00, // RST_STREAM on Stream #1
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x08, // RST_STREAM_CANCEL
-
- 0x00, 0x00, 0x00, 0x00, // DATA on Stream #3
- 0x00, 0x00, 0x00, 0x03,
-
- 0x00, 0x0f, 0x03, 0x00, // RST_STREAM on Stream #3
- 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x08, // RST_STREAM_CANCEL
- 0x52, 0x45, 0x53, 0x45, // opaque data
- 0x54, 0x53, 0x54, 0x52,
- 0x45, 0x41, 0x4d,
+ 0x00, 0x05, 0x01, 0x0c, // HEADERS: PRIORITY | END_HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x00, 0x00, 0x00, 0x00, // Priority 0
+ 0x82, // :method: GET
+ 0x00, 0x01, 0x01, 0x04, // HEADERS: END_HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x8c, // :status: 200
+ 0x00, 0x0c, 0x00, 0x00, // DATA on Stream #1
+ 0x00, 0x00, 0x00, 0x01, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe,
+ 0xef, 0xde, 0xad, 0xbe, 0xef, 0x00, 0x05, 0x01, 0x0c, // HEADERS:
+ // PRIORITY |
+ // END_HEADERS
+ 0x00, 0x00, 0x00, 0x03, // Stream 3
+ 0x00, 0x00, 0x00, 0x00, // Priority 0
+ 0x82, // :method: GET
+ 0x00, 0x08, 0x00, 0x00, // DATA on Stream #3
+ 0x00, 0x00, 0x00, 0x03, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe,
+ 0xef, 0x00, 0x04, 0x00, 0x00, // DATA on Stream #1
+ 0x00, 0x00, 0x00, 0x01, 0xde, 0xad, 0xbe, 0xef, 0x00, 0x04, 0x03,
+ 0x00, // RST_STREAM on Stream #1
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, // RST_STREAM_CANCEL
+ 0x00, 0x00, 0x00, 0x00, // DATA on Stream #3
+ 0x00, 0x00, 0x00, 0x03, 0x00, 0x0f, 0x03, 0x00, // RST_STREAM on Stream
+ // #3
+ 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, // RST_STREAM_CANCEL
+ 0x52, 0x45, 0x53, 0x45, // opaque data
+ 0x54, 0x53, 0x54, 0x52, 0x45, 0x41, 0x4d,
};
TestSpdyVisitor visitor(spdy_version_);
@@ -1150,82 +1113,55 @@ TEST_P(SpdyFramerTest, Basic) {
// Test that the FIN flag on a data frame signifies EOF.
TEST_P(SpdyFramerTest, FinOnDataFrame) {
const unsigned char kV2Input[] = {
- 0x80, spdy_version_ch_, 0x00, 0x01, // SYN Stream #1
- 0x00, 0x00, 0x00, 0x14,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x02, 'h', 'h',
- 0x00, 0x02, 'v', 'v',
-
- 0x80, spdy_version_ch_, 0x00, 0x02, // SYN REPLY Stream #1
- 0x00, 0x00, 0x00, 0x10,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x02, 'a', 'a',
- 0x00, 0x02, 'b', 'b',
-
- 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1
- 0x00, 0x00, 0x00, 0x0c,
- 0xde, 0xad, 0xbe, 0xef,
- 0xde, 0xad, 0xbe, 0xef,
- 0xde, 0xad, 0xbe, 0xef,
-
- 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1, with EOF
- 0x01, 0x00, 0x00, 0x04,
- 0xde, 0xad, 0xbe, 0xef,
+ 0x80, spdy_version_ch_, 0x00, 0x01, // SYN Stream #1
+ 0x00, 0x00, 0x00, 0x14, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x02,
+ 'h', 'h', 0x00, 0x02, 'v', 'v',
+ 0x80, spdy_version_ch_, 0x00, 0x02, // SYN REPLY Stream #1
+ 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x02, 'a', 'a', 0x00, 0x02,
+ 'b', 'b', 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1
+ 0x00, 0x00, 0x00, 0x0c, 0xde, 0xad,
+ 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef,
+ 0xde, 0xad, 0xbe, 0xef, 0x00, 0x00,
+ 0x00, 0x01, // DATA on Stream #1, with EOF
+ 0x01, 0x00, 0x00, 0x04, 0xde, 0xad,
+ 0xbe, 0xef,
};
const unsigned char kV3Input[] = {
- 0x80, spdy_version_ch_, 0x00, 0x01, // SYN Stream #1
- 0x00, 0x00, 0x00, 0x1a,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00,
- 0x00, 0x02, 'h', 'h',
- 0x00, 0x00, 0x00, 0x02,
- 'v', 'v',
-
- 0x80, spdy_version_ch_, 0x00, 0x02, // SYN REPLY Stream #1
- 0x00, 0x00, 0x00, 0x14,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x02,
- 'a', 'a', 0x00, 0x00,
- 0x00, 0x02, 'b', 'b',
-
- 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1
- 0x00, 0x00, 0x00, 0x0c,
- 0xde, 0xad, 0xbe, 0xef,
- 0xde, 0xad, 0xbe, 0xef,
- 0xde, 0xad, 0xbe, 0xef,
-
- 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1, with EOF
- 0x01, 0x00, 0x00, 0x04,
- 0xde, 0xad, 0xbe, 0xef,
+ 0x80, spdy_version_ch_, 0x00, 0x01, // SYN Stream #1
+ 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 'h', 'h',
+ 0x00, 0x00, 0x00, 0x02, 'v', 'v', 0x80, spdy_version_ch_,
+ 0x00, 0x02, // SYN REPLY Stream #1
+ 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02,
+ 'a', 'a', 0x00, 0x00, 0x00, 0x02, 'b', 'b',
+ 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1
+ 0x00, 0x00, 0x00, 0x0c, 0xde, 0xad, 0xbe, 0xef,
+ 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef,
+ 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1, with EOF
+ 0x01, 0x00, 0x00, 0x04, 0xde, 0xad, 0xbe, 0xef,
};
// SYN_STREAM and SYN_REPLY don't exist in SPDY4, so instead we send
// HEADERS frames with PRIORITY(SYN_STREAM only) and END_HEADERS set.
const unsigned char kV4Input[] = {
- 0x00, 0x05, 0x01, 0x0c, // HEADERS: PRIORITY | END_HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x00, 0x00, 0x00, 0x00, // Priority 0
- 0x82, // :method: GET
-
- 0x00, 0x01, 0x01, 0x04, // HEADERS: END_HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x8c, // :status: 200
-
- 0x00, 0x0c, 0x00, 0x00, // DATA on Stream #1
- 0x00, 0x00, 0x00, 0x01,
- 0xde, 0xad, 0xbe, 0xef,
- 0xde, 0xad, 0xbe, 0xef,
- 0xde, 0xad, 0xbe, 0xef,
-
- 0x00, 0x04, 0x00, 0x01, // DATA on Stream #1, with FIN
- 0x00, 0x00, 0x00, 0x01,
- 0xde, 0xad, 0xbe, 0xef,
+ 0x00, 0x05, 0x01, 0x0c, // HEADERS: PRIORITY | END_HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x00, 0x00, 0x00, 0x00, // Priority 0
+ 0x82, // :method: GET
+ 0x00, 0x01, 0x01, 0x04, // HEADERS: END_HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x8c, // :status: 200
+ 0x00, 0x0c, 0x00, 0x00, // DATA on Stream #1
+ 0x00, 0x00, 0x00, 0x01, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe,
+ 0xef, 0xde, 0xad, 0xbe, 0xef, 0x00, 0x04, 0x00, 0x01, // DATA on Stream
+ // #1, with FIN
+ 0x00, 0x00, 0x00, 0x01, 0xde, 0xad, 0xbe, 0xef,
};
TestSpdyVisitor visitor(spdy_version_);
@@ -1256,52 +1192,36 @@ TEST_P(SpdyFramerTest, FinOnDataFrame) {
// Test that the FIN flag on a SYN reply frame signifies EOF.
TEST_P(SpdyFramerTest, FinOnSynReplyFrame) {
const unsigned char kV2Input[] = {
- 0x80, spdy_version_ch_, 0x00, 0x01, // SYN Stream #1
- 0x00, 0x00, 0x00, 0x14,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x02, 'h', 'h',
- 0x00, 0x02, 'v', 'v',
-
- 0x80, spdy_version_ch_, 0x00, 0x02, // SYN REPLY Stream #1
- 0x01, 0x00, 0x00, 0x10,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x02, 'a', 'a',
- 0x00, 0x02, 'b', 'b',
+ 0x80, spdy_version_ch_, 0x00, 0x01, // SYN Stream #1
+ 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x02, 'h', 'h', 0x00, 0x02, 'v', 'v',
+ 0x80, spdy_version_ch_, 0x00, 0x02, // SYN REPLY Stream #1
+ 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 'a', 'a',
+ 0x00, 0x02, 'b', 'b',
};
const unsigned char kV3Input[] = {
- 0x80, spdy_version_ch_, 0x00, 0x01, // SYN Stream #1
- 0x00, 0x00, 0x00, 0x1a,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x00, 0x00,
- 0x00, 0x02, 'h', 'h',
- 0x00, 0x00, 0x00, 0x02,
- 'v', 'v',
-
- 0x80, spdy_version_ch_, 0x00, 0x02, // SYN REPLY Stream #1
- 0x01, 0x00, 0x00, 0x14,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x02,
- 'a', 'a', 0x00, 0x00,
- 0x00, 0x02, 'b', 'b',
+ 0x80, spdy_version_ch_, 0x00, 0x01, // SYN Stream #1
+ 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x02, 'h', 'h', 0x00, 0x00, 0x00, 0x02, 'v', 'v',
+ 0x80, spdy_version_ch_, 0x00, 0x02, // SYN REPLY Stream #1
+ 0x01, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 'a', 'a', 0x00, 0x00,
+ 0x00, 0x02, 'b', 'b',
};
// SYN_STREAM and SYN_REPLY don't exist in SPDY4, so instead we send
// HEADERS frames with PRIORITY(SYN_STREAM only) and END_HEADERS set.
const unsigned char kV4Input[] = {
- 0x00, 0x05, 0x01, 0x0c, // HEADERS: PRIORITY | END_HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x00, 0x00, 0x00, 0x00, // Priority 0
- 0x82, // :method: GET
-
- 0x00, 0x01, 0x01, 0x05, // HEADERS: FIN | END_HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x8c, // :status: 200
+ 0x00, 0x05, 0x01, 0x0c, // HEADERS: PRIORITY | END_HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x00, 0x00, 0x00, 0x00, // Priority 0
+ 0x82, // :method: GET
+ 0x00, 0x01, 0x01, 0x05, // HEADERS: FIN | END_HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x8c, // :status: 200
};
TestSpdyVisitor visitor(spdy_version_);
@@ -1370,8 +1290,8 @@ TEST_P(SpdyFramerTest, HeaderCompression) {
SpdyHeaderBlock decompressed_headers;
// Decompress SYN_STREAM #1
- decompressed.reset(SpdyFramerTestUtil::DecompressFrame(
- &recv_framer, *syn_frame_1.get()));
+ decompressed.reset(
+ SpdyFramerTestUtil::DecompressFrame(&recv_framer, *syn_frame_1.get()));
EXPECT_TRUE(decompressed.get() != NULL);
serialized_headers = GetSerializedHeaders(decompressed.get(), send_framer);
EXPECT_TRUE(recv_framer.ParseHeaderBlockInBuffer(serialized_headers.data(),
@@ -1382,8 +1302,8 @@ TEST_P(SpdyFramerTest, HeaderCompression) {
EXPECT_EQ(kValue2, decompressed_headers[kHeader2]);
// Decompress SYN_STREAM #2
- decompressed.reset(SpdyFramerTestUtil::DecompressFrame(
- &recv_framer, *syn_frame_2.get()));
+ decompressed.reset(
+ SpdyFramerTestUtil::DecompressFrame(&recv_framer, *syn_frame_2.get()));
EXPECT_TRUE(decompressed.get() != NULL);
serialized_headers = GetSerializedHeaders(decompressed.get(), send_framer);
decompressed_headers.clear();
@@ -1491,21 +1411,16 @@ TEST_P(SpdyFramerTest, UnclosedStreamDataCompressorsOneByteAtATime) {
TEST_P(SpdyFramerTest, WindowUpdateFrame) {
SpdyFramer framer(spdy_version_);
- scoped_ptr<SpdyFrame> frame(framer.SerializeWindowUpdate(
- SpdyWindowUpdateIR(1, 0x12345678)));
+ scoped_ptr<SpdyFrame> frame(
+ framer.SerializeWindowUpdate(SpdyWindowUpdateIR(1, 0x12345678)));
const char kDescription[] = "WINDOW_UPDATE frame, stream 1, delta 0x12345678";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x80, spdy_version_ch_, 0x00, 0x09,
- 0x00, 0x00, 0x00, 0x08,
- 0x00, 0x00, 0x00, 0x01,
- 0x12, 0x34, 0x56, 0x78
- };
- const unsigned char kV4FrameData[] = {
- 0x00, 0x04, 0x08, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x12, 0x34, 0x56, 0x78
- };
+ const unsigned char kV3FrameData[] = {
+ // Also applies for V2.
+ 0x80, spdy_version_ch_, 0x00, 0x09, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
+ 0x00, 0x01, 0x12, 0x34, 0x56, 0x78};
+ const unsigned char kV4FrameData[] = {0x00, 0x04, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x12, 0x34, 0x56, 0x78};
if (IsSpdy4()) {
CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
@@ -1519,34 +1434,26 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
{
const char kDescription[] = "'hello' data frame, no FIN";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x05,
- 'h', 'e', 'l', 'l',
- 'o'
- };
- const unsigned char kV4FrameData[] = {
- 0x00, 0x05, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 'h', 'e', 'l', 'l',
- 'o'
- };
+ const unsigned char kV3FrameData[] = {// Also applies for V2.
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x05, 'h', 'e', 'l', 'l', 'o'};
+ const unsigned char kV4FrameData[] = {0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x01, 'h', 'e',
+ 'l', 'l', 'o'};
const char bytes[] = "hello";
SpdyDataIR data_ir(1, StringPiece(bytes, strlen(bytes)));
scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
if (IsSpdy4()) {
- CompareFrame(
- kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
+ CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
} else {
- CompareFrame(
- kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
+ CompareFrame(kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
}
SpdyDataIR data_header_ir(1);
data_header_ir.SetDataShallow(base::StringPiece(bytes, strlen(bytes)));
- frame.reset(framer.SerializeDataFrameHeaderWithPaddingLengthField(
- data_header_ir));
+ frame.reset(
+ framer.SerializeDataFrameHeaderWithPaddingLengthField(data_header_ir));
CompareCharArraysWithHexError(
kDescription,
reinterpret_cast<const unsigned char*>(frame->data()),
@@ -1557,40 +1464,36 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
{
const char kDescription[] = "'hello' data frame with more padding, no FIN";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x05,
- 'h', 'e', 'l', 'l',
- 'o'
- };
+ const unsigned char kV3FrameData[] = {// Also applies for V2.
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x05, 'h', 'e', 'l', 'l', 'o'};
const unsigned char kV4FrameData[] = {
- 0x01, 0x0b, 0x00, 0x30, // Length = 267. PAD_HIGH and PAD_LOW set.
- 0x00, 0x00, 0x00, 0x01,
- 0x01, 0x04, // Pad Low and Pad High fields.
- 'h', 'e', 'l', 'l', // Data
- 'o',
- // Padding of 260 zeros (so both PAD_HIGH and PAD_LOW fields are used).
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
- '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ 0x01, 0x0b, 0x00, 0x30, // Length = 267. PAD_HIGH and PAD_LOW set.
+ 0x00, 0x00, 0x00, 0x01, 0x01, 0x04, // Pad Low and Pad High fields.
+ 'h', 'e', 'l', 'l', // Data
+ 'o',
+ // Padding of 260 zeros (so both PAD_HIGH and PAD_LOW fields are used).
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
};
const char bytes[] = "hello";
@@ -1600,11 +1503,9 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
data_ir.set_padding_len(262);
scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
if (IsSpdy4()) {
- CompareFrame(
- kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
+ CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
} else {
- CompareFrame(
- kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
+ CompareFrame(kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
}
frame.reset(framer.SerializeDataFrameHeaderWithPaddingLengthField(data_ir));
@@ -1618,22 +1519,17 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
{
const char kDescription[] = "'hello' data frame with few padding, no FIN";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x05,
- 'h', 'e', 'l', 'l',
- 'o'
- };
+ const unsigned char kV3FrameData[] = {// Also applies for V2.
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x05, 'h', 'e', 'l', 'l', 'o'};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0d, 0x00, 0x10, // Length = 13. PAD_LOW set.
- 0x00, 0x00, 0x00, 0x01,
- 0x07, // Pad Low field.
- 'h', 'e', 'l', 'l', // Data
- 'o',
- '0', '0', '0', '0', // Padding
- '0', '0', '0'
- };
+ 0x00, 0x0d, 0x00, 0x10, // Length = 13. PAD_LOW set.
+ 0x00, 0x00, 0x00, 0x01,
+ 0x07, // Pad Low field.
+ 'h', 'e', 'l', 'l', // Data
+ 'o', '0', '0', '0', '0', // Padding
+ '0', '0', '0'};
const char bytes[] = "hello";
SpdyDataIR data_ir(1, StringPiece(bytes, strlen(bytes)));
@@ -1641,30 +1537,25 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
data_ir.set_padding_len(8);
scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
if (IsSpdy4()) {
- CompareFrame(
- kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
+ CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
} else {
- CompareFrame(
- kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
+ CompareFrame(kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
}
}
{
const char kDescription[] =
"'hello' data frame with 1 byte padding, no FIN";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x05,
- 'h', 'e', 'l', 'l',
- 'o'
- };
+ const unsigned char kV3FrameData[] = {// Also applies for V2.
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x05, 'h', 'e', 'l', 'l', 'o'};
const unsigned char kV4FrameData[] = {
- 0x00, 0x06, 0x00, 0x10, // Length = 6. PAD_LOW set.
- 0x00, 0x00, 0x00, 0x01,
- 0x00, // Pad Low field.
- 'h', 'e', 'l', 'l', // Data
- 'o',
+ 0x00, 0x06, 0x00, 0x10, // Length = 6. PAD_LOW set.
+ 0x00, 0x00, 0x00, 0x01,
+ 0x00, // Pad Low field.
+ 'h', 'e', 'l', 'l', // Data
+ 'o',
};
const char bytes[] = "hello";
@@ -1674,11 +1565,9 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
data_ir.set_padding_len(1);
scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
if (IsSpdy4()) {
- CompareFrame(
- kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
+ CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
} else {
- CompareFrame(
- kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
+ CompareFrame(kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
}
frame.reset(framer.SerializeDataFrameHeaderWithPaddingLengthField(data_ir));
@@ -1692,71 +1581,53 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
{
const char kDescription[] = "Data frame with negative data byte, no FIN";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x01,
- 0xff
- };
- const unsigned char kV4FrameData[] = {
- 0x00, 0x01, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0xff
- };
+ const unsigned char kV3FrameData[] = {
+ // Also applies for V2.
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0xff};
+ const unsigned char kV4FrameData[] = {0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x01, 0xff};
SpdyDataIR data_ir(1, StringPiece("\xff", 1));
scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
if (IsSpdy4()) {
- CompareFrame(
- kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
+ CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
} else {
- CompareFrame(
- kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
+ CompareFrame(kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
}
}
{
const char kDescription[] = "'hello' data frame, with FIN";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x00, 0x00, 0x00, 0x01,
- 0x01, 0x00, 0x00, 0x05,
- 'h', 'e', 'l', 'l',
- 'o'
- };
- const unsigned char kV4FrameData[] = {
- 0x00, 0x05, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x01,
- 'h', 'e', 'l', 'l',
- 'o'
- };
+ const unsigned char kV3FrameData[] = {// Also applies for V2.
+ 0x00, 0x00, 0x00, 0x01, 0x01, 0x00,
+ 0x00, 0x05, 'h', 'e', 'l', 'l', 'o'};
+ const unsigned char kV4FrameData[] = {0x00, 0x05, 0x00, 0x01, 0x00,
+ 0x00, 0x00, 0x01, 'h', 'e',
+ 'l', 'l', 'o'};
SpdyDataIR data_ir(1, StringPiece("hello", 5));
data_ir.set_fin(true);
scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
if (IsSpdy4()) {
- CompareFrame(
- kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
+ CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
} else {
- CompareFrame(
- kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
+ CompareFrame(kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
}
}
{
const char kDescription[] = "Empty data frame";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00,
+ const unsigned char kV3FrameData[] = {
+ // Also applies for V2.
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
};
SpdyDataIR data_ir(1, StringPiece());
scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
if (IsSpdy4()) {
- CompareFrame(
- kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
+ CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
} else {
- CompareFrame(
- kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
+ CompareFrame(kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
}
frame.reset(framer.SerializeDataFrameHeaderWithPaddingLengthField(data_ir));
@@ -1770,27 +1641,19 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
{
const char kDescription[] = "Data frame with max stream ID";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x7f, 0xff, 0xff, 0xff,
- 0x01, 0x00, 0x00, 0x05,
- 'h', 'e', 'l', 'l',
- 'o'
- };
- const unsigned char kV4FrameData[] = {
- 0x00, 0x05, 0x00, 0x01,
- 0x7f, 0xff, 0xff, 0xff,
- 'h', 'e', 'l', 'l',
- 'o'
- };
+ const unsigned char kV3FrameData[] = {// Also applies for V2.
+ 0x7f, 0xff, 0xff, 0xff, 0x01, 0x00,
+ 0x00, 0x05, 'h', 'e', 'l', 'l', 'o'};
+ const unsigned char kV4FrameData[] = {0x00, 0x05, 0x00, 0x01, 0x7f,
+ 0xff, 0xff, 0xff, 'h', 'e',
+ 'l', 'l', 'o'};
SpdyDataIR data_ir(0x7fffffff, "hello");
data_ir.set_fin(true);
scoped_ptr<SpdyFrame> frame(framer.SerializeData(data_ir));
if (IsSpdy4()) {
- CompareFrame(
- kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
+ CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
} else {
- CompareFrame(
- kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
+ CompareFrame(kDescription, *frame, kV3FrameData, arraysize(kV3FrameData));
}
}
@@ -1801,8 +1664,7 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
const int kDataSize = 4 * 1024 * 1024; // 4 MB
const string kData(kDataSize, 'A');
const unsigned char kFrameHeader[] = {
- 0x00, 0x00, 0x00, 0x01,
- 0x01, 0x40, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x01, 0x40, 0x00, 0x00,
};
const int kFrameSize = arraysize(kFrameHeader) + kDataSize;
@@ -1827,41 +1689,25 @@ TEST_P(SpdyFramerTest, CreateSynStreamUncompressed) {
const unsigned char kPri = IsSpdy2() ? 0xC0 : 0xE0;
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x20,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00,
- kPri, 0x00, 0x00, 0x02,
- 0x00, 0x03, 'b', 'a',
- 'r', 0x00, 0x03, 'f',
- 'o', 'o', 0x00, 0x03,
- 'f', 'o', 'o', 0x00,
- 0x03, 'b', 'a', 'r'
- };
+ 0x80, spdy_version_ch_, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, kPri, 0x00, 0x00, 0x02,
+ 0x00, 0x03, 'b', 'a', 'r', 0x00, 0x03, 'f', 'o', 'o',
+ 0x00, 0x03, 'f', 'o', 'o', 0x00, 0x03, 'b', 'a', 'r'};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x2a,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00,
- kPri, 0x00, 0x00, 0x00,
- 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x03, 'b', 'a',
- 'r', 0x00, 0x00, 0x00,
- 0x03, 'f', 'o', 'o',
- 0x00, 0x00, 0x00, 0x03,
- 'f', 'o', 'o', 0x00,
- 0x00, 0x00, 0x03, 'b',
- 'a', 'r'
- };
+ 0x80, spdy_version_ch_, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, kPri, 0x00, 0x00, 0x00,
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 'b', 'a', 'r', 0x00,
+ 0x00, 0x00, 0x03, 'f', 'o', 'o', 0x00, 0x00, 0x00, 0x03,
+ 'f', 'o', 'o', 0x00, 0x00, 0x00, 0x03, 'b', 'a', 'r'};
const unsigned char kV4FrameData[] = {
- 0x00, 0x16, 0x01, 0x0c, // HEADERS: PRIORITY | END_HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x00, 0x00, 0x00, 0x07, // Priority 7
- 0x40, 0x03, 0x62, 0x61, // @.ba
- 0x72, 0x03, 0x66, 0x6f, // r.fo
- 0x6f, 0x40, 0x03, 0x66, // o@.f
- 0x6f, 0x6f, 0x03, 0x62, // oo.b
- 0x61, 0x72, // ar
+ 0x00, 0x16, 0x01, 0x0c, // HEADERS: PRIORITY | END_HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x00, 0x00, 0x00, 0x07, // Priority 7
+ 0x40, 0x03, 0x62, 0x61, // @.ba
+ 0x72, 0x03, 0x66, 0x6f, // r.fo
+ 0x6f, 0x40, 0x03, 0x66, // o@.f
+ 0x6f, 0x6f, 0x03, 0x62, // oo.b
+ 0x61, 0x72, // ar
};
SpdySynStreamIR syn_stream(1);
syn_stream.set_priority(framer.GetLowestPriority());
@@ -1883,39 +1729,24 @@ TEST_P(SpdyFramerTest, CreateSynStreamUncompressed) {
"max stream ID";
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x01,
- 0x01, 0x00, 0x00, 0x1D,
- 0x7f, 0xff, 0xff, 0xff,
- 0x7f, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x03,
- 'f', 'o', 'o', 0x00,
- 0x03, 'f', 'o', 'o',
- 0x00, 0x03, 'b', 'a',
- 'r'
- };
+ 0x80, spdy_version_ch_, 0x00, 0x01, 0x01, 0x00, 0x00, 0x1D, 0x7f, 0xff,
+ 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02,
+ 0x00, 0x00, 0x00, 0x03, 'f', 'o', 'o', 0x00, 0x03, 'f',
+ 'o', 'o', 0x00, 0x03, 'b', 'a', 'r'};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x01,
- 0x01, 0x00, 0x00, 0x27,
- 0x7f, 0xff, 0xff, 0xff,
- 0x7f, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x03, 'f', 'o',
- 'o', 0x00, 0x00, 0x00,
- 0x03, 'f', 'o', 'o',
- 0x00, 0x00, 0x00, 0x03,
- 'b', 'a', 'r'
- };
+ 0x80, spdy_version_ch_, 0x00, 0x01, 0x01, 0x00, 0x00, 0x27, 0x7f, 0xff,
+ 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
+ 'f', 'o', 'o', 0x00, 0x00, 0x00, 0x03, 'f', 'o', 'o',
+ 0x00, 0x00, 0x00, 0x03, 'b', 'a', 'r'};
const unsigned char kV4FrameData[] = {
- 0x00, 0x13, 0x01, 0x0d, // HEADERS: PRIORITY | FIN | END_HEADERS
- 0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
- 0x00, 0x00, 0x00, 0x00, // Priority 0
- 0x40, 0x00, 0x03, 0x66, // @..f
- 0x6f, 0x6f, 0x40, 0x03, // oo@.
- 0x66, 0x6f, 0x6f, 0x03, // foo.
- 0x62, 0x61, 0x72, // bar
+ 0x00, 0x13, 0x01, 0x0d, // HEADERS: PRIORITY | FIN | END_HEADERS
+ 0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
+ 0x00, 0x00, 0x00, 0x00, // Priority 0
+ 0x40, 0x00, 0x03, 0x66, // @..f
+ 0x6f, 0x6f, 0x40, 0x03, // oo@.
+ 0x66, 0x6f, 0x6f, 0x03, // foo.
+ 0x62, 0x61, 0x72, // bar
};
SpdySynStreamIR syn_stream(0x7fffffff);
syn_stream.set_associated_to_stream_id(0x7fffffff);
@@ -1940,39 +1771,24 @@ TEST_P(SpdyFramerTest, CreateSynStreamUncompressed) {
const unsigned char kPri = IsSpdy2() ? 0x40 : 0x20;
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x01,
- 0x01, 0x00, 0x00, 0x1D,
- 0x7f, 0xff, 0xff, 0xff,
- 0x7f, 0xff, 0xff, 0xff,
- kPri, 0x00, 0x00, 0x02,
- 0x00, 0x03, 'b', 'a',
- 'r', 0x00, 0x03, 'f',
- 'o', 'o', 0x00, 0x03,
- 'f', 'o', 'o', 0x00,
- 0x00
- };
+ 0x80, spdy_version_ch_, 0x00, 0x01, 0x01, 0x00, 0x00, 0x1D, 0x7f, 0xff,
+ 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, kPri, 0x00, 0x00, 0x02,
+ 0x00, 0x03, 'b', 'a', 'r', 0x00, 0x03, 'f', 'o', 'o',
+ 0x00, 0x03, 'f', 'o', 'o', 0x00, 0x00};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x01,
- 0x01, 0x00, 0x00, 0x27,
- 0x7f, 0xff, 0xff, 0xff,
- 0x7f, 0xff, 0xff, 0xff,
- kPri, 0x00, 0x00, 0x00,
- 0x00, 0x02, 0x00, 0x00,
- 0x00, 0x03, 'b', 'a',
- 'r', 0x00, 0x00, 0x00,
- 0x03, 'f', 'o', 'o',
- 0x00, 0x00, 0x00, 0x03,
- 'f', 'o', 'o', 0x00,
- 0x00, 0x00, 0x00
- };
+ 0x80, spdy_version_ch_, 0x00, 0x01, 0x01, 0x00, 0x00, 0x27, 0x7f, 0xff,
+ 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, kPri, 0x00, 0x00, 0x00,
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 'b', 'a', 'r', 0x00,
+ 0x00, 0x00, 0x03, 'f', 'o', 'o', 0x00, 0x00, 0x00, 0x03,
+ 'f', 'o', 'o', 0x00, 0x00, 0x00, 0x00};
const unsigned char kV4FrameData[] = {
- 0x00, 0x13, 0x01, 0x0d, // HEADERS: PRIORITY | FIN | END_HEADERS
- 0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
- 0x00, 0x00, 0x00, 0x01, // Priority 1
- 0x40, 0x03, 0x62, 0x61, // @.ba
- 0x72, 0x03, 0x66, 0x6f, // r.fo
- 0x6f, 0x40, 0x03, 0x66, // o@.f
- 0x6f, 0x6f, 0x00, // oo.
+ 0x00, 0x13, 0x01, 0x0d, // HEADERS: PRIORITY | FIN | END_HEADERS
+ 0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
+ 0x00, 0x00, 0x00, 0x01, // Priority 1
+ 0x40, 0x03, 0x62, 0x61, // @.ba
+ 0x72, 0x03, 0x66, 0x6f, // r.fo
+ 0x6f, 0x40, 0x03, 0x66, // o@.f
+ 0x6f, 0x6f, 0x00, // oo.
};
SpdySynStreamIR syn_stream(0x7fffffff);
syn_stream.set_associated_to_stream_id(0x7fffffff);
@@ -1999,45 +1815,26 @@ TEST_P(SpdyFramerTest, CreateSynStreamCompressed) {
framer.set_enable_compression(true);
{
- const char kDescription[] =
- "SYN_STREAM frame, low pri, no FIN";
+ const char kDescription[] = "SYN_STREAM frame, low pri, no FIN";
const SpdyPriority priority = IsSpdy2() ? 2 : 4;
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x36,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x00, 0x38, 0xea,
- 0xdf, 0xa2, 0x51, 0xb2,
- 0x62, 0x60, 0x62, 0x60,
- 0x4e, 0x4a, 0x2c, 0x62,
- 0x60, 0x06, 0x08, 0xa0,
- 0xb4, 0xfc, 0x7c, 0x80,
- 0x00, 0x62, 0x60, 0x4e,
- 0xcb, 0xcf, 0x67, 0x60,
- 0x06, 0x08, 0xa0, 0xa4,
- 0xc4, 0x22, 0x80, 0x00,
- 0x02, 0x00, 0x00, 0x00,
- 0xff, 0xff,
+ 0x80, spdy_version_ch_, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
+ 0x38, 0xea, 0xdf, 0xa2, 0x51, 0xb2, 0x62, 0x60, 0x62,
+ 0x60, 0x4e, 0x4a, 0x2c, 0x62, 0x60, 0x06, 0x08, 0xa0,
+ 0xb4, 0xfc, 0x7c, 0x80, 0x00, 0x62, 0x60, 0x4e, 0xcb,
+ 0xcf, 0x67, 0x60, 0x06, 0x08, 0xa0, 0xa4, 0xc4, 0x22,
+ 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff,
};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x37,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x00,
- 0x80, 0x00, 0x38, 0xEA,
- 0xE3, 0xC6, 0xA7, 0xC2,
- 0x02, 0xE5, 0x0E, 0x50,
- 0xC2, 0x4B, 0x4A, 0x04,
- 0xE5, 0x0B, 0x66, 0x80,
- 0x00, 0x4A, 0xCB, 0xCF,
- 0x07, 0x08, 0x20, 0x10,
- 0x95, 0x96, 0x9F, 0x0F,
- 0xA2, 0x00, 0x02, 0x28,
- 0x29, 0xB1, 0x08, 0x20,
- 0x80, 0x00, 0x00, 0x00,
- 0x00, 0xFF, 0xFF,
+ 0x80, spdy_version_ch_, 0x00, 0x01, 0x00, 0x00, 0x00, 0x37, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
+ 0x38, 0xEA, 0xE3, 0xC6, 0xA7, 0xC2, 0x02, 0xE5, 0x0E,
+ 0x50, 0xC2, 0x4B, 0x4A, 0x04, 0xE5, 0x0B, 0x66, 0x80,
+ 0x00, 0x4A, 0xCB, 0xCF, 0x07, 0x08, 0x20, 0x10, 0x95,
+ 0x96, 0x9F, 0x0F, 0xA2, 0x00, 0x02, 0x28, 0x29, 0xB1,
+ 0x08, 0x20, 0x80, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
};
SpdySynStreamIR syn_stream(1);
syn_stream.set_priority(priority);
@@ -2063,37 +1860,24 @@ TEST_P(SpdyFramerTest, CreateSynReplyUncompressed) {
const char kDescription[] = "SYN_REPLY frame, no FIN";
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x1C,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x03, 'b', 'a',
- 'r', 0x00, 0x03, 'f',
- 'o', 'o', 0x00, 0x03,
- 'f', 'o', 'o', 0x00,
- 0x03, 'b', 'a', 'r'
- };
+ 0x80, spdy_version_ch_, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1C, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03,
+ 'b', 'a', 'r', 0x00, 0x03, 'f', 'o', 'o', 0x00,
+ 0x03, 'f', 'o', 'o', 0x00, 0x03, 'b', 'a', 'r'};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x24,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x03,
- 'b', 'a', 'r', 0x00,
- 0x00, 0x00, 0x03, 'f',
- 'o', 'o', 0x00, 0x00,
- 0x00, 0x03, 'f', 'o',
- 'o', 0x00, 0x00, 0x00,
- 0x03, 'b', 'a', 'r'
- };
+ 0x80, spdy_version_ch_, 0x00, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x03, 'b', 'a', 'r', 0x00, 0x00, 0x00, 0x03,
+ 'f', 'o', 'o', 0x00, 0x00, 0x00, 0x03, 'f', 'o',
+ 'o', 0x00, 0x00, 0x00, 0x03, 'b', 'a', 'r'};
const unsigned char kV4FrameData[] = {
- 0x00, 0x12, 0x01, 0x04, // HEADER: END_HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x40, 0x03, 0x62, 0x61, // @.ba
- 0x72, 0x03, 0x66, 0x6f, // r.fo
- 0x6f, 0x40, 0x03, 0x66, // o@.f
- 0x6f, 0x6f, 0x03, 0x62, // oo.b
- 0x61, 0x72, // ar
+ 0x00, 0x12, 0x01, 0x04, // HEADER: END_HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x40, 0x03, 0x62, 0x61, // @.ba
+ 0x72, 0x03, 0x66, 0x6f, // r.fo
+ 0x6f, 0x40, 0x03, 0x66, // o@.f
+ 0x6f, 0x6f, 0x03, 0x62, // oo.b
+ 0x61, 0x72, // ar
};
SpdySynReplyIR syn_reply(1);
syn_reply.SetHeader("bar", "foo");
@@ -2113,36 +1897,23 @@ TEST_P(SpdyFramerTest, CreateSynReplyUncompressed) {
"SYN_REPLY frame with a 0-length header name, FIN, max stream ID";
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x02,
- 0x01, 0x00, 0x00, 0x19,
- 0x7f, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x03,
- 'f', 'o', 'o', 0x00,
- 0x03, 'f', 'o', 'o',
- 0x00, 0x03, 'b', 'a',
- 'r'
- };
+ 0x80, spdy_version_ch_, 0x00, 0x02, 0x01, 0x00, 0x00, 0x19, 0x7f,
+ 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x03, 'f', 'o', 'o', 0x00, 0x03, 'f', 'o',
+ 'o', 0x00, 0x03, 'b', 'a', 'r'};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x02,
- 0x01, 0x00, 0x00, 0x21,
- 0x7f, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x03,
- 'f', 'o', 'o', 0x00,
- 0x00, 0x00, 0x03, 'f',
- 'o', 'o', 0x00, 0x00,
- 0x00, 0x03, 'b', 'a',
- 'r'
- };
+ 0x80, spdy_version_ch_, 0x00, 0x02, 0x01, 0x00, 0x00, 0x21, 0x7f,
+ 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 'f', 'o', 'o',
+ 0x00, 0x00, 0x00, 0x03, 'f', 'o', 'o', 0x00, 0x00,
+ 0x00, 0x03, 'b', 'a', 'r'};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0f, 0x01, 0x05, // HEADER: FIN | END_HEADERS
- 0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
- 0x40, 0x00, 0x03, 0x66, // @..f
- 0x6f, 0x6f, 0x40, 0x03, // oo@.
- 0x66, 0x6f, 0x6f, 0x03, // foo.
- 0x62, 0x61, 0x72, // bar
+ 0x00, 0x0f, 0x01, 0x05, // HEADER: FIN | END_HEADERS
+ 0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
+ 0x40, 0x00, 0x03, 0x66, // @..f
+ 0x6f, 0x6f, 0x40, 0x03, // oo@.
+ 0x66, 0x6f, 0x6f, 0x03, // foo.
+ 0x62, 0x61, 0x72, // bar
};
SpdySynReplyIR syn_reply(0x7fffffff);
syn_reply.set_fin(true);
@@ -2163,36 +1934,23 @@ TEST_P(SpdyFramerTest, CreateSynReplyUncompressed) {
"SYN_REPLY frame with a 0-length header val, FIN, max stream ID";
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x02,
- 0x01, 0x00, 0x00, 0x19,
- 0x7f, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x03, 'b', 'a',
- 'r', 0x00, 0x03, 'f',
- 'o', 'o', 0x00, 0x03,
- 'f', 'o', 'o', 0x00,
- 0x00
- };
+ 0x80, spdy_version_ch_, 0x00, 0x02, 0x01, 0x00, 0x00, 0x19, 0x7f,
+ 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03,
+ 'b', 'a', 'r', 0x00, 0x03, 'f', 'o', 'o', 0x00,
+ 0x03, 'f', 'o', 'o', 0x00, 0x00};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x02,
- 0x01, 0x00, 0x00, 0x21,
- 0x7f, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x03,
- 'b', 'a', 'r', 0x00,
- 0x00, 0x00, 0x03, 'f',
- 'o', 'o', 0x00, 0x00,
- 0x00, 0x03, 'f', 'o',
- 'o', 0x00, 0x00, 0x00,
- 0x00
- };
+ 0x80, spdy_version_ch_, 0x00, 0x02, 0x01, 0x00, 0x00, 0x21, 0x7f,
+ 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x03, 'b', 'a', 'r', 0x00, 0x00, 0x00, 0x03,
+ 'f', 'o', 'o', 0x00, 0x00, 0x00, 0x03, 'f', 'o',
+ 'o', 0x00, 0x00, 0x00, 0x00};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0f, 0x01, 0x05, // HEADER: FIN | END_HEADERS
- 0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
- 0x40, 0x03, 0x62, 0x61, // @.ba
- 0x72, 0x03, 0x66, 0x6f, // r.fo
- 0x6f, 0x40, 0x03, 0x66, // o@.f
- 0x6f, 0x6f, 0x00, // oo.
+ 0x00, 0x0f, 0x01, 0x05, // HEADER: FIN | END_HEADERS
+ 0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
+ 0x40, 0x03, 0x62, 0x61, // @.ba
+ 0x72, 0x03, 0x66, 0x6f, // r.fo
+ 0x6f, 0x40, 0x03, 0x66, // o@.f
+ 0x6f, 0x6f, 0x00, // oo.
};
SpdySynReplyIR syn_reply(0x7fffffff);
syn_reply.set_fin(true);
@@ -2220,38 +1978,20 @@ TEST_P(SpdyFramerTest, CreateSynReplyCompressed) {
const char kDescription[] = "SYN_REPLY frame, no FIN";
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x32,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x38, 0xea,
- 0xdf, 0xa2, 0x51, 0xb2,
- 0x62, 0x60, 0x62, 0x60,
- 0x4e, 0x4a, 0x2c, 0x62,
- 0x60, 0x06, 0x08, 0xa0,
- 0xb4, 0xfc, 0x7c, 0x80,
- 0x00, 0x62, 0x60, 0x4e,
- 0xcb, 0xcf, 0x67, 0x60,
- 0x06, 0x08, 0xa0, 0xa4,
- 0xc4, 0x22, 0x80, 0x00,
- 0x02, 0x00, 0x00, 0x00,
- 0xff, 0xff,
+ 0x80, spdy_version_ch_, 0x00, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x38, 0xea, 0xdf, 0xa2, 0x51, 0xb2,
+ 0x62, 0x60, 0x62, 0x60, 0x4e, 0x4a, 0x2c, 0x62, 0x60, 0x06,
+ 0x08, 0xa0, 0xb4, 0xfc, 0x7c, 0x80, 0x00, 0x62, 0x60, 0x4e,
+ 0xcb, 0xcf, 0x67, 0x60, 0x06, 0x08, 0xa0, 0xa4, 0xc4, 0x22,
+ 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff,
};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x31,
- 0x00, 0x00, 0x00, 0x01,
- 0x38, 0xea, 0xe3, 0xc6,
- 0xa7, 0xc2, 0x02, 0xe5,
- 0x0e, 0x50, 0xc2, 0x4b,
- 0x4a, 0x04, 0xe5, 0x0b,
- 0x66, 0x80, 0x00, 0x4a,
- 0xcb, 0xcf, 0x07, 0x08,
- 0x20, 0x10, 0x95, 0x96,
- 0x9f, 0x0f, 0xa2, 0x00,
- 0x02, 0x28, 0x29, 0xb1,
- 0x08, 0x20, 0x80, 0x00,
- 0x00, 0x00, 0x00, 0xff,
- 0xff,
+ 0x80, spdy_version_ch_, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00,
+ 0x00, 0x01, 0x38, 0xea, 0xe3, 0xc6, 0xa7, 0xc2, 0x02, 0xe5,
+ 0x0e, 0x50, 0xc2, 0x4b, 0x4a, 0x04, 0xe5, 0x0b, 0x66, 0x80,
+ 0x00, 0x4a, 0xcb, 0xcf, 0x07, 0x08, 0x20, 0x10, 0x95, 0x96,
+ 0x9f, 0x0f, 0xa2, 0x00, 0x02, 0x28, 0x29, 0xb1, 0x08, 0x20,
+ 0x80, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
};
SpdySynReplyIR syn_reply(1);
syn_reply.SetHeader("bar", "foo");
@@ -2273,18 +2013,14 @@ TEST_P(SpdyFramerTest, CreateRstStream) {
{
const char kDescription[] = "RST_STREAM frame";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x80, spdy_version_ch_, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x08,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x01,
- };
- const unsigned char kV4FrameData[] = {
- 0x00, 0x07, 0x03, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x01,
- 0x52, 0x53, 0x54
+ const unsigned char kV3FrameData[] = {
+ // Also applies for V2.
+ 0x80, spdy_version_ch_, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
};
+ const unsigned char kV4FrameData[] = {0x00, 0x07, 0x03, 0x00, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x01, 0x52, 0x53, 0x54};
SpdyRstStreamIR rst_stream(1, RST_STREAM_PROTOCOL_ERROR, "RST");
scoped_ptr<SpdyFrame> frame(framer.SerializeRstStream(rst_stream));
if (IsSpdy4()) {
@@ -2296,20 +2032,15 @@ TEST_P(SpdyFramerTest, CreateRstStream) {
{
const char kDescription[] = "RST_STREAM frame with max stream ID";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x80, spdy_version_ch_, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x08,
- 0x7f, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x01,
+ const unsigned char kV3FrameData[] = {
+ // Also applies for V2.
+ 0x80, spdy_version_ch_, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x7f, 0xff,
+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x01,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x04, 0x03, 0x00,
- 0x7f, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x04, 0x03, 0x00, 0x7f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01,
};
- SpdyRstStreamIR rst_stream(0x7FFFFFFF,
- RST_STREAM_PROTOCOL_ERROR,
- "");
+ SpdyRstStreamIR rst_stream(0x7FFFFFFF, RST_STREAM_PROTOCOL_ERROR, "");
scoped_ptr<SpdyFrame> frame(framer.SerializeRstStream(rst_stream));
if (IsSpdy4()) {
CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
@@ -2320,20 +2051,15 @@ TEST_P(SpdyFramerTest, CreateRstStream) {
{
const char kDescription[] = "RST_STREAM frame with max status code";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x80, spdy_version_ch_, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x08,
- 0x7f, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x06,
+ const unsigned char kV3FrameData[] = {
+ // Also applies for V2.
+ 0x80, spdy_version_ch_, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x7f, 0xff,
+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x06,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x04, 0x03, 0x00,
- 0x7f, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x06,
+ 0x00, 0x04, 0x03, 0x00, 0x7f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x06,
};
- SpdyRstStreamIR rst_stream(0x7FFFFFFF,
- RST_STREAM_INTERNAL_ERROR,
- "");
+ SpdyRstStreamIR rst_stream(0x7FFFFFFF, RST_STREAM_INTERNAL_ERROR, "");
scoped_ptr<SpdyFrame> frame(framer.SerializeRstStream(rst_stream));
if (IsSpdy4()) {
CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
@@ -2350,24 +2076,16 @@ TEST_P(SpdyFramerTest, CreateSettings) {
const char kDescription[] = "Network byte order SETTINGS frame";
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x0c,
- 0x00, 0x00, 0x00, 0x01,
- 0x07, 0x00, 0x00, 0x01,
- 0x0a, 0x0b, 0x0c, 0x0d,
+ 0x80, spdy_version_ch_, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00,
+ 0x00, 0x01, 0x07, 0x00, 0x00, 0x01, 0x0a, 0x0b, 0x0c, 0x0d,
};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x0c,
- 0x00, 0x00, 0x00, 0x01,
- 0x01, 0x00, 0x00, 0x07,
- 0x0a, 0x0b, 0x0c, 0x0d,
+ 0x80, spdy_version_ch_, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00,
+ 0x00, 0x01, 0x01, 0x00, 0x00, 0x07, 0x0a, 0x0b, 0x0c, 0x0d,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x05, 0x04, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x0a, 0x0b, 0x0c,
- 0x0d,
+ 0x00, 0x05, 0x04, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x04, 0x0a, 0x0b, 0x0c, 0x0d,
};
uint32 kValue = 0x0a0b0c0d;
@@ -2397,46 +2115,47 @@ TEST_P(SpdyFramerTest, CreateSettings) {
{
const char kDescription[] = "Basic SETTINGS frame";
- const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x24,
- 0x00, 0x00, 0x00, 0x04,
- 0x01, 0x00, 0x00, 0x00, // 1st Setting
- 0x00, 0x00, 0x00, 0x05,
- 0x02, 0x00, 0x00, 0x00, // 2nd Setting
- 0x00, 0x00, 0x00, 0x06,
- 0x03, 0x00, 0x00, 0x00, // 3rd Setting
- 0x00, 0x00, 0x00, 0x07,
- 0x04, 0x00, 0x00, 0x00, // 4th Setting
- 0x00, 0x00, 0x00, 0x08,
- };
- const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x24,
- 0x00, 0x00, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x01, // 1st Setting
- 0x00, 0x00, 0x00, 0x05,
- 0x00, 0x00, 0x00, 0x02, // 2nd Setting
- 0x00, 0x00, 0x00, 0x06,
- 0x00, 0x00, 0x00, 0x03, // 3rd Setting
- 0x00, 0x00, 0x00, 0x07,
- 0x00, 0x00, 0x00, 0x04, // 4th Setting
- 0x00, 0x00, 0x00, 0x08,
- };
+ const unsigned char
+ kV2FrameData
+ [] = {
+ 0x80, spdy_version_ch_, 0x00, 0x04, 0x00, 0x00,
+ 0x00, 0x24, 0x00, 0x00, 0x00, 0x04,
+ 0x01, 0x00, 0x00, 0x00, // 1st Setting
+ 0x00, 0x00, 0x00, 0x05, 0x02, 0x00,
+ 0x00, 0x00, // 2nd Setting
+ 0x00, 0x00, 0x00, 0x06, 0x03, 0x00,
+ 0x00, 0x00, // 3rd Setting
+ 0x00, 0x00, 0x00, 0x07, 0x04, 0x00,
+ 0x00, 0x00, // 4th Setting
+ 0x00, 0x00, 0x00, 0x08,
+ };
+ const unsigned char
+ kV3FrameData
+ [] = {
+ 0x80, spdy_version_ch_, 0x00, 0x04, 0x00, 0x00,
+ 0x00, 0x24, 0x00, 0x00, 0x00, 0x04,
+ 0x00, 0x00, 0x00, 0x01, // 1st Setting
+ 0x00, 0x00, 0x00, 0x05, 0x00, 0x00,
+ 0x00, 0x02, // 2nd Setting
+ 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
+ 0x00, 0x03, // 3rd Setting
+ 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
+ 0x00, 0x04, // 4th Setting
+ 0x00, 0x00, 0x00, 0x08,
+ };
// These end up seemingly out of order because of the way that our internal
// ordering for settings_ir works. HTTP2 has no requirement on ordering on
// the wire.
const unsigned char kV4FrameData[] = {
- 0x00, 0x14, 0x04, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x03, // 3rd Setting
- 0x00, 0x00, 0x00, 0x07,
- 0x04, // 4th Setting
- 0x00, 0x00, 0x00, 0x08,
- 0x01, // 1st Setting
- 0x00, 0x00, 0x00, 0x05,
- 0x02, // 2nd Setting
- 0x00, 0x00, 0x00, 0x06,
+ 0x00, 0x14, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, // 3rd Setting
+ 0x00, 0x00, 0x00, 0x07,
+ 0x04, // 4th Setting
+ 0x00, 0x00, 0x00, 0x08,
+ 0x01, // 1st Setting
+ 0x00, 0x00, 0x00, 0x05,
+ 0x02, // 2nd Setting
+ 0x00, 0x00, 0x00, 0x06,
};
SpdySettingsIR settings_ir;
@@ -2470,14 +2189,13 @@ TEST_P(SpdyFramerTest, CreateSettings) {
{
const char kDescription[] = "Empty SETTINGS frame";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x80, spdy_version_ch_, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x00,
+ const unsigned char kV3FrameData[] = {
+ // Also applies for V2.
+ 0x80, spdy_version_ch_, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
+ 0x00, 0x00,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x00, 0x04, 0x00,
- 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
};
SpdySettingsIR settings_ir;
scoped_ptr<SpdyFrame> frame(framer.SerializeSettings(settings_ir));
@@ -2494,22 +2212,18 @@ TEST_P(SpdyFramerTest, CreatePingFrame) {
{
const char kDescription[] = "PING frame";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x80, spdy_version_ch_, 0x00, 0x06,
- 0x00, 0x00, 0x00, 0x04,
- 0x12, 0x34, 0x56, 0x78,
+ const unsigned char kV3FrameData[] = {
+ // Also applies for V2.
+ 0x80, spdy_version_ch_, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x12, 0x34,
+ 0x56, 0x78,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x08, 0x06, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x12, 0x34, 0x56, 0x78,
- 0x9a, 0xbc, 0xde, 0xff,
+ 0x00, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff,
};
const unsigned char kV4FrameDataWithAck[] = {
- 0x00, 0x08, 0x06, 0x01,
- 0x00, 0x00, 0x00, 0x00,
- 0x12, 0x34, 0x56, 0x78,
- 0x9a, 0xbc, 0xde, 0xff,
+ 0x00, 0x08, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff,
};
scoped_ptr<SpdyFrame> frame;
if (IsSpdy4()) {
@@ -2523,8 +2237,10 @@ TEST_P(SpdyFramerTest, CreatePingFrame) {
// Tests SpdyPingIR when the ping is an ack.
ping_ir.set_is_ack(true);
frame.reset(framer.SerializePing(ping_ir));
- CompareFrame(kDescription, *frame,
- kV4FrameDataWithAck, arraysize(kV4FrameDataWithAck));
+ CompareFrame(kDescription,
+ *frame,
+ kV4FrameDataWithAck,
+ arraysize(kV4FrameDataWithAck));
} else {
frame.reset(framer.SerializePing(SpdyPingIR(0x12345678ull)));
@@ -2539,22 +2255,19 @@ TEST_P(SpdyFramerTest, CreateGoAway) {
{
const char kDescription[] = "GOAWAY frame";
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x07,
- 0x00, 0x00, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x00, // Stream Id
+ 0x80, spdy_version_ch_, 0x00, 0x07, 0x00, 0x00,
+ 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, // Stream Id
};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x07,
- 0x00, 0x00, 0x00, 0x08,
- 0x00, 0x00, 0x00, 0x00, // Stream Id
- 0x00, 0x00, 0x00, 0x00, // Status
+ 0x80, spdy_version_ch_, 0x00, 0x07, 0x00, 0x00,
+ 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, // Stream Id
+ 0x00, 0x00, 0x00, 0x00, // Status
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0a, 0x07, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, // Stream id
- 0x00, 0x00, 0x00, 0x00, // Status
- 0x47, 0x41, // Opaque Description
+ 0x00, 0x0a, 0x07, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Stream id
+ 0x00, 0x00, 0x00, 0x00, // Status
+ 0x47, 0x41, // Opaque Description
};
SpdyGoAwayIR goaway_ir(0, GOAWAY_OK, "GA");
scoped_ptr<SpdyFrame> frame(framer.SerializeGoAway(goaway_ir));
@@ -2570,22 +2283,19 @@ TEST_P(SpdyFramerTest, CreateGoAway) {
{
const char kDescription[] = "GOAWAY frame with max stream ID, status";
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x07,
- 0x00, 0x00, 0x00, 0x04,
- 0x7f, 0xff, 0xff, 0xff, // Stream Id
+ 0x80, spdy_version_ch_, 0x00, 0x07, 0x00, 0x00,
+ 0x00, 0x04, 0x7f, 0xff, 0xff, 0xff, // Stream Id
};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x07,
- 0x00, 0x00, 0x00, 0x08,
- 0x7f, 0xff, 0xff, 0xff, // Stream Id
- 0x00, 0x00, 0x00, 0x02, // Status
+ 0x80, spdy_version_ch_, 0x00, 0x07, 0x00, 0x00,
+ 0x00, 0x08, 0x7f, 0xff, 0xff, 0xff, // Stream Id
+ 0x00, 0x00, 0x00, 0x02, // Status
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0a, 0x07, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x7f, 0xff, 0xff, 0xff, // Stream Id
- 0x00, 0x00, 0x00, 0x02, // Status
- 0x47, 0x41, // Opaque Description
+ 0x00, 0x0a, 0x07, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, // Stream Id
+ 0x00, 0x00, 0x00, 0x02, // Status
+ 0x47, 0x41, // Opaque Description
};
SpdyGoAwayIR goaway_ir(0x7FFFFFFF, GOAWAY_INTERNAL_ERROR, "GA");
scoped_ptr<SpdyFrame> frame(framer.SerializeGoAway(goaway_ir));
@@ -2607,37 +2317,24 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
const char kDescription[] = "HEADERS frame, no FIN";
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x08,
- 0x00, 0x00, 0x00, 0x1C,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x03, 'b', 'a',
- 'r', 0x00, 0x03, 'f',
- 'o', 'o', 0x00, 0x03,
- 'f', 'o', 'o', 0x00,
- 0x03, 'b', 'a', 'r'
- };
+ 0x80, spdy_version_ch_, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1C, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03,
+ 'b', 'a', 'r', 0x00, 0x03, 'f', 'o', 'o', 0x00,
+ 0x03, 'f', 'o', 'o', 0x00, 0x03, 'b', 'a', 'r'};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x08,
- 0x00, 0x00, 0x00, 0x24,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x03,
- 'b', 'a', 'r', 0x00,
- 0x00, 0x00, 0x03, 'f',
- 'o', 'o', 0x00, 0x00,
- 0x00, 0x03, 'f', 'o',
- 'o', 0x00, 0x00, 0x00,
- 0x03, 'b', 'a', 'r'
- };
+ 0x80, spdy_version_ch_, 0x00, 0x08, 0x00, 0x00, 0x00, 0x24, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x03, 'b', 'a', 'r', 0x00, 0x00, 0x00, 0x03,
+ 'f', 'o', 'o', 0x00, 0x00, 0x00, 0x03, 'f', 'o',
+ 'o', 0x00, 0x00, 0x00, 0x03, 'b', 'a', 'r'};
const unsigned char kV4FrameData[] = {
- 0x00, 0x12, 0x01, 0x04, // Headers: END_HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x40, 0x03, 0x62, 0x61, // @.ba
- 0x72, 0x03, 0x66, 0x6f, // r.fo
- 0x6f, 0x40, 0x03, 0x66, // o@.f
- 0x6f, 0x6f, 0x03, 0x62, // oo.b
- 0x61, 0x72, // ar
+ 0x00, 0x12, 0x01, 0x04, // Headers: END_HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x40, 0x03, 0x62, 0x61, // @.ba
+ 0x72, 0x03, 0x66, 0x6f, // r.fo
+ 0x6f, 0x40, 0x03, 0x66, // o@.f
+ 0x6f, 0x6f, 0x03, 0x62, // oo.b
+ 0x61, 0x72, // ar
};
SpdyHeadersIR headers_ir(1);
headers_ir.SetHeader("bar", "foo");
@@ -2657,36 +2354,23 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
"HEADERS frame with a 0-length header name, FIN, max stream ID";
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x08,
- 0x01, 0x00, 0x00, 0x19,
- 0x7f, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x03,
- 'f', 'o', 'o', 0x00,
- 0x03, 'f', 'o', 'o',
- 0x00, 0x03, 'b', 'a',
- 'r'
- };
+ 0x80, spdy_version_ch_, 0x00, 0x08, 0x01, 0x00, 0x00, 0x19, 0x7f,
+ 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x03, 'f', 'o', 'o', 0x00, 0x03, 'f', 'o',
+ 'o', 0x00, 0x03, 'b', 'a', 'r'};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x08,
- 0x01, 0x00, 0x00, 0x21,
- 0x7f, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x03,
- 'f', 'o', 'o', 0x00,
- 0x00, 0x00, 0x03, 'f',
- 'o', 'o', 0x00, 0x00,
- 0x00, 0x03, 'b', 'a',
- 'r'
- };
+ 0x80, spdy_version_ch_, 0x00, 0x08, 0x01, 0x00, 0x00, 0x21, 0x7f,
+ 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 'f', 'o', 'o',
+ 0x00, 0x00, 0x00, 0x03, 'f', 'o', 'o', 0x00, 0x00,
+ 0x00, 0x03, 'b', 'a', 'r'};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0f, 0x01, 0x05, // HEADER: FIN | END_HEADERS
- 0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
- 0x40, 0x00, 0x03, 0x66, // @..f
- 0x6f, 0x6f, 0x40, 0x03, // oo@.
- 0x66, 0x6f, 0x6f, 0x03, // foo.
- 0x62, 0x61, 0x72, // bar
+ 0x00, 0x0f, 0x01, 0x05, // HEADER: FIN | END_HEADERS
+ 0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
+ 0x40, 0x00, 0x03, 0x66, // @..f
+ 0x6f, 0x6f, 0x40, 0x03, // oo@.
+ 0x66, 0x6f, 0x6f, 0x03, // foo.
+ 0x62, 0x61, 0x72, // bar
};
SpdyHeadersIR headers_ir(0x7fffffff);
headers_ir.set_fin(true);
@@ -2707,40 +2391,27 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
"HEADERS frame with a 0-length header val, FIN, max stream ID";
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x08,
- 0x01, 0x00, 0x00, 0x19,
- 0x7f, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x03, 'b', 'a',
- 'r', 0x00, 0x03, 'f',
- 'o', 'o', 0x00, 0x03,
- 'f', 'o', 'o', 0x00,
- 0x00
- };
+ 0x80, spdy_version_ch_, 0x00, 0x08, 0x01, 0x00, 0x00, 0x19, 0x7f,
+ 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03,
+ 'b', 'a', 'r', 0x00, 0x03, 'f', 'o', 'o', 0x00,
+ 0x03, 'f', 'o', 'o', 0x00, 0x00};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x08,
- 0x01, 0x00, 0x00, 0x21,
- 0x7f, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x03,
- 'b', 'a', 'r', 0x00,
- 0x00, 0x00, 0x03, 'f',
- 'o', 'o', 0x00, 0x00,
- 0x00, 0x03, 'f', 'o',
- 'o', 0x00, 0x00, 0x00,
- 0x00
- };
+ 0x80, spdy_version_ch_, 0x00, 0x08, 0x01, 0x00, 0x00, 0x21, 0x7f,
+ 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x03, 'b', 'a', 'r', 0x00, 0x00, 0x00, 0x03,
+ 'f', 'o', 'o', 0x00, 0x00, 0x00, 0x03, 'f', 'o',
+ 'o', 0x00, 0x00, 0x00, 0x00};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0f, 0x01, 0x05, // HEADER: FIN | END_HEADERS
- 0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
- 0x40, 0x03, 0x62, 0x61, // @.ba
- 0x72, 0x03, 0x66, 0x6f, // r.fo
- 0x6f, 0x40, 0x03, 0x66, // o@.f
- 0x6f, 0x6f, 0x00, // oo.
+ 0x00, 0x0f, 0x01, 0x05, // HEADER: FIN | END_HEADERS
+ 0x7f, 0xff, 0xff, 0xff, // Stream 0x7fffffff
+ 0x40, 0x03, 0x62, 0x61, // @.ba
+ 0x72, 0x03, 0x66, 0x6f, // r.fo
+ 0x6f, 0x40, 0x03, 0x66, // o@.f
+ 0x6f, 0x6f, 0x00, // oo.
};
SpdyHeadersIR headers_ir(0x7fffffff);
headers_ir.set_fin(true);
- headers_ir.SetHeader("bar", "foo");
+ headers_ir.SetHeader("bar", "foo");
headers_ir.SetHeader("foo", "");
scoped_ptr<SpdyFrame> frame(framer.SerializeHeaders(headers_ir));
if (IsSpdy2()) {
@@ -2764,38 +2435,20 @@ TEST_P(SpdyFramerTest, CreateHeadersCompressed) {
const char kDescription[] = "HEADERS frame, no FIN";
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x08,
- 0x00, 0x00, 0x00, 0x32,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x38, 0xea,
- 0xdf, 0xa2, 0x51, 0xb2,
- 0x62, 0x60, 0x62, 0x60,
- 0x4e, 0x4a, 0x2c, 0x62,
- 0x60, 0x06, 0x08, 0xa0,
- 0xb4, 0xfc, 0x7c, 0x80,
- 0x00, 0x62, 0x60, 0x4e,
- 0xcb, 0xcf, 0x67, 0x60,
- 0x06, 0x08, 0xa0, 0xa4,
- 0xc4, 0x22, 0x80, 0x00,
- 0x02, 0x00, 0x00, 0x00,
- 0xff, 0xff,
+ 0x80, spdy_version_ch_, 0x00, 0x08, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x38, 0xea, 0xdf, 0xa2, 0x51, 0xb2,
+ 0x62, 0x60, 0x62, 0x60, 0x4e, 0x4a, 0x2c, 0x62, 0x60, 0x06,
+ 0x08, 0xa0, 0xb4, 0xfc, 0x7c, 0x80, 0x00, 0x62, 0x60, 0x4e,
+ 0xcb, 0xcf, 0x67, 0x60, 0x06, 0x08, 0xa0, 0xa4, 0xc4, 0x22,
+ 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff,
};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x08,
- 0x00, 0x00, 0x00, 0x31,
- 0x00, 0x00, 0x00, 0x01,
- 0x38, 0xea, 0xe3, 0xc6,
- 0xa7, 0xc2, 0x02, 0xe5,
- 0x0e, 0x50, 0xc2, 0x4b,
- 0x4a, 0x04, 0xe5, 0x0b,
- 0x66, 0x80, 0x00, 0x4a,
- 0xcb, 0xcf, 0x07, 0x08,
- 0x20, 0x10, 0x95, 0x96,
- 0x9f, 0x0f, 0xa2, 0x00,
- 0x02, 0x28, 0x29, 0xb1,
- 0x08, 0x20, 0x80, 0x00,
- 0x00, 0x00, 0x00, 0xff,
- 0xff,
+ 0x80, spdy_version_ch_, 0x00, 0x08, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00,
+ 0x00, 0x01, 0x38, 0xea, 0xe3, 0xc6, 0xa7, 0xc2, 0x02, 0xe5,
+ 0x0e, 0x50, 0xc2, 0x4b, 0x4a, 0x04, 0xe5, 0x0b, 0x66, 0x80,
+ 0x00, 0x4a, 0xcb, 0xcf, 0x07, 0x08, 0x20, 0x10, 0x95, 0x96,
+ 0x9f, 0x0f, 0xa2, 0x00, 0x02, 0x28, 0x29, 0xb1, 0x08, 0x20,
+ 0x80, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
};
SpdyHeadersIR headers_ir(1);
headers_ir.SetHeader("bar", "foo");
@@ -2817,16 +2470,13 @@ TEST_P(SpdyFramerTest, CreateWindowUpdate) {
{
const char kDescription[] = "WINDOW_UPDATE frame";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x80, spdy_version_ch_, 0x00, 0x09,
- 0x00, 0x00, 0x00, 0x08,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x01,
+ const unsigned char kV3FrameData[] = {
+ // Also applies for V2.
+ 0x80, spdy_version_ch_, 0x00, 0x09, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x04, 0x08, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
};
scoped_ptr<SpdyFrame> frame(
framer.SerializeWindowUpdate(SpdyWindowUpdateIR(1, 1)));
@@ -2839,19 +2489,16 @@ TEST_P(SpdyFramerTest, CreateWindowUpdate) {
{
const char kDescription[] = "WINDOW_UPDATE frame with max stream ID";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x80, spdy_version_ch_, 0x00, 0x09,
- 0x00, 0x00, 0x00, 0x08,
- 0x7f, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x01,
+ const unsigned char kV3FrameData[] = {
+ // Also applies for V2.
+ 0x80, spdy_version_ch_, 0x00, 0x09, 0x00, 0x00, 0x00, 0x08, 0x7f, 0xff,
+ 0xff, 0xff, 0x00, 0x00, 0x00, 0x01,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x04, 0x08, 0x00,
- 0x7f, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x04, 0x08, 0x00, 0x7f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01,
};
- scoped_ptr<SpdyFrame> frame(framer.SerializeWindowUpdate(
- SpdyWindowUpdateIR(0x7FFFFFFF, 1)));
+ scoped_ptr<SpdyFrame> frame(
+ framer.SerializeWindowUpdate(SpdyWindowUpdateIR(0x7FFFFFFF, 1)));
if (IsSpdy4()) {
CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
} else {
@@ -2861,19 +2508,16 @@ TEST_P(SpdyFramerTest, CreateWindowUpdate) {
{
const char kDescription[] = "WINDOW_UPDATE frame with max window delta";
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x80, spdy_version_ch_, 0x00, 0x09,
- 0x00, 0x00, 0x00, 0x08,
- 0x00, 0x00, 0x00, 0x01,
- 0x7f, 0xff, 0xff, 0xff,
+ const unsigned char kV3FrameData[] = {
+ // Also applies for V2.
+ 0x80, spdy_version_ch_, 0x00, 0x09, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
+ 0x00, 0x01, 0x7f, 0xff, 0xff, 0xff,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x04, 0x08, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x7f, 0xff, 0xff, 0xff,
+ 0x00, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x01, 0x7f, 0xff, 0xff, 0xff,
};
- scoped_ptr<SpdyFrame> frame(framer.SerializeWindowUpdate(
- SpdyWindowUpdateIR(1, 0x7FFFFFFF)));
+ scoped_ptr<SpdyFrame> frame(
+ framer.SerializeWindowUpdate(SpdyWindowUpdateIR(1, 0x7FFFFFFF)));
if (IsSpdy4()) {
CompareFrame(kDescription, *frame, kV4FrameData, arraysize(kV4FrameData));
} else {
@@ -2891,8 +2535,7 @@ TEST_P(SpdyFramerTest, SerializeBlocked) {
const char kDescription[] = "BLOCKED frame";
const unsigned char kFrameData[] = {
- 0x00, 0x00, 0x0a, 0x00,
- 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00,
};
SpdyBlockedIR blocked_ir(0);
scoped_ptr<SpdySerializedFrame> frame(framer.SerializeFrame(blocked_ir));
@@ -2913,7 +2556,7 @@ TEST_P(SpdyFramerTest, CreateBlocked) {
framer.SerializeBlocked(SpdyBlockedIR(kStreamId)));
SpdyBlockedIR blocked_ir(kStreamId);
scoped_ptr<SpdySerializedFrame> frame_created(
- framer.SerializeFrame(blocked_ir));
+ framer.SerializeFrame(blocked_ir));
CompareFrames(kDescription, *frame_serialized, *frame_created);
}
@@ -2928,21 +2571,21 @@ TEST_P(SpdyFramerTest, CreatePushPromiseUncompressed) {
const char kDescription[] = "PUSH_PROMISE frame";
const unsigned char kFrameData[] = {
- 0x00, 0x16, 0x05, 0x04, // PUSH_PROMISE: END_HEADERS
- 0x00, 0x00, 0x00, 0x2a, // Stream 42
- 0x00, 0x00, 0x00, 0x39, // Promised stream 57
- 0x40, 0x03, 0x62, 0x61, // @.ba
- 0x72, 0x03, 0x66, 0x6f, // r.fo
- 0x6f, 0x40, 0x03, 0x66, // o@.f
- 0x6f, 0x6f, 0x03, 0x62, // oo.b
- 0x61, 0x72, // ar
+ 0x00, 0x16, 0x05, 0x04, // PUSH_PROMISE: END_HEADERS
+ 0x00, 0x00, 0x00, 0x2a, // Stream 42
+ 0x00, 0x00, 0x00, 0x39, // Promised stream 57
+ 0x40, 0x03, 0x62, 0x61, // @.ba
+ 0x72, 0x03, 0x66, 0x6f, // r.fo
+ 0x6f, 0x40, 0x03, 0x66, // o@.f
+ 0x6f, 0x6f, 0x03, 0x62, // oo.b
+ 0x61, 0x72, // ar
};
SpdyPushPromiseIR push_promise(42, 57);
push_promise.SetHeader("bar", "foo");
push_promise.SetHeader("foo", "bar");
scoped_ptr<SpdySerializedFrame> frame(
- framer.SerializePushPromise(push_promise));
+ framer.SerializePushPromise(push_promise));
CompareFrame(kDescription, *frame, kFrameData, arraysize(kFrameData));
}
@@ -3096,8 +2739,7 @@ TEST_P(SpdyFramerTest, ControlFrameTooLarge) {
control_frame.reset(framer.SerializeSynStream(syn_stream));
EXPECT_TRUE(control_frame.get() != NULL);
- EXPECT_EQ(framer.GetControlFrameBufferMaxSize() + 1,
- control_frame->size());
+ EXPECT_EQ(framer.GetControlFrameBufferMaxSize() + 1, control_frame->size());
TestSpdyVisitor visitor(spdy_version_);
visitor.SimulateInFramer(
@@ -3242,12 +2884,12 @@ TEST_P(SpdyFramerTest, ControlFrameSizesAreValidated) {
// Create a GoAway frame that has a few extra bytes at the end.
// We create enough overhead to overflow the framer's control frame buffer.
ASSERT_GE(250u, SpdyFramer::kControlFrameBufferSize);
- const unsigned char length = 1 + SpdyFramer::kControlFrameBufferSize;
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x80, spdy_version_ch_, 0x00, 0x07,
- 0x00, 0x00, 0x00, length,
- 0x00, 0x00, 0x00, 0x00, // Stream ID
- 0x00, 0x00, 0x00, 0x00, // Status
+ const unsigned char length = 1 + SpdyFramer::kControlFrameBufferSize;
+ const unsigned char kV3FrameData[] = {
+ // Also applies for V2.
+ 0x80, spdy_version_ch_, 0x00, 0x07, 0x00, 0x00, 0x00, length, 0x00, 0x00,
+ 0x00, 0x00, // Stream ID
+ 0x00, 0x00, 0x00, 0x00, // Status
};
// SPDY version 4 and up GOAWAY frames are only bound to a minimal length,
@@ -3255,10 +2897,10 @@ TEST_P(SpdyFramerTest, ControlFrameSizesAreValidated) {
const unsigned char less_than_min_length =
framer.GetGoAwayMinimumSize() - framer.GetControlFrameHeaderSize() - 1;
const unsigned char kV4FrameData[] = {
- 0x00, static_cast<uint8>(less_than_min_length), 0x07, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, // Stream Id
- 0x00, 0x00, 0x00, 0x00, // Status
+ 0x00, static_cast<uint8>(less_than_min_length), 0x07, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, // Stream Id
+ 0x00, 0x00, 0x00, 0x00, // Status
};
const size_t pad_length =
length + framer.GetControlFrameHeaderSize() -
@@ -3271,9 +2913,8 @@ TEST_P(SpdyFramerTest, ControlFrameSizesAreValidated) {
} else {
visitor.SimulateInFramer(kV3FrameData, sizeof(kV3FrameData));
}
- visitor.SimulateInFramer(
- reinterpret_cast<const unsigned char*>(pad.c_str()),
- pad.length());
+ visitor.SimulateInFramer(reinterpret_cast<const unsigned char*>(pad.c_str()),
+ pad.length());
EXPECT_EQ(1, visitor.error_count_); // This generated an error.
EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME,
@@ -3308,10 +2949,8 @@ TEST_P(SpdyFramerTest, ReadBogusLenSettingsFrame) {
// Add a setting to pad the frame so that we don't get a buffer overflow when
// calling SimulateInFramer() below.
- settings_ir.AddSetting(SETTINGS_INITIAL_WINDOW_SIZE,
- false,
- false,
- 0x00000002);
+ settings_ir.AddSetting(
+ SETTINGS_INITIAL_WINDOW_SIZE, false, false, 0x00000002);
scoped_ptr<SpdyFrame> control_frame(framer.SerializeSettings(settings_ir));
const size_t kNewLength = 14;
SetFrameLength(control_frame.get(), kNewLength, spdy_version_);
@@ -3343,8 +2982,7 @@ TEST_P(SpdyFramerTest, ReadLargeSettingsFrame) {
7);
scoped_ptr<SpdyFrame> control_frame(framer.SerializeSettings(settings_ir));
- EXPECT_LT(SpdyFramer::kControlFrameBufferSize,
- control_frame->size());
+ EXPECT_LT(SpdyFramer::kControlFrameBufferSize, control_frame->size());
TestSpdyVisitor visitor(spdy_version_);
visitor.use_compression_ = false;
@@ -3382,36 +3020,35 @@ TEST_P(SpdyFramerTest, ReadDuplicateSettings) {
SpdyFramer framer(spdy_version_);
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x1C,
- 0x00, 0x00, 0x00, 0x03,
- 0x01, 0x00, 0x00, 0x00, // 1st Setting
- 0x00, 0x00, 0x00, 0x02,
- 0x01, 0x00, 0x00, 0x00, // 2nd (duplicate) Setting
- 0x00, 0x00, 0x00, 0x03,
- 0x03, 0x00, 0x00, 0x00, // 3rd (unprocessed) Setting
- 0x00, 0x00, 0x00, 0x03,
+ 0x80, spdy_version_ch_, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1C, 0x00,
+ 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x00, // 1st Setting
+ 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, // 2nd
+ // (duplicate)
+ // Setting
+ 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, // 3rd
+ // (unprocessed)
+ // Setting
+ 0x00, 0x00, 0x00, 0x03,
};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x1C,
- 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x01, // 1st Setting
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x01, // 2nd (duplicate) Setting
- 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x03, // 3rd (unprocessed) Setting
- 0x00, 0x00, 0x00, 0x03,
+ 0x80, spdy_version_ch_, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1C, 0x00,
+ 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, // 1st Setting
+ 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, // 2nd
+ // (duplicate)
+ // Setting
+ 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, // 3rd
+ // (unprocessed)
+ // Setting
+ 0x00, 0x00, 0x00, 0x03,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0f, 0x04, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x01, // 1st Setting
- 0x00, 0x00, 0x00, 0x02,
- 0x01, // 2nd (duplicate) Setting
- 0x00, 0x00, 0x00, 0x03,
- 0x03, // 3rd (unprocessed) Setting
- 0x00, 0x00, 0x00, 0x03,
+ 0x00, 0x0f, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, // 1st Setting
+ 0x00, 0x00, 0x00, 0x02,
+ 0x01, // 2nd (duplicate) Setting
+ 0x00, 0x00, 0x00, 0x03,
+ 0x03, // 3rd (unprocessed) Setting
+ 0x00, 0x00, 0x00, 0x03,
};
TestSpdyVisitor visitor(spdy_version_);
@@ -3441,36 +3078,35 @@ TEST_P(SpdyFramerTest, ReadOutOfOrderSettings) {
SpdyFramer framer(spdy_version_);
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x1C,
- 0x00, 0x00, 0x00, 0x03,
- 0x02, 0x00, 0x00, 0x00, // 1st Setting
- 0x00, 0x00, 0x00, 0x02,
- 0x01, 0x00, 0x00, 0x00, // 2nd (out of order) Setting
- 0x00, 0x00, 0x00, 0x03,
- 0x03, 0x00, 0x00, 0x00, // 3rd (unprocessed) Setting
- 0x00, 0x00, 0x00, 0x03,
+ 0x80, spdy_version_ch_, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1C, 0x00,
+ 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, // 1st Setting
+ 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, // 2nd (out
+ // of order)
+ // Setting
+ 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, // 3rd
+ // (unprocessed)
+ // Setting
+ 0x00, 0x00, 0x00, 0x03,
};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x04,
- 0x00, 0x00, 0x00, 0x1C,
- 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x02, // 1st Setting
- 0x00, 0x00, 0x00, 0x02,
- 0x00, 0x00, 0x00, 0x01, // 2nd (out of order) Setting
- 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x01, 0x03, // 3rd (unprocessed) Setting
- 0x00, 0x00, 0x00, 0x03,
+ 0x80, spdy_version_ch_, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1C, 0x00,
+ 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, // 1st Setting
+ 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, // 2nd (out
+ // of order)
+ // Setting
+ 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0x03, // 3rd
+ // (unprocessed)
+ // Setting
+ 0x00, 0x00, 0x00, 0x03,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x0f, 0x04, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0x02, // 1st Setting
- 0x00, 0x00, 0x00, 0x02,
- 0x01, // 2nd (out of order) Setting
- 0x00, 0x00, 0x00, 0x03,
- 0x03, // 3rd (unprocessed) Setting
- 0x00, 0x00, 0x00, 0x03,
+ 0x00, 0x0f, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, // 1st Setting
+ 0x00, 0x00, 0x00, 0x02,
+ 0x01, // 2nd (out of order) Setting
+ 0x00, 0x00, 0x00, 0x03,
+ 0x03, // 3rd (unprocessed) Setting
+ 0x00, 0x00, 0x00, 0x03,
};
TestSpdyVisitor visitor(spdy_version_);
@@ -3501,8 +3137,7 @@ TEST_P(SpdyFramerTest, ProcessSettingsAckFrame) {
SpdyFramer framer(spdy_version_);
const unsigned char kFrameData[] = {
- 0x00, 0x00, 0x04, 0x01,
- 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00,
};
TestSpdyVisitor visitor(spdy_version_);
@@ -3514,7 +3149,6 @@ TEST_P(SpdyFramerTest, ProcessSettingsAckFrame) {
EXPECT_EQ(1, visitor.settings_ack_received_);
}
-
TEST_P(SpdyFramerTest, ProcessDataFrameWithPadding) {
if (spdy_version_ <= SPDY3) {
return;
@@ -3535,9 +3169,8 @@ TEST_P(SpdyFramerTest, ProcessDataFrameWithPadding) {
int bytes_consumed = 0;
// Send the frame header.
- EXPECT_CALL(visitor, OnDataFrameHeader(1,
- kPaddingLen + strlen(data_payload),
- false));
+ EXPECT_CALL(visitor,
+ OnDataFrameHeader(1, kPaddingLen + strlen(data_payload), false));
CHECK_EQ(8u, framer.ProcessInput(frame->data(), 8));
CHECK_EQ(framer.state(), SpdyFramer::SPDY_READ_PADDING_LENGTH);
CHECK_EQ(framer.error_code(), SpdyFramer::SPDY_NO_ERROR);
@@ -3600,22 +3233,13 @@ TEST_P(SpdyFramerTest, ReceiveCredentialFrame) {
return;
}
SpdyFramer framer(spdy_version_);
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x80, spdy_version_ch_, 0x00, 0x0A,
- 0x00, 0x00, 0x00, 0x33,
- 0x00, 0x03, 0x00, 0x00,
- 0x00, 0x05, 'p', 'r',
- 'o', 'o', 'f', 0x00,
- 0x00, 0x00, 0x06, 'a',
- ' ', 'c', 'e', 'r',
- 't', 0x00, 0x00, 0x00,
- 0x0C, 'a', 'n', 'o',
- 't', 'h', 'e', 'r',
- ' ', 'c', 'e', 'r',
- 't', 0x00, 0x00, 0x00,
- 0x0A, 'f', 'i', 'n',
- 'a', 'l', ' ', 'c',
- 'e', 'r', 't',
+ const unsigned char kV3FrameData[] = {
+ // Also applies for V2.
+ 0x80, spdy_version_ch_, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x33, 0x00, 0x03,
+ 0x00, 0x00, 0x00, 0x05, 'p', 'r', 'o', 'o', 'f', 0x00, 0x00, 0x00, 0x06,
+ 'a', ' ', 'c', 'e', 'r', 't', 0x00, 0x00, 0x00, 0x0C, 'a', 'n', 'o', 't',
+ 'h', 'e', 'r', ' ', 'c', 'e', 'r', 't', 0x00, 0x00, 0x00, 0x0A, 'f', 'i',
+ 'n', 'a', 'l', ' ', 'c', 'e', 'r', 't',
};
TestSpdyVisitor visitor(spdy_version_);
visitor.use_compression_ = false;
@@ -3628,22 +3252,13 @@ TEST_P(SpdyFramerTest, ReadCredentialFrameFollowedByAnotherFrame) {
return;
}
SpdyFramer framer(spdy_version_);
- const unsigned char kV3FrameData[] = { // Also applies for V2.
- 0x80, spdy_version_ch_, 0x00, 0x0A,
- 0x00, 0x00, 0x00, 0x33,
- 0x00, 0x03, 0x00, 0x00,
- 0x00, 0x05, 'p', 'r',
- 'o', 'o', 'f', 0x00,
- 0x00, 0x00, 0x06, 'a',
- ' ', 'c', 'e', 'r',
- 't', 0x00, 0x00, 0x00,
- 0x0C, 'a', 'n', 'o',
- 't', 'h', 'e', 'r',
- ' ', 'c', 'e', 'r',
- 't', 0x00, 0x00, 0x00,
- 0x0A, 'f', 'i', 'n',
- 'a', 'l', ' ', 'c',
- 'e', 'r', 't',
+ const unsigned char kV3FrameData[] = {
+ // Also applies for V2.
+ 0x80, spdy_version_ch_, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x33, 0x00, 0x03,
+ 0x00, 0x00, 0x00, 0x05, 'p', 'r', 'o', 'o', 'f', 0x00, 0x00, 0x00, 0x06,
+ 'a', ' ', 'c', 'e', 'r', 't', 0x00, 0x00, 0x00, 0x0C, 'a', 'n', 'o', 't',
+ 'h', 'e', 'r', ' ', 'c', 'e', 'r', 't', 0x00, 0x00, 0x00, 0x0A, 'f', 'i',
+ 'n', 'a', 'l', ' ', 'c', 'e', 'r', 't',
};
TestSpdyVisitor visitor(spdy_version_);
visitor.use_compression_ = false;
@@ -3651,8 +3266,8 @@ TEST_P(SpdyFramerTest, ReadCredentialFrameFollowedByAnotherFrame) {
arraysize(kV3FrameData));
scoped_ptr<SpdyFrame> control_frame(
framer.SerializeWindowUpdate(SpdyWindowUpdateIR(1, 2)));
- multiple_frame_data.append(string(control_frame->data(),
- control_frame->size()));
+ multiple_frame_data.append(
+ string(control_frame->data(), control_frame->size()));
visitor.SimulateInFramer(
reinterpret_cast<unsigned const char*>(multiple_frame_data.data()),
multiple_frame_data.length());
@@ -3671,20 +3286,20 @@ TEST_P(SpdyFramerTest, CreateContinuationUncompressed) {
const char kDescription[] = "CONTINUATION frame";
const unsigned char kFrameData[] = {
- 0x00, 0x12, 0x09, 0x00, // CONTINUATION
- 0x00, 0x00, 0x00, 0x2a, // Stream 42
- 0x40, 0x03, 0x62, 0x61, // @.ba
- 0x72, 0x03, 0x66, 0x6f, // r.fo
- 0x6f, 0x40, 0x03, 0x66, // o@.f
- 0x6f, 0x6f, 0x03, 0x62, // oo.b
- 0x61, 0x72, // ar
+ 0x00, 0x12, 0x09, 0x00, // CONTINUATION
+ 0x00, 0x00, 0x00, 0x2a, // Stream 42
+ 0x40, 0x03, 0x62, 0x61, // @.ba
+ 0x72, 0x03, 0x66, 0x6f, // r.fo
+ 0x6f, 0x40, 0x03, 0x66, // o@.f
+ 0x6f, 0x6f, 0x03, 0x62, // oo.b
+ 0x61, 0x72, // ar
};
SpdyContinuationIR continuation(42);
continuation.SetHeader("bar", "foo");
continuation.SetHeader("foo", "bar");
scoped_ptr<SpdySerializedFrame> frame(
- framer.SerializeContinuation(continuation));
+ framer.SerializeContinuation(continuation));
CompareFrame(kDescription, *frame, kFrameData, arraysize(kFrameData));
}
@@ -3699,13 +3314,12 @@ TEST_P(SpdyFramerTest, ReadCompressedPushPromise) {
push_promise.SetHeader("bar", "foofoo");
SpdyHeaderBlock headers = push_promise.name_value_block();
scoped_ptr<SpdySerializedFrame> frame(
- framer.SerializePushPromise(push_promise));
+ framer.SerializePushPromise(push_promise));
EXPECT_TRUE(frame.get() != NULL);
TestSpdyVisitor visitor(spdy_version_);
visitor.use_compression_ = true;
- visitor.SimulateInFramer(
- reinterpret_cast<unsigned char*>(frame->data()),
- frame->size());
+ visitor.SimulateInFramer(reinterpret_cast<unsigned char*>(frame->data()),
+ frame->size());
EXPECT_EQ(42u, visitor.last_push_promise_stream_);
EXPECT_EQ(57u, visitor.last_push_promise_promised_stream_);
EXPECT_TRUE(CompareHeaderBlocks(&headers, &visitor.headers_));
@@ -3717,28 +3331,17 @@ TEST_P(SpdyFramerTest, ReadHeadersWithContinuation) {
}
const unsigned char kInput[] = {
- 0x00, 0x10, 0x01, 0x00, // HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x40, 0x06, 0x43, 0x6f,
- 0x6f, 0x6b, 0x69, 0x65,
- 0x07, 0x66, 0x6f, 0x6f,
- 0x3d, 0x62, 0x61, 0x72,
-
- 0x00, 0x14, 0x09, 0x00, // CONTINUATION
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x40, 0x06, 0x43, 0x6f,
- 0x6f, 0x6b, 0x69, 0x65,
- 0x08, 0x62, 0x61, 0x7a,
- 0x3d, 0x62, 0x69, 0x6e,
- 0x67, 0x40, 0x06, 0x43,
-
- 0x00, 0x12, 0x09, 0x04, // CONTINUATION: END_HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x6f, 0x6f, 0x6b, 0x69,
- 0x65, 0x00, 0x40, 0x04,
- 0x6e, 0x61, 0x6d, 0x65,
- 0x05, 0x76, 0x61, 0x6c,
- 0x75, 0x65,
+ 0x00, 0x10, 0x01, 0x00, // HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x40, 0x06, 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x07, 0x66, 0x6f,
+ 0x6f, 0x3d, 0x62, 0x61, 0x72, 0x00, 0x14, 0x09, 0x00, // CONTINUATION
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x40, 0x06, 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x08, 0x62, 0x61,
+ 0x7a, 0x3d, 0x62, 0x69, 0x6e, 0x67, 0x40, 0x06, 0x43, 0x00, 0x12,
+ 0x09, 0x04, // CONTINUATION: END_HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x00, 0x40, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
};
SpdyFramer framer(spdy_version_);
@@ -3751,9 +3354,9 @@ TEST_P(SpdyFramerTest, ReadHeadersWithContinuation) {
EXPECT_EQ(1, visitor.zero_length_control_frame_header_data_count_);
EXPECT_EQ(0, visitor.zero_length_data_frame_count_);
- EXPECT_THAT(visitor.headers_, ElementsAre(
- Pair("Cookie", "foo=bar; baz=bing; "),
- Pair("name", "value")));
+ EXPECT_THAT(visitor.headers_,
+ ElementsAre(Pair("Cookie", "foo=bar; baz=bing; "),
+ Pair("name", "value")));
}
TEST_P(SpdyFramerTest, ReadHeadersWithContinuationAndFin) {
@@ -3762,28 +3365,17 @@ TEST_P(SpdyFramerTest, ReadHeadersWithContinuationAndFin) {
}
const unsigned char kInput[] = {
- 0x00, 0x10, 0x01, 0x01, // HEADERS: FIN
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x40, 0x06, 0x43, 0x6f,
- 0x6f, 0x6b, 0x69, 0x65,
- 0x07, 0x66, 0x6f, 0x6f,
- 0x3d, 0x62, 0x61, 0x72,
-
- 0x00, 0x14, 0x09, 0x00, // CONTINUATION
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x40, 0x06, 0x43, 0x6f,
- 0x6f, 0x6b, 0x69, 0x65,
- 0x08, 0x62, 0x61, 0x7a,
- 0x3d, 0x62, 0x69, 0x6e,
- 0x67, 0x40, 0x06, 0x43,
-
- 0x00, 0x12, 0x09, 0x04, // CONTINUATION: END_HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x6f, 0x6f, 0x6b, 0x69,
- 0x65, 0x00, 0x40, 0x04,
- 0x6e, 0x61, 0x6d, 0x65,
- 0x05, 0x76, 0x61, 0x6c,
- 0x75, 0x65,
+ 0x00, 0x10, 0x01, 0x01, // HEADERS: FIN
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x40, 0x06, 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x07, 0x66, 0x6f,
+ 0x6f, 0x3d, 0x62, 0x61, 0x72, 0x00, 0x14, 0x09, 0x00, // CONTINUATION
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x40, 0x06, 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x08, 0x62, 0x61,
+ 0x7a, 0x3d, 0x62, 0x69, 0x6e, 0x67, 0x40, 0x06, 0x43, 0x00, 0x12,
+ 0x09, 0x04, // CONTINUATION: END_HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x00, 0x40, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
};
SpdyFramer framer(spdy_version_);
@@ -3797,9 +3389,9 @@ TEST_P(SpdyFramerTest, ReadHeadersWithContinuationAndFin) {
EXPECT_EQ(1, visitor.zero_length_control_frame_header_data_count_);
EXPECT_EQ(1, visitor.zero_length_data_frame_count_);
- EXPECT_THAT(visitor.headers_, ElementsAre(
- Pair("Cookie", "foo=bar; baz=bing; "),
- Pair("name", "value")));
+ EXPECT_THAT(visitor.headers_,
+ ElementsAre(Pair("Cookie", "foo=bar; baz=bing; "),
+ Pair("name", "value")));
}
TEST_P(SpdyFramerTest, ReadPushPromiseWithContinuation) {
@@ -3808,29 +3400,18 @@ TEST_P(SpdyFramerTest, ReadPushPromiseWithContinuation) {
}
const unsigned char kInput[] = {
- 0x00, 0x14, 0x05, 0x00, // PUSH_PROMISE
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x00, 0x00, 0x00, 0x2A, // Promised stream 42
- 0x40, 0x06, 0x43, 0x6f,
- 0x6f, 0x6b, 0x69, 0x65,
- 0x07, 0x66, 0x6f, 0x6f,
- 0x3d, 0x62, 0x61, 0x72,
-
- 0x00, 0x14, 0x09, 0x00, // CONTINUATION
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x40, 0x06, 0x43, 0x6f,
- 0x6f, 0x6b, 0x69, 0x65,
- 0x08, 0x62, 0x61, 0x7a,
- 0x3d, 0x62, 0x69, 0x6e,
- 0x67, 0x40, 0x06, 0x43,
-
- 0x00, 0x12, 0x09, 0x04, // CONTINUATION: END_HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x6f, 0x6f, 0x6b, 0x69,
- 0x65, 0x00, 0x40, 0x04,
- 0x6e, 0x61, 0x6d, 0x65,
- 0x05, 0x76, 0x61, 0x6c,
- 0x75, 0x65,
+ 0x00, 0x14, 0x05, 0x00, // PUSH_PROMISE
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x00, 0x00, 0x00, 0x2A, // Promised stream 42
+ 0x40, 0x06, 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x07, 0x66, 0x6f,
+ 0x6f, 0x3d, 0x62, 0x61, 0x72, 0x00, 0x14, 0x09, 0x00, // CONTINUATION
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x40, 0x06, 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x08, 0x62, 0x61,
+ 0x7a, 0x3d, 0x62, 0x69, 0x6e, 0x67, 0x40, 0x06, 0x43, 0x00, 0x12,
+ 0x09, 0x04, // CONTINUATION: END_HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x00, 0x40, 0x04, 0x6e, 0x61, 0x6d,
+ 0x65, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
};
SpdyFramer framer(spdy_version_);
@@ -3844,9 +3425,9 @@ TEST_P(SpdyFramerTest, ReadPushPromiseWithContinuation) {
EXPECT_EQ(1, visitor.zero_length_control_frame_header_data_count_);
EXPECT_EQ(0, visitor.zero_length_data_frame_count_);
- EXPECT_THAT(visitor.headers_, ElementsAre(
- Pair("Cookie", "foo=bar; baz=bing; "),
- Pair("name", "value")));
+ EXPECT_THAT(visitor.headers_,
+ ElementsAre(Pair("Cookie", "foo=bar; baz=bing; "),
+ Pair("name", "value")));
}
TEST_P(SpdyFramerTest, ReadContinuationWithWrongStreamId) {
@@ -3855,20 +3436,13 @@ TEST_P(SpdyFramerTest, ReadContinuationWithWrongStreamId) {
}
const unsigned char kInput[] = {
- 0x00, 0x10, 0x01, 0x00, // HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x40, 0x06, 0x43, 0x6f,
- 0x6f, 0x6b, 0x69, 0x65,
- 0x07, 0x66, 0x6f, 0x6f,
- 0x3d, 0x62, 0x61, 0x72,
-
- 0x00, 0x14, 0x09, 0x00, // CONTINUATION
- 0x00, 0x00, 0x00, 0x02, // Stream 2
- 0x40, 0x06, 0x43, 0x6f,
- 0x6f, 0x6b, 0x69, 0x65,
- 0x08, 0x62, 0x61, 0x7a,
- 0x3d, 0x62, 0x69, 0x6e,
- 0x67, 0x40, 0x06, 0x43,
+ 0x00, 0x10, 0x01, 0x00, // HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x40, 0x06, 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x07, 0x66, 0x6f,
+ 0x6f, 0x3d, 0x62, 0x61, 0x72, 0x00, 0x14, 0x09, 0x00, // CONTINUATION
+ 0x00, 0x00, 0x00, 0x02, // Stream 2
+ 0x40, 0x06, 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x08, 0x62, 0x61,
+ 0x7a, 0x3d, 0x62, 0x69, 0x6e, 0x67, 0x40, 0x06, 0x43,
};
SpdyFramer framer(spdy_version_);
@@ -3891,12 +3465,10 @@ TEST_P(SpdyFramerTest, ReadContinuationOutOfOrder) {
}
const unsigned char kInput[] = {
- 0x00, 0x10, 0x09, 0x00, // CONTINUATION
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x40, 0x06, 0x43, 0x6f,
- 0x6f, 0x6b, 0x69, 0x65,
- 0x07, 0x66, 0x6f, 0x6f,
- 0x3d, 0x62, 0x61, 0x72,
+ 0x00, 0x10, 0x09, 0x00, // CONTINUATION
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x40, 0x06, 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65,
+ 0x07, 0x66, 0x6f, 0x6f, 0x3d, 0x62, 0x61, 0x72,
};
SpdyFramer framer(spdy_version_);
@@ -3905,8 +3477,7 @@ TEST_P(SpdyFramerTest, ReadContinuationOutOfOrder) {
visitor.SimulateInFramer(kInput, sizeof(kInput));
EXPECT_EQ(1, visitor.error_count_);
- EXPECT_EQ(SpdyFramer::SPDY_UNEXPECTED_FRAME,
- visitor.framer_.error_code())
+ EXPECT_EQ(SpdyFramer::SPDY_UNEXPECTED_FRAME, visitor.framer_.error_code())
<< SpdyFramer::ErrorCodeToString(framer.error_code());
EXPECT_EQ(0, visitor.continuation_count_);
EXPECT_EQ(0u, visitor.header_buffer_length_);
@@ -3918,16 +3489,12 @@ TEST_P(SpdyFramerTest, ExpectContinuationReceiveData) {
}
const unsigned char kInput[] = {
- 0x00, 0x10, 0x01, 0x00, // HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x40, 0x06, 0x43, 0x6f,
- 0x6f, 0x6b, 0x69, 0x65,
- 0x07, 0x66, 0x6f, 0x6f,
- 0x3d, 0x62, 0x61, 0x72,
-
- 0x00, 0x00, 0x00, 0x01, // DATA on Stream #1
- 0x00, 0x00, 0x00, 0x04,
- 0xde, 0xad, 0xbe, 0xef,
+ 0x00, 0x10, 0x01, 0x00, // HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x40, 0x06, 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x07, 0x66, 0x6f,
+ 0x6f, 0x3d, 0x62, 0x61, 0x72, 0x00, 0x00, 0x00, 0x01, // DATA on Stream
+ // #1
+ 0x00, 0x00, 0x00, 0x04, 0xde, 0xad, 0xbe, 0xef,
};
SpdyFramer framer(spdy_version_);
@@ -3936,8 +3503,7 @@ TEST_P(SpdyFramerTest, ExpectContinuationReceiveData) {
visitor.SimulateInFramer(kInput, sizeof(kInput));
EXPECT_EQ(1, visitor.error_count_);
- EXPECT_EQ(SpdyFramer::SPDY_UNEXPECTED_FRAME,
- visitor.framer_.error_code())
+ EXPECT_EQ(SpdyFramer::SPDY_UNEXPECTED_FRAME, visitor.framer_.error_code())
<< SpdyFramer::ErrorCodeToString(framer.error_code());
EXPECT_EQ(1, visitor.headers_frame_count_);
EXPECT_EQ(0, visitor.continuation_count_);
@@ -3951,20 +3517,14 @@ TEST_P(SpdyFramerTest, ExpectContinuationReceiveControlFrame) {
}
const unsigned char kInput[] = {
- 0x00, 0x10, 0x01, 0x00, // HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x40, 0x06, 0x43, 0x6f,
- 0x6f, 0x6b, 0x69, 0x65,
- 0x07, 0x66, 0x6f, 0x6f,
- 0x3d, 0x62, 0x61, 0x72,
-
- 0x00, 0x14, 0x08, 0x00, // HEADERS
- 0x00, 0x00, 0x00, 0x01, // Stream 1
- 0x40, 0x06, 0x43, 0x6f, // (Note this is a valid continued encoding).
- 0x6f, 0x6b, 0x69, 0x65,
- 0x08, 0x62, 0x61, 0x7a,
- 0x3d, 0x62, 0x69, 0x6e,
- 0x67, 0x40, 0x06, 0x43,
+ 0x00, 0x10, 0x01, 0x00, // HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x40, 0x06, 0x43, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x07, 0x66,
+ 0x6f, 0x6f, 0x3d, 0x62, 0x61, 0x72, 0x00, 0x14, 0x08, 0x00, // HEADERS
+ 0x00, 0x00, 0x00, 0x01, // Stream 1
+ 0x40, 0x06, 0x43, 0x6f, // (Note this is a valid continued encoding).
+ 0x6f, 0x6b, 0x69, 0x65, 0x08, 0x62, 0x61, 0x7a, 0x3d, 0x62,
+ 0x69, 0x6e, 0x67, 0x40, 0x06, 0x43,
};
SpdyFramer framer(spdy_version_);
@@ -3973,8 +3533,7 @@ TEST_P(SpdyFramerTest, ExpectContinuationReceiveControlFrame) {
visitor.SimulateInFramer(kInput, sizeof(kInput));
EXPECT_EQ(1, visitor.error_count_);
- EXPECT_EQ(SpdyFramer::SPDY_UNEXPECTED_FRAME,
- visitor.framer_.error_code())
+ EXPECT_EQ(SpdyFramer::SPDY_UNEXPECTED_FRAME, visitor.framer_.error_code())
<< SpdyFramer::ErrorCodeToString(framer.error_code());
EXPECT_EQ(1, visitor.headers_frame_count_);
EXPECT_EQ(0, visitor.continuation_count_);
@@ -3998,10 +3557,8 @@ TEST_P(SpdyFramerTest, ReadGarbageWithValidLength) {
}
SpdyFramer framer(spdy_version_);
const unsigned char kFrameData[] = {
- 0x00, 0x10, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff,
+ 0x00, 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
};
TestSpdyVisitor visitor(spdy_version_);
visitor.use_compression_ = false;
@@ -4016,8 +3573,7 @@ TEST_P(SpdyFramerTest, ReadGarbageWithValidVersion) {
}
SpdyFramer framer(spdy_version_);
const unsigned char kFrameData[] = {
- 0x80, spdy_version_ch_, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff,
+ 0x80, spdy_version_ch_, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
};
TestSpdyVisitor visitor(spdy_version_);
visitor.use_compression_ = false;
@@ -4058,62 +3614,60 @@ TEST_P(SpdyFramerTest, SizesTest) {
}
TEST_P(SpdyFramerTest, StateToStringTest) {
- EXPECT_STREQ("ERROR",
- SpdyFramer::StateToString(SpdyFramer::SPDY_ERROR));
+ EXPECT_STREQ("ERROR", SpdyFramer::StateToString(SpdyFramer::SPDY_ERROR));
EXPECT_STREQ("AUTO_RESET",
SpdyFramer::StateToString(SpdyFramer::SPDY_AUTO_RESET));
- EXPECT_STREQ("RESET",
- SpdyFramer::StateToString(SpdyFramer::SPDY_RESET));
- EXPECT_STREQ("READING_COMMON_HEADER",
- SpdyFramer::StateToString(
- SpdyFramer::SPDY_READING_COMMON_HEADER));
- EXPECT_STREQ("CONTROL_FRAME_PAYLOAD",
- SpdyFramer::StateToString(
- SpdyFramer::SPDY_CONTROL_FRAME_PAYLOAD));
- EXPECT_STREQ("IGNORE_REMAINING_PAYLOAD",
- SpdyFramer::StateToString(
- SpdyFramer::SPDY_IGNORE_REMAINING_PAYLOAD));
- EXPECT_STREQ("FORWARD_STREAM_FRAME",
- SpdyFramer::StateToString(
- SpdyFramer::SPDY_FORWARD_STREAM_FRAME));
+ EXPECT_STREQ("RESET", SpdyFramer::StateToString(SpdyFramer::SPDY_RESET));
+ EXPECT_STREQ(
+ "READING_COMMON_HEADER",
+ SpdyFramer::StateToString(SpdyFramer::SPDY_READING_COMMON_HEADER));
+ EXPECT_STREQ(
+ "CONTROL_FRAME_PAYLOAD",
+ SpdyFramer::StateToString(SpdyFramer::SPDY_CONTROL_FRAME_PAYLOAD));
+ EXPECT_STREQ(
+ "IGNORE_REMAINING_PAYLOAD",
+ SpdyFramer::StateToString(SpdyFramer::SPDY_IGNORE_REMAINING_PAYLOAD));
+ EXPECT_STREQ(
+ "FORWARD_STREAM_FRAME",
+ SpdyFramer::StateToString(SpdyFramer::SPDY_FORWARD_STREAM_FRAME));
EXPECT_STREQ("SPDY_CONTROL_FRAME_BEFORE_HEADER_BLOCK",
SpdyFramer::StateToString(
SpdyFramer::SPDY_CONTROL_FRAME_BEFORE_HEADER_BLOCK));
- EXPECT_STREQ("SPDY_CONTROL_FRAME_HEADER_BLOCK",
- SpdyFramer::StateToString(
- SpdyFramer::SPDY_CONTROL_FRAME_HEADER_BLOCK));
- EXPECT_STREQ("SPDY_SETTINGS_FRAME_PAYLOAD",
- SpdyFramer::StateToString(
- SpdyFramer::SPDY_SETTINGS_FRAME_PAYLOAD));
- EXPECT_STREQ("UNKNOWN_STATE",
- SpdyFramer::StateToString(
- SpdyFramer::SPDY_SETTINGS_FRAME_PAYLOAD + 1));
+ EXPECT_STREQ(
+ "SPDY_CONTROL_FRAME_HEADER_BLOCK",
+ SpdyFramer::StateToString(SpdyFramer::SPDY_CONTROL_FRAME_HEADER_BLOCK));
+ EXPECT_STREQ(
+ "SPDY_SETTINGS_FRAME_PAYLOAD",
+ SpdyFramer::StateToString(SpdyFramer::SPDY_SETTINGS_FRAME_PAYLOAD));
+ EXPECT_STREQ(
+ "UNKNOWN_STATE",
+ SpdyFramer::StateToString(SpdyFramer::SPDY_SETTINGS_FRAME_PAYLOAD + 1));
}
TEST_P(SpdyFramerTest, ErrorCodeToStringTest) {
EXPECT_STREQ("NO_ERROR",
SpdyFramer::ErrorCodeToString(SpdyFramer::SPDY_NO_ERROR));
- EXPECT_STREQ("INVALID_CONTROL_FRAME",
- SpdyFramer::ErrorCodeToString(
- SpdyFramer::SPDY_INVALID_CONTROL_FRAME));
+ EXPECT_STREQ(
+ "INVALID_CONTROL_FRAME",
+ SpdyFramer::ErrorCodeToString(SpdyFramer::SPDY_INVALID_CONTROL_FRAME));
EXPECT_STREQ("CONTROL_PAYLOAD_TOO_LARGE",
SpdyFramer::ErrorCodeToString(
SpdyFramer::SPDY_CONTROL_PAYLOAD_TOO_LARGE));
- EXPECT_STREQ("ZLIB_INIT_FAILURE",
- SpdyFramer::ErrorCodeToString(
- SpdyFramer::SPDY_ZLIB_INIT_FAILURE));
- EXPECT_STREQ("UNSUPPORTED_VERSION",
- SpdyFramer::ErrorCodeToString(
- SpdyFramer::SPDY_UNSUPPORTED_VERSION));
- EXPECT_STREQ("DECOMPRESS_FAILURE",
- SpdyFramer::ErrorCodeToString(
- SpdyFramer::SPDY_DECOMPRESS_FAILURE));
- EXPECT_STREQ("COMPRESS_FAILURE",
- SpdyFramer::ErrorCodeToString(
- SpdyFramer::SPDY_COMPRESS_FAILURE));
- EXPECT_STREQ("SPDY_INVALID_DATA_FRAME_FLAGS",
- SpdyFramer::ErrorCodeToString(
- SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS));
+ EXPECT_STREQ(
+ "ZLIB_INIT_FAILURE",
+ SpdyFramer::ErrorCodeToString(SpdyFramer::SPDY_ZLIB_INIT_FAILURE));
+ EXPECT_STREQ(
+ "UNSUPPORTED_VERSION",
+ SpdyFramer::ErrorCodeToString(SpdyFramer::SPDY_UNSUPPORTED_VERSION));
+ EXPECT_STREQ(
+ "DECOMPRESS_FAILURE",
+ SpdyFramer::ErrorCodeToString(SpdyFramer::SPDY_DECOMPRESS_FAILURE));
+ EXPECT_STREQ(
+ "COMPRESS_FAILURE",
+ SpdyFramer::ErrorCodeToString(SpdyFramer::SPDY_COMPRESS_FAILURE));
+ EXPECT_STREQ(
+ "SPDY_INVALID_DATA_FRAME_FLAGS",
+ SpdyFramer::ErrorCodeToString(SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS));
EXPECT_STREQ("SPDY_INVALID_CONTROL_FRAME_FLAGS",
SpdyFramer::ErrorCodeToString(
SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS));
@@ -4122,8 +3676,7 @@ TEST_P(SpdyFramerTest, ErrorCodeToStringTest) {
}
TEST_P(SpdyFramerTest, StatusCodeToStringTest) {
- EXPECT_STREQ("INVALID",
- SpdyFramer::StatusCodeToString(RST_STREAM_INVALID));
+ EXPECT_STREQ("INVALID", SpdyFramer::StatusCodeToString(RST_STREAM_INVALID));
EXPECT_STREQ("PROTOCOL_ERROR",
SpdyFramer::StatusCodeToString(RST_STREAM_PROTOCOL_ERROR));
EXPECT_STREQ("INVALID_STREAM",
@@ -4132,43 +3685,28 @@ TEST_P(SpdyFramerTest, StatusCodeToStringTest) {
SpdyFramer::StatusCodeToString(RST_STREAM_REFUSED_STREAM));
EXPECT_STREQ("UNSUPPORTED_VERSION",
SpdyFramer::StatusCodeToString(RST_STREAM_UNSUPPORTED_VERSION));
- EXPECT_STREQ("CANCEL",
- SpdyFramer::StatusCodeToString(RST_STREAM_CANCEL));
+ EXPECT_STREQ("CANCEL", SpdyFramer::StatusCodeToString(RST_STREAM_CANCEL));
EXPECT_STREQ("INTERNAL_ERROR",
SpdyFramer::StatusCodeToString(RST_STREAM_INTERNAL_ERROR));
EXPECT_STREQ("FLOW_CONTROL_ERROR",
SpdyFramer::StatusCodeToString(RST_STREAM_FLOW_CONTROL_ERROR));
- EXPECT_STREQ("UNKNOWN_STATUS",
- SpdyFramer::StatusCodeToString(-1));
+ EXPECT_STREQ("UNKNOWN_STATUS", SpdyFramer::StatusCodeToString(-1));
}
TEST_P(SpdyFramerTest, FrameTypeToStringTest) {
- EXPECT_STREQ("DATA",
- SpdyFramer::FrameTypeToString(DATA));
- EXPECT_STREQ("SYN_STREAM",
- SpdyFramer::FrameTypeToString(SYN_STREAM));
- EXPECT_STREQ("SYN_REPLY",
- SpdyFramer::FrameTypeToString(SYN_REPLY));
- EXPECT_STREQ("RST_STREAM",
- SpdyFramer::FrameTypeToString(RST_STREAM));
- EXPECT_STREQ("SETTINGS",
- SpdyFramer::FrameTypeToString(SETTINGS));
- EXPECT_STREQ("NOOP",
- SpdyFramer::FrameTypeToString(NOOP));
- EXPECT_STREQ("PING",
- SpdyFramer::FrameTypeToString(PING));
- EXPECT_STREQ("GOAWAY",
- SpdyFramer::FrameTypeToString(GOAWAY));
- EXPECT_STREQ("HEADERS",
- SpdyFramer::FrameTypeToString(HEADERS));
- EXPECT_STREQ("WINDOW_UPDATE",
- SpdyFramer::FrameTypeToString(WINDOW_UPDATE));
- EXPECT_STREQ("PUSH_PROMISE",
- SpdyFramer::FrameTypeToString(PUSH_PROMISE));
- EXPECT_STREQ("CREDENTIAL",
- SpdyFramer::FrameTypeToString(CREDENTIAL));
- EXPECT_STREQ("CONTINUATION",
- SpdyFramer::FrameTypeToString(CONTINUATION));
+ EXPECT_STREQ("DATA", SpdyFramer::FrameTypeToString(DATA));
+ EXPECT_STREQ("SYN_STREAM", SpdyFramer::FrameTypeToString(SYN_STREAM));
+ EXPECT_STREQ("SYN_REPLY", SpdyFramer::FrameTypeToString(SYN_REPLY));
+ EXPECT_STREQ("RST_STREAM", SpdyFramer::FrameTypeToString(RST_STREAM));
+ EXPECT_STREQ("SETTINGS", SpdyFramer::FrameTypeToString(SETTINGS));
+ EXPECT_STREQ("NOOP", SpdyFramer::FrameTypeToString(NOOP));
+ EXPECT_STREQ("PING", SpdyFramer::FrameTypeToString(PING));
+ EXPECT_STREQ("GOAWAY", SpdyFramer::FrameTypeToString(GOAWAY));
+ EXPECT_STREQ("HEADERS", SpdyFramer::FrameTypeToString(HEADERS));
+ EXPECT_STREQ("WINDOW_UPDATE", SpdyFramer::FrameTypeToString(WINDOW_UPDATE));
+ EXPECT_STREQ("PUSH_PROMISE", SpdyFramer::FrameTypeToString(PUSH_PROMISE));
+ EXPECT_STREQ("CREDENTIAL", SpdyFramer::FrameTypeToString(CREDENTIAL));
+ EXPECT_STREQ("CONTINUATION", SpdyFramer::FrameTypeToString(CONTINUATION));
}
TEST_P(SpdyFramerTest, CatchProbableHttpResponse) {
@@ -4231,8 +3769,7 @@ TEST_P(SpdyFramerTest, DataFrameFlagsV2V3) {
framer.ProcessInput(frame->data(), frame->size());
if (flags & ~DATA_FLAG_FIN) {
EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state());
- EXPECT_EQ(SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS,
- framer.error_code())
+ EXPECT_EQ(SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS, framer.error_code())
<< SpdyFramer::ErrorCodeToString(framer.error_code());
} else {
EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state());
@@ -4248,7 +3785,7 @@ TEST_P(SpdyFramerTest, DataFrameFlagsV4) {
}
uint8 valid_data_flags = DATA_FLAG_FIN | DATA_FLAG_END_SEGMENT |
- DATA_FLAG_PAD_LOW | DATA_FLAG_PAD_HIGH;
+ DATA_FLAG_PAD_LOW | DATA_FLAG_PAD_HIGH;
for (int flags = 0; flags < 256; ++flags) {
SCOPED_TRACE(testing::Message() << "Flags " << flags);
@@ -4279,10 +3816,9 @@ TEST_P(SpdyFramerTest, DataFrameFlagsV4) {
framer.ProcessInput(frame->data(), frame->size());
if ((flags & ~valid_data_flags) || (flags & DATA_FLAG_PAD_LOW) ||
(flags & DATA_FLAG_PAD_HIGH)) {
- EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state());
- EXPECT_EQ(SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS,
- framer.error_code())
- << SpdyFramer::ErrorCodeToString(framer.error_code());
+ EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state());
+ EXPECT_EQ(SpdyFramer::SPDY_INVALID_DATA_FRAME_FLAGS, framer.error_code())
+ << SpdyFramer::ErrorCodeToString(framer.error_code());
} else {
EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state());
EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code())
@@ -4319,23 +3855,26 @@ TEST_P(SpdyFramerTest, SynStreamFrameFlags) {
flags & ~(CONTROL_FLAG_FIN | CONTROL_FLAG_UNIDIRECTIONAL)) {
EXPECT_CALL(visitor, OnError(_));
} else if (IsSpdy4() &&
- flags & ~(CONTROL_FLAG_FIN |
- HEADERS_FLAG_PRIORITY |
+ flags & ~(CONTROL_FLAG_FIN | HEADERS_FLAG_PRIORITY |
HEADERS_FLAG_END_HEADERS)) {
EXPECT_CALL(visitor, OnError(_));
} else {
EXPECT_CALL(debug_visitor, OnReceiveCompressedFrame(8, SYN_STREAM, _));
if (IsSpdy4()) {
- EXPECT_CALL(visitor, OnSynStream(8, 0, 1, flags & CONTROL_FLAG_FIN,
- false));
+ EXPECT_CALL(visitor,
+ OnSynStream(8, 0, 1, flags & CONTROL_FLAG_FIN, false));
} else {
- EXPECT_CALL(visitor, OnSynStream(8, 3, 1, flags & CONTROL_FLAG_FIN,
- flags & CONTROL_FLAG_UNIDIRECTIONAL));
+ EXPECT_CALL(visitor,
+ OnSynStream(8,
+ 3,
+ 1,
+ flags & CONTROL_FLAG_FIN,
+ flags & CONTROL_FLAG_UNIDIRECTIONAL));
}
EXPECT_CALL(visitor, OnControlFrameHeaderData(8, _, _))
.WillRepeatedly(testing::Return(true));
- if (flags & DATA_FLAG_FIN && (!IsSpdy4() ||
- flags & HEADERS_FLAG_END_HEADERS)) {
+ if (flags & DATA_FLAG_FIN &&
+ (!IsSpdy4() || flags & HEADERS_FLAG_END_HEADERS)) {
EXPECT_CALL(visitor, OnStreamFrameData(_, _, 0, true));
} else {
// Do not close the stream if we are expecting a CONTINUATION frame.
@@ -4351,9 +3890,8 @@ TEST_P(SpdyFramerTest, SynStreamFrameFlags) {
framer.error_code())
<< SpdyFramer::ErrorCodeToString(framer.error_code());
} else if (IsSpdy4() &&
- flags & ~(CONTROL_FLAG_FIN |
- HEADERS_FLAG_PRIORITY |
- HEADERS_FLAG_END_HEADERS)) {
+ flags & ~(CONTROL_FLAG_FIN | HEADERS_FLAG_PRIORITY |
+ HEADERS_FLAG_END_HEADERS)) {
EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state());
EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS,
framer.error_code())
@@ -4441,7 +3979,9 @@ TEST_P(SpdyFramerTest, RstStreamFrameFlags) {
}
TEST_P(SpdyFramerTest, SettingsFrameFlagsOldFormat) {
- if (spdy_version_ > SPDY3) { return; }
+ if (spdy_version_ > SPDY3) {
+ return;
+ }
for (int flags = 0; flags < 256; ++flags) {
SCOPED_TRACE(testing::Message() << "Flags " << flags);
@@ -4450,20 +3990,20 @@ TEST_P(SpdyFramerTest, SettingsFrameFlagsOldFormat) {
framer.set_visitor(&visitor);
SpdySettingsIR settings_ir;
- settings_ir.AddSetting(SETTINGS_UPLOAD_BANDWIDTH,
- false,
- false,
- 54321);
+ settings_ir.AddSetting(SETTINGS_UPLOAD_BANDWIDTH, false, false, 54321);
scoped_ptr<SpdyFrame> frame(framer.SerializeSettings(settings_ir));
SetFrameFlags(frame.get(), flags, spdy_version_);
if (flags & ~SETTINGS_FLAG_CLEAR_PREVIOUSLY_PERSISTED_SETTINGS) {
EXPECT_CALL(visitor, OnError(_));
} else {
- EXPECT_CALL(visitor, OnSettings(
- flags & SETTINGS_FLAG_CLEAR_PREVIOUSLY_PERSISTED_SETTINGS));
- EXPECT_CALL(visitor, OnSetting(SETTINGS_UPLOAD_BANDWIDTH,
- SETTINGS_FLAG_NONE, 54321));
+ EXPECT_CALL(
+ visitor,
+ OnSettings(flags &
+ SETTINGS_FLAG_CLEAR_PREVIOUSLY_PERSISTED_SETTINGS));
+ EXPECT_CALL(
+ visitor,
+ OnSetting(SETTINGS_UPLOAD_BANDWIDTH, SETTINGS_FLAG_NONE, 54321));
EXPECT_CALL(visitor, OnSettingsEnd());
}
@@ -4482,7 +4022,9 @@ TEST_P(SpdyFramerTest, SettingsFrameFlagsOldFormat) {
}
TEST_P(SpdyFramerTest, SettingsFrameFlags) {
- if (spdy_version_ <= SPDY3) { return; }
+ if (spdy_version_ <= SPDY3) {
+ return;
+ }
for (int flags = 0; flags < 256; ++flags) {
SCOPED_TRACE(testing::Message() << "Flags " << flags);
@@ -4512,8 +4054,7 @@ TEST_P(SpdyFramerTest, SettingsFrameFlags) {
} else if (flags & SETTINGS_FLAG_ACK) {
// The frame is invalid because ACK frames should have no payload.
EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state());
- EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME,
- framer.error_code())
+ EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME, framer.error_code())
<< SpdyFramer::ErrorCodeToString(framer.error_code());
} else {
EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state());
@@ -4574,18 +4115,18 @@ TEST_P(SpdyFramerTest, HeadersFrameFlags) {
if (!IsSpdy4() && flags & ~CONTROL_FLAG_FIN) {
EXPECT_CALL(visitor, OnError(_));
- } else if (IsSpdy4() && flags & ~(CONTROL_FLAG_FIN |
- HEADERS_FLAG_END_HEADERS)) {
+ } else if (IsSpdy4() &&
+ flags & ~(CONTROL_FLAG_FIN | HEADERS_FLAG_END_HEADERS)) {
EXPECT_CALL(visitor, OnError(_));
} else {
- EXPECT_CALL(visitor, OnHeaders(57,
- flags & CONTROL_FLAG_FIN,
- (flags & HEADERS_FLAG_END_HEADERS) ||
- !IsSpdy4()));
+ EXPECT_CALL(visitor,
+ OnHeaders(57,
+ flags & CONTROL_FLAG_FIN,
+ (flags & HEADERS_FLAG_END_HEADERS) || !IsSpdy4()));
EXPECT_CALL(visitor, OnControlFrameHeaderData(57, _, _))
.WillRepeatedly(testing::Return(true));
- if (flags & DATA_FLAG_FIN && (!IsSpdy4() ||
- flags & HEADERS_FLAG_END_HEADERS)) {
+ if (flags & DATA_FLAG_FIN &&
+ (!IsSpdy4() || flags & HEADERS_FLAG_END_HEADERS)) {
EXPECT_CALL(visitor, OnStreamFrameData(_, _, 0, true));
} else {
// Do not close the stream if we are expecting a CONTINUATION frame.
@@ -4599,8 +4140,9 @@ TEST_P(SpdyFramerTest, HeadersFrameFlags) {
EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS,
framer.error_code())
<< SpdyFramer::ErrorCodeToString(framer.error_code());
- } else if (IsSpdy4() && flags & ~(CONTROL_FLAG_FIN | HEADERS_FLAG_PRIORITY |
- HEADERS_FLAG_END_HEADERS)) {
+ } else if (IsSpdy4() &&
+ flags & ~(CONTROL_FLAG_FIN | HEADERS_FLAG_PRIORITY |
+ HEADERS_FLAG_END_HEADERS)) {
EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state());
EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME_FLAGS,
framer.error_code())
@@ -4628,8 +4170,7 @@ TEST_P(SpdyFramerTest, PingFrameFlags) {
scoped_ptr<SpdyFrame> frame(framer.SerializePing(SpdyPingIR(42)));
SetFrameFlags(frame.get(), flags, spdy_version_);
- if (spdy_version_ > SPDY3 &&
- flags == PING_FLAG_ACK) {
+ if (spdy_version_ > SPDY3 && flags == PING_FLAG_ACK) {
EXPECT_CALL(visitor, OnPing(42, true));
} else if (flags == 0) {
EXPECT_CALL(visitor, OnPing(42, false));
@@ -4638,8 +4179,7 @@ TEST_P(SpdyFramerTest, PingFrameFlags) {
}
framer.ProcessInput(frame->data(), frame->size());
- if ((spdy_version_ > SPDY3 && flags == PING_FLAG_ACK) ||
- flags == 0) {
+ if ((spdy_version_ > SPDY3 && flags == PING_FLAG_ACK) || flags == 0) {
EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state());
EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code())
<< SpdyFramer::ErrorCodeToString(framer.error_code());
@@ -4660,8 +4200,8 @@ TEST_P(SpdyFramerTest, WindowUpdateFrameFlags) {
SpdyFramer framer(spdy_version_);
framer.set_visitor(&visitor);
- scoped_ptr<SpdyFrame> frame(framer.SerializeWindowUpdate(
- SpdyWindowUpdateIR(4, 1024)));
+ scoped_ptr<SpdyFrame> frame(
+ framer.SerializeWindowUpdate(SpdyWindowUpdateIR(4, 1024)));
SetFrameFlags(frame.get(), flags, spdy_version_);
if (flags != 0) {
@@ -4703,15 +4243,16 @@ TEST_P(SpdyFramerTest, PushPromiseFrameFlags) {
SpdyPushPromiseIR push_promise(42, 57);
push_promise.SetHeader("foo", "bar");
scoped_ptr<SpdySerializedFrame> frame(
- framer.SerializePushPromise(push_promise));
+ framer.SerializePushPromise(push_promise));
SetFrameFlags(frame.get(), flags, spdy_version_);
if (flags & ~(PUSH_PROMISE_FLAG_END_PUSH_PROMISE)) {
EXPECT_CALL(visitor, OnError(_));
} else {
EXPECT_CALL(debug_visitor, OnReceiveCompressedFrame(42, PUSH_PROMISE, _));
- EXPECT_CALL(visitor, OnPushPromise(42, 57,
- flags & PUSH_PROMISE_FLAG_END_PUSH_PROMISE));
+ EXPECT_CALL(
+ visitor,
+ OnPushPromise(42, 57, flags & PUSH_PROMISE_FLAG_END_PUSH_PROMISE));
EXPECT_CALL(visitor, OnControlFrameHeaderData(42, _, _))
.WillRepeatedly(testing::Return(true));
}
@@ -4748,7 +4289,7 @@ TEST_P(SpdyFramerTest, ContinuationFrameFlags) {
EXPECT_CALL(debug_visitor, OnReceiveCompressedFrame(42, HEADERS, _));
EXPECT_CALL(visitor, OnHeaders(42, 0, false));
EXPECT_CALL(visitor, OnControlFrameHeaderData(42, _, _))
- .WillRepeatedly(testing::Return(true));
+ .WillRepeatedly(testing::Return(true));
EXPECT_CALL(debug_visitor, OnSendCompressedFrame(42, CONTINUATION, _, _));
SpdyHeadersIR headers_ir(42);
@@ -4759,15 +4300,15 @@ TEST_P(SpdyFramerTest, ContinuationFrameFlags) {
SpdyContinuationIR continuation(42);
continuation.SetHeader("foo", "bar");
scoped_ptr<SpdySerializedFrame> frame(
- framer.SerializeContinuation(continuation));
+ framer.SerializeContinuation(continuation));
SetFrameFlags(frame.get(), flags, spdy_version_);
if (flags & ~(HEADERS_FLAG_END_HEADERS)) {
EXPECT_CALL(visitor, OnError(_));
} else {
EXPECT_CALL(debug_visitor, OnReceiveCompressedFrame(42, CONTINUATION, _));
- EXPECT_CALL(visitor, OnContinuation(42,
- flags & HEADERS_FLAG_END_HEADERS));
+ EXPECT_CALL(visitor,
+ OnContinuation(42, flags & HEADERS_FLAG_END_HEADERS));
EXPECT_CALL(visitor, OnControlFrameHeaderData(42, _, _))
.WillRepeatedly(testing::Return(true));
}
@@ -4832,28 +4373,20 @@ TEST_P(SpdyFramerTest, RstStreamStatusBounds) {
const unsigned char kRstStreamStatusTooLow = 0x00;
const unsigned char kRstStreamStatusTooHigh = 0xff;
const unsigned char kV3RstStreamInvalid[] = {
- 0x80, spdy_version_ch_, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x08,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, kRstStreamStatusTooLow
- };
+ 0x80, spdy_version_ch_, 0x00, 0x03, 0x00, 0x00,
+ 0x00, 0x08, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, kRstStreamStatusTooLow};
const unsigned char kV4RstStreamInvalid[] = {
- 0x00, 0x04, 0x03, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, kRstStreamStatusTooLow
- };
+ 0x00, 0x04, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, kRstStreamStatusTooLow};
const unsigned char kV3RstStreamNumStatusCodes[] = {
- 0x80, spdy_version_ch_, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x08,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, kRstStreamStatusTooHigh
- };
+ 0x80, spdy_version_ch_, 0x00, 0x03, 0x00, 0x00,
+ 0x00, 0x08, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, kRstStreamStatusTooHigh};
const unsigned char kV4RstStreamNumStatusCodes[] = {
- 0x00, 0x04, 0x03, 0x00,
- 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x00, 0x00, kRstStreamStatusTooHigh
- };
+ 0x00, 0x04, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, kRstStreamStatusTooHigh};
testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
SpdyFramer framer(spdy_version_);
@@ -4865,17 +4398,16 @@ TEST_P(SpdyFramerTest, RstStreamStatusBounds) {
arraysize(kV4RstStreamInvalid));
EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state());
EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME, framer.error_code())
- << SpdyFramer::ErrorCodeToString(framer.error_code());
+ << SpdyFramer::ErrorCodeToString(framer.error_code());
} else {
EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_INVALID));
framer.ProcessInput(reinterpret_cast<const char*>(kV3RstStreamInvalid),
arraysize(kV3RstStreamInvalid));
EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state());
EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code())
- << SpdyFramer::ErrorCodeToString(framer.error_code());
+ << SpdyFramer::ErrorCodeToString(framer.error_code());
}
-
framer.Reset();
if (IsSpdy4()) {
@@ -4885,7 +4417,7 @@ TEST_P(SpdyFramerTest, RstStreamStatusBounds) {
arraysize(kV4RstStreamNumStatusCodes));
EXPECT_EQ(SpdyFramer::SPDY_ERROR, framer.state());
EXPECT_EQ(SpdyFramer::SPDY_INVALID_CONTROL_FRAME, framer.error_code())
- << SpdyFramer::ErrorCodeToString(framer.error_code());
+ << SpdyFramer::ErrorCodeToString(framer.error_code());
} else {
EXPECT_CALL(visitor, OnRstStream(1, RST_STREAM_INVALID));
framer.ProcessInput(
@@ -4893,28 +4425,23 @@ TEST_P(SpdyFramerTest, RstStreamStatusBounds) {
arraysize(kV3RstStreamNumStatusCodes));
EXPECT_EQ(SpdyFramer::SPDY_RESET, framer.state());
EXPECT_EQ(SpdyFramer::SPDY_NO_ERROR, framer.error_code())
- << SpdyFramer::ErrorCodeToString(framer.error_code());
+ << SpdyFramer::ErrorCodeToString(framer.error_code());
}
}
// Tests handling of a GOAWAY frame with out-of-bounds stream ID.
TEST_P(SpdyFramerTest, GoAwayStreamIdBounds) {
const unsigned char kV2FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x07,
- 0x00, 0x00, 0x00, 0x04,
- 0xff, 0xff, 0xff, 0xff,
+ 0x80, spdy_version_ch_, 0x00, 0x07, 0x00, 0x00,
+ 0x00, 0x04, 0xff, 0xff, 0xff, 0xff,
};
const unsigned char kV3FrameData[] = {
- 0x80, spdy_version_ch_, 0x00, 0x07,
- 0x00, 0x00, 0x00, 0x08,
- 0xff, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x00,
+ 0x80, spdy_version_ch_, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
};
const unsigned char kV4FrameData[] = {
- 0x00, 0x08, 0x07, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0xff, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
};
testing::StrictMock<test::MockSpdyFramerVisitor> visitor;

Powered by Google App Engine
This is Rietveld 408576698