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 14 matching lines...) Expand all Loading... |
25 // // Need to call SpdyTestDeframer::AtFrameEnd() after processing each | 25 // // Need to call SpdyTestDeframer::AtFrameEnd() after processing each |
26 // // frame, so tell SpdyFramer to stop after each. | 26 // // frame, so tell SpdyFramer to stop after each. |
27 // framer.set_process_single_input_frame(true); | 27 // framer.set_process_single_input_frame(true); |
28 // | 28 // |
29 // // Need the new OnHeader callbacks. | 29 // // Need the new OnHeader callbacks. |
30 // framer.set_use_new_methods_for_test(true); | 30 // framer.set_use_new_methods_for_test(true); |
31 // | 31 // |
32 // // Create your visitor, a subclass of SpdyDeframerVisitorInterface. | 32 // // Create your visitor, a subclass of SpdyDeframerVisitorInterface. |
33 // // For example, using DeframerCallbackCollector to collect frames: | 33 // // For example, using DeframerCallbackCollector to collect frames: |
34 // std::vector<CollectedFrame> collected_frames; | 34 // std::vector<CollectedFrame> collected_frames; |
35 // auto your_visitor = gtl::MakeUnique<DeframerCallbackCollector>( | 35 // auto your_visitor = SpdyMakeUnique<DeframerCallbackCollector>( |
36 // &collected_frames); | 36 // &collected_frames); |
37 // | 37 // |
38 // // Transfer ownership of your visitor to the converter, which ensures that | 38 // // Transfer ownership of your visitor to the converter, which ensures that |
39 // // your visitor stays alive while the converter needs to call it. | 39 // // your visitor stays alive while the converter needs to call it. |
40 // auto the_deframer = SpdyTestDeframer::CreateConverter( | 40 // auto the_deframer = SpdyTestDeframer::CreateConverter( |
41 // std::move(your_visitor)); | 41 // std::move(your_visitor)); |
42 // | 42 // |
43 // // Tell the framer to notify SpdyTestDeframer of the decoded frame | 43 // // Tell the framer to notify SpdyTestDeframer of the decoded frame |
44 // // details. | 44 // // details. |
45 // framer.set_visitor(the_deframer.get()); | 45 // framer.set_visitor(the_deframer.get()); |
(...skipping 195 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 |