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_common.h" | 7 #include "net/spdy/spdy_test_util_common.h" |
8 #include "testing/platform_test.h" | 8 #include "testing/platform_test.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 class TestBufferedSpdyVisitor : public BufferedSpdyFramerVisitorInterface { | 14 class TestBufferedSpdyVisitor : public BufferedSpdyFramerVisitorInterface { |
15 public: | 15 public: |
16 explicit TestBufferedSpdyVisitor(SpdyMajorVersion spdy_version) | 16 explicit TestBufferedSpdyVisitor(SpdyMajorVersion spdy_version) |
17 : buffered_spdy_framer_(spdy_version, true), | 17 : buffered_spdy_framer_(spdy_version, true), |
18 error_count_(0), | 18 error_count_(0), |
19 setting_count_(0), | 19 setting_count_(0), |
20 syn_frame_count_(0), | 20 syn_frame_count_(0), |
21 syn_reply_frame_count_(0), | 21 syn_reply_frame_count_(0), |
22 headers_frame_count_(0), | 22 headers_frame_count_(0), |
23 push_promise_frame_count_(0), | 23 push_promise_frame_count_(0), |
24 header_stream_id_(-1), | 24 header_stream_id_(static_cast<SpdyStreamId>(-1)), |
25 promised_stream_id_(-1) { | 25 promised_stream_id_(static_cast<SpdyStreamId>(-1)) { |
26 } | 26 } |
27 | 27 |
28 virtual void OnError(SpdyFramer::SpdyError error_code) OVERRIDE { | 28 virtual void OnError(SpdyFramer::SpdyError error_code) OVERRIDE { |
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 virtual void OnStreamError( | 33 virtual void OnStreamError( |
34 SpdyStreamId stream_id, | 34 SpdyStreamId stream_id, |
35 const std::string& description) OVERRIDE { | 35 const std::string& description) OVERRIDE { |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 EXPECT_EQ(0, visitor.syn_frame_count_); | 328 EXPECT_EQ(0, visitor.syn_frame_count_); |
329 EXPECT_EQ(0, visitor.syn_reply_frame_count_); | 329 EXPECT_EQ(0, visitor.syn_reply_frame_count_); |
330 EXPECT_EQ(0, visitor.headers_frame_count_); | 330 EXPECT_EQ(0, visitor.headers_frame_count_); |
331 EXPECT_EQ(1, visitor.push_promise_frame_count_); | 331 EXPECT_EQ(1, visitor.push_promise_frame_count_); |
332 EXPECT_TRUE(CompareHeaderBlocks(&headers, &visitor.headers_)); | 332 EXPECT_TRUE(CompareHeaderBlocks(&headers, &visitor.headers_)); |
333 EXPECT_EQ(1u, visitor.header_stream_id_); | 333 EXPECT_EQ(1u, visitor.header_stream_id_); |
334 EXPECT_EQ(2u, visitor.promised_stream_id_); | 334 EXPECT_EQ(2u, visitor.promised_stream_id_); |
335 } | 335 } |
336 | 336 |
337 } // namespace net | 337 } // namespace net |
OLD | NEW |