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 #ifndef NET_SPDY_SPDY_DEFRAMER_VISITOR_H_ | 5 #ifndef NET_SPDY_SPDY_DEFRAMER_VISITOR_H_ |
6 #define NET_SPDY_SPDY_DEFRAMER_VISITOR_H_ | 6 #define NET_SPDY_SPDY_DEFRAMER_VISITOR_H_ |
7 | 7 |
8 // Supports testing by converting callbacks to SpdyFramerVisitorInterface into | 8 // Supports testing by converting callbacks to SpdyFramerVisitorInterface into |
9 // callbacks to SpdyDeframerVisitorInterface, whose arguments are generally | 9 // callbacks to SpdyDeframerVisitorInterface, whose arguments are generally |
10 // SpdyFrameIR instances. This enables a test client or test backend to operate | 10 // SpdyFrameIR instances. This enables a test client or test backend to operate |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // | 63 // |
64 // // Repeat for the other frames. | 64 // // Repeat for the other frames. |
65 // | 65 // |
66 // Note that you could also seed the subclass of SpdyDeframerVisitorInterface | 66 // Note that you could also seed the subclass of SpdyDeframerVisitorInterface |
67 // with the expected frames, which it would pop-off the list as its expectations | 67 // with the expected frames, which it would pop-off the list as its expectations |
68 // are met. | 68 // are met. |
69 | 69 |
70 #include <stdint.h> | 70 #include <stdint.h> |
71 | 71 |
72 #include <memory> | 72 #include <memory> |
73 #include <string> | |
74 #include <type_traits> | 73 #include <type_traits> |
75 #include <utility> | 74 #include <utility> |
76 #include <vector> | 75 #include <vector> |
77 | 76 |
78 #include "base/logging.h" | 77 #include "base/logging.h" |
79 #include "base/macros.h" | 78 #include "base/macros.h" |
| 79 #include "net/spdy/platform/api/spdy_string.h" |
80 #include "net/spdy/spdy_framer.h" | 80 #include "net/spdy/spdy_framer.h" |
81 #include "net/spdy/spdy_protocol.h" | 81 #include "net/spdy/spdy_protocol.h" |
82 #include "net/spdy/spdy_protocol_test_utils.h" | 82 #include "net/spdy/spdy_protocol_test_utils.h" |
83 #include "net/spdy/spdy_test_utils.h" | 83 #include "net/spdy/spdy_test_utils.h" |
84 | 84 |
85 namespace net { | 85 namespace net { |
86 namespace test { | 86 namespace test { |
87 | 87 |
88 // Non-lossy representation of a SETTINGS frame payload. | 88 // Non-lossy representation of a SETTINGS frame payload. |
89 typedef std::vector<std::pair<SpdySettingsIds, uint32_t>> SettingVector; | 89 typedef std::vector<std::pair<SpdySettingsIds, uint32_t>> SettingVector; |
90 | 90 |
91 // StringPairVector is used to record information lost by SpdyHeaderBlock, in | 91 // StringPairVector is used to record information lost by SpdyHeaderBlock, in |
92 // particular the order of each header entry, though it doesn't expose the | 92 // particular the order of each header entry, though it doesn't expose the |
93 // inner details of the HPACK block, such as the type of encoding selected | 93 // inner details of the HPACK block, such as the type of encoding selected |
94 // for each header entry, nor dynamic table size changes. | 94 // for each header entry, nor dynamic table size changes. |
95 typedef std::pair<std::string, std::string> StringPair; | 95 typedef std::pair<SpdyString, SpdyString> StringPair; |
96 typedef std::vector<StringPair> StringPairVector; | 96 typedef std::vector<StringPair> StringPairVector; |
97 | 97 |
98 // Forward decl. | 98 // Forward decl. |
99 class SpdyTestDeframer; | 99 class SpdyTestDeframer; |
100 | 100 |
101 // Note that this only roughly captures the frames, as padding bytes are lost, | 101 // Note that this only roughly captures the frames, as padding bytes are lost, |
102 // continuation frames are combined with their leading HEADERS or PUSH_PROMISE, | 102 // continuation frames are combined with their leading HEADERS or PUSH_PROMISE, |
103 // the details of the HPACK encoding are lost, leaving | 103 // the details of the HPACK encoding are lost, leaving |
104 // only the list of header entries (name and value strings). If really helpful, | 104 // only the list of header entries (name and value strings). If really helpful, |
105 // we could add a SpdyRawDeframerVisitorInterface that gets the HPACK bytes, | 105 // we could add a SpdyRawDeframerVisitorInterface that gets the HPACK bytes, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 void OnError(SpdyFramer* framer, SpdyTestDeframer* deframer) override; | 241 void OnError(SpdyFramer* framer, SpdyTestDeframer* deframer) override; |
242 | 242 |
243 private: | 243 private: |
244 std::vector<CollectedFrame>* collected_frames_; | 244 std::vector<CollectedFrame>* collected_frames_; |
245 }; | 245 }; |
246 | 246 |
247 } // namespace test | 247 } // namespace test |
248 } // namespace net | 248 } // namespace net |
249 | 249 |
250 #endif // NET_SPDY_SPDY_DEFRAMER_VISITOR_H_ | 250 #endif // NET_SPDY_SPDY_DEFRAMER_VISITOR_H_ |
OLD | NEW |