OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/spdy_deframer_visitor.h" | 5 #include "net/spdy/spdy_deframer_visitor.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <string.h> | |
9 | 8 |
10 #include <algorithm> | 9 #include <algorithm> |
11 #include <limits> | 10 #include <limits> |
12 | 11 |
13 #include "base/logging.h" | 12 #include "base/logging.h" |
14 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
15 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
16 #include "net/spdy/hpack/hpack_constants.h" | 15 #include "net/spdy/hpack/hpack_constants.h" |
17 #include "net/spdy/mock_spdy_framer_visitor.h" | 16 #include "net/spdy/mock_spdy_framer_visitor.h" |
18 #include "net/spdy/spdy_frame_builder.h" | 17 #include "net/spdy/spdy_frame_builder.h" |
19 #include "net/spdy/spdy_frame_reader.h" | 18 #include "net/spdy/spdy_frame_reader.h" |
20 #include "net/spdy/spdy_protocol.h" | 19 #include "net/spdy/spdy_protocol.h" |
21 #include "net/spdy/spdy_protocol_test_utils.h" | 20 #include "net/spdy/spdy_protocol_test_utils.h" |
22 #include "net/spdy/spdy_test_utils.h" | 21 #include "net/spdy/spdy_test_utils.h" |
23 | 22 |
24 using ::base::MakeUnique; | 23 using ::base::MakeUnique; |
25 using ::std::string; | |
26 | 24 |
27 namespace net { | 25 namespace net { |
28 namespace test { | 26 namespace test { |
29 namespace { | 27 namespace { |
30 | 28 |
31 class SpdyDeframerVisitorTest : public ::testing::Test { | 29 class SpdyDeframerVisitorTest : public ::testing::Test { |
32 protected: | 30 protected: |
33 SpdyDeframerVisitorTest() | 31 SpdyDeframerVisitorTest() |
34 : encoder_(SpdyFramer::ENABLE_COMPRESSION), | 32 : encoder_(SpdyFramer::ENABLE_COMPRESSION), |
35 decoder_(SpdyFramer::ENABLE_COMPRESSION) { | 33 decoder_(SpdyFramer::ENABLE_COMPRESSION) { |
(...skipping 23 matching lines...) Expand all Loading... |
59 } | 57 } |
60 } | 58 } |
61 return (input_remaining == 0 && | 59 return (input_remaining == 0 && |
62 decoder_.spdy_framer_error() == SpdyFramer::SPDY_NO_ERROR); | 60 decoder_.spdy_framer_error() == SpdyFramer::SPDY_NO_ERROR); |
63 } | 61 } |
64 | 62 |
65 SpdySerializedFrame SerializeFrame(const SpdyFrameIR& frame) { | 63 SpdySerializedFrame SerializeFrame(const SpdyFrameIR& frame) { |
66 return encoder_.SerializeFrame(frame); | 64 return encoder_.SerializeFrame(frame); |
67 } | 65 } |
68 | 66 |
69 string SerializeFrames( | 67 SpdyString SerializeFrames( |
70 const std::vector<std::unique_ptr<SpdyFrameIR>>& frames) { | 68 const std::vector<std::unique_ptr<SpdyFrameIR>>& frames) { |
71 string result; | 69 SpdyString result; |
72 for (const auto& frame_ptr : frames) { | 70 for (const auto& frame_ptr : frames) { |
73 auto sf = SerializeFrame(*frame_ptr); | 71 auto sf = SerializeFrame(*frame_ptr); |
74 result.append(sf.data(), sf.size()); | 72 result.append(sf.data(), sf.size()); |
75 } | 73 } |
76 return result; | 74 return result; |
77 } | 75 } |
78 | 76 |
79 // bool | 77 // bool |
80 | 78 |
81 SpdyFramer encoder_; | 79 SpdyFramer encoder_; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 // TODO(jamessynge): Please implement. | 262 // TODO(jamessynge): Please implement. |
265 } | 263 } |
266 | 264 |
267 TEST_F(SpdyDeframerVisitorTest, DISABLED_AltSvcFrame) { | 265 TEST_F(SpdyDeframerVisitorTest, DISABLED_AltSvcFrame) { |
268 // TODO(jamessynge): Please implement. | 266 // TODO(jamessynge): Please implement. |
269 } | 267 } |
270 | 268 |
271 } // namespace | 269 } // namespace |
272 } // namespace test | 270 } // namespace test |
273 } // namespace net | 271 } // namespace net |
OLD | NEW |