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_spdy3.h" | 7 #include "net/spdy/spdy_test_util_spdy3.h" |
8 #include "testing/platform_test.h" | 8 #include "testing/platform_test.h" |
9 | 9 |
10 using namespace net::test_spdy3; | 10 using namespace net::test_spdy3; |
11 | 11 |
12 namespace net { | 12 namespace net { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 class TestBufferedSpdyVisitor : public BufferedSpdyFramerVisitorInterface { | 16 class TestBufferedSpdyVisitor : public BufferedSpdyFramerVisitorInterface { |
17 public: | 17 public: |
18 TestBufferedSpdyVisitor() | 18 TestBufferedSpdyVisitor() |
19 : buffered_spdy_framer_(3), | 19 : buffered_spdy_framer_(3), |
20 error_count_(0), | 20 error_count_(0), |
21 setting_count_(0), | 21 setting_count_(0), |
22 syn_frame_count_(0), | 22 syn_frame_count_(0), |
23 syn_reply_frame_count_(0), | 23 syn_reply_frame_count_(0), |
24 headers_frame_count_(0), | 24 headers_frame_count_(0), |
25 header_stream_id_(-1) { | 25 header_stream_id_(-1) { |
26 } | 26 } |
27 | 27 |
28 void OnError(int error_code) { | 28 void OnError(SpdyFramer::SpdyError error_code) { |
29 LOG(INFO) << "SpdyFramer Error: " << error_code; | 29 LOG(INFO) << "SpdyFramer Error: " << error_code; |
30 error_count_++; | 30 error_count_++; |
31 } | 31 } |
32 | 32 |
33 void OnStreamError(SpdyStreamId stream_id, | 33 void OnStreamError(SpdyStreamId stream_id, |
34 const std::string& description) { | 34 const std::string& description) { |
35 LOG(INFO) << "SpdyFramer Error on stream: " << stream_id << " " | 35 LOG(INFO) << "SpdyFramer Error on stream: " << stream_id << " " |
36 << description; | 36 << description; |
37 error_count_++; | 37 error_count_++; |
38 } | 38 } |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 visitor.SimulateInFramer( | 257 visitor.SimulateInFramer( |
258 reinterpret_cast<unsigned char*>(control_frame.get()->data()), | 258 reinterpret_cast<unsigned char*>(control_frame.get()->data()), |
259 control_frame.get()->length() + SpdyControlFrame::kHeaderSize); | 259 control_frame.get()->length() + SpdyControlFrame::kHeaderSize); |
260 EXPECT_EQ(0, visitor.error_count_); | 260 EXPECT_EQ(0, visitor.error_count_); |
261 EXPECT_EQ(0, visitor.syn_frame_count_); | 261 EXPECT_EQ(0, visitor.syn_frame_count_); |
262 EXPECT_EQ(0, visitor.syn_reply_frame_count_); | 262 EXPECT_EQ(0, visitor.syn_reply_frame_count_); |
263 EXPECT_EQ(1, visitor.headers_frame_count_); | 263 EXPECT_EQ(1, visitor.headers_frame_count_); |
264 EXPECT_TRUE(CompareHeaderBlocks(&headers, &visitor.headers_)); | 264 EXPECT_TRUE(CompareHeaderBlocks(&headers, &visitor.headers_)); |
265 } | 265 } |
266 } // namespace net | 266 } // namespace net |
OLD | NEW |