| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_HTTP2_DECODER_FRAME_DECODER_STATE_TEST_UTIL_H_ | |
| 6 #define NET_HTTP2_DECODER_FRAME_DECODER_STATE_TEST_UTIL_H_ | |
| 7 | |
| 8 #include "net/http2/decoder/frame_decoder_state.h" | |
| 9 #include "net/http2/http2_structures.h" | |
| 10 #include "net/http2/tools/random_decoder_test.h" | |
| 11 | |
| 12 namespace net { | |
| 13 namespace test { | |
| 14 | |
| 15 class FrameDecoderStatePeer { | |
| 16 public: | |
| 17 // Randomizes (i.e. corrupts) the fields of the FrameDecoderState. | |
| 18 // PayloadDecoderBaseTest::StartDecoding calls this before passing the first | |
| 19 // decode buffer to the payload decoder, which increases the likelihood of | |
| 20 // detecting any use of prior states of the decoder on the decoding of | |
| 21 // future payloads. | |
| 22 static void Randomize(FrameDecoderState* p, RandomBase* rng); | |
| 23 | |
| 24 // Inject a frame header into the FrameDecoderState. | |
| 25 // PayloadDecoderBaseTest::StartDecoding calls this just after calling | |
| 26 // Randomize (above), to simulate a full frame decoder having just finished | |
| 27 // decoding the common frame header and then calling the appropriate payload | |
| 28 // decoder based on the frame type in that frame header. | |
| 29 static void set_frame_header(const Http2FrameHeader& header, | |
| 30 FrameDecoderState* p); | |
| 31 }; | |
| 32 | |
| 33 } // namespace test | |
| 34 } // namespace net | |
| 35 | |
| 36 #endif // NET_HTTP2_DECODER_FRAME_DECODER_STATE_TEST_UTIL_H_ | |
| OLD | NEW |