OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/spdy/buffered_spdy_framer.h" | 5 #include "net/spdy/buffered_spdy_framer.h" |
6 | 6 |
7 #include "net/spdy/spdy_test_util_spdy2.h" | 7 #include "net/spdy/spdy_test_util_spdy2.h" |
8 #include "testing/platform_test.h" | 8 #include "testing/platform_test.h" |
9 | 9 |
10 using namespace net::test_spdy2; | 10 using namespace net::test_spdy2; |
(...skipping 25 matching lines...) Expand all Loading... |
36 << description; | 36 << description; |
37 error_count_++; | 37 error_count_++; |
38 } | 38 } |
39 | 39 |
40 void OnSynStream(SpdyStreamId stream_id, | 40 void OnSynStream(SpdyStreamId stream_id, |
41 SpdyStreamId associated_stream_id, | 41 SpdyStreamId associated_stream_id, |
42 SpdyPriority priority, | 42 SpdyPriority priority, |
43 uint8 credential_slot, | 43 uint8 credential_slot, |
44 bool fin, | 44 bool fin, |
45 bool unidirectional, | 45 bool unidirectional, |
46 const linked_ptr<SpdyHeaderBlock>& headers) { | 46 const SpdyHeaderBlock& headers) { |
47 header_stream_id_ = stream_id; | 47 header_stream_id_ = stream_id; |
48 EXPECT_NE(header_stream_id_, SpdyFramer::kInvalidStream); | 48 EXPECT_NE(header_stream_id_, SpdyFramer::kInvalidStream); |
49 syn_frame_count_++; | 49 syn_frame_count_++; |
50 headers_ = *headers; | 50 headers_ = headers; |
51 } | 51 } |
52 | 52 |
53 void OnSynReply(SpdyStreamId stream_id, | 53 void OnSynReply(SpdyStreamId stream_id, |
54 bool fin, | 54 bool fin, |
55 const linked_ptr<SpdyHeaderBlock>& headers) { | 55 const SpdyHeaderBlock& headers) { |
56 header_stream_id_ = stream_id; | 56 header_stream_id_ = stream_id; |
57 EXPECT_NE(header_stream_id_, SpdyFramer::kInvalidStream); | 57 EXPECT_NE(header_stream_id_, SpdyFramer::kInvalidStream); |
58 syn_reply_frame_count_++; | 58 syn_reply_frame_count_++; |
59 headers_ = *headers; | 59 headers_ = headers; |
60 } | 60 } |
61 | 61 |
62 void OnHeaders(SpdyStreamId stream_id, | 62 void OnHeaders(SpdyStreamId stream_id, |
63 bool fin, | 63 bool fin, |
64 const linked_ptr<SpdyHeaderBlock>& headers) { | 64 const SpdyHeaderBlock& headers) { |
65 header_stream_id_ = stream_id; | 65 header_stream_id_ = stream_id; |
66 EXPECT_NE(header_stream_id_, SpdyFramer::kInvalidStream); | 66 EXPECT_NE(header_stream_id_, SpdyFramer::kInvalidStream); |
67 headers_frame_count_++; | 67 headers_frame_count_++; |
68 headers_ = *headers; | 68 headers_ = headers; |
69 } | 69 } |
70 | 70 |
71 void OnStreamFrameData(SpdyStreamId stream_id, | 71 void OnStreamFrameData(SpdyStreamId stream_id, |
72 const char* data, | 72 const char* data, |
73 size_t len) { | 73 size_t len) { |
74 LOG(FATAL) << "Unexpected OnStreamFrameData call."; | 74 LOG(FATAL) << "Unexpected OnStreamFrameData call."; |
75 } | 75 } |
76 | 76 |
77 void OnSetting(SpdySettingsIds id, uint8 flags, uint32 value) { | 77 void OnSetting(SpdySettingsIds id, uint8 flags, uint32 value) { |
78 setting_count_++; | 78 setting_count_++; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 visitor.SimulateInFramer( | 261 visitor.SimulateInFramer( |
262 reinterpret_cast<unsigned char*>(control_frame.get()->data()), | 262 reinterpret_cast<unsigned char*>(control_frame.get()->data()), |
263 control_frame.get()->length() + SpdyControlFrame::kHeaderSize); | 263 control_frame.get()->length() + SpdyControlFrame::kHeaderSize); |
264 EXPECT_EQ(0, visitor.error_count_); | 264 EXPECT_EQ(0, visitor.error_count_); |
265 EXPECT_EQ(0, visitor.syn_frame_count_); | 265 EXPECT_EQ(0, visitor.syn_frame_count_); |
266 EXPECT_EQ(0, visitor.syn_reply_frame_count_); | 266 EXPECT_EQ(0, visitor.syn_reply_frame_count_); |
267 EXPECT_EQ(1, visitor.headers_frame_count_); | 267 EXPECT_EQ(1, visitor.headers_frame_count_); |
268 EXPECT_TRUE(CompareHeaderBlocks(&headers, &visitor.headers_)); | 268 EXPECT_TRUE(CompareHeaderBlocks(&headers, &visitor.headers_)); |
269 } | 269 } |
270 } // namespace net | 270 } // namespace net |
OLD | NEW |