Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: net/http2/http2_structures_test_util.h

Issue 2554683003: Revert of Add new HTTP/2 and HPACK decoder in net/http2/. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http2/http2_structures_test.cc ('k') | net/http2/http2_structures_test_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_HTTP2_STRUCTURES_TEST_UTIL_H_
6 #define NET_HTTP2_HTTP2_STRUCTURES_TEST_UTIL_H_
7
8 #include <string>
9
10 #include "net/http2/http2_structures.h"
11 #include "net/http2/tools/http2_frame_builder.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace net {
15 namespace test {
16
17 class RandomBase;
18
19 template <class S>
20 std::string SerializeStructure(const S& s) {
21 Http2FrameBuilder fb;
22 fb.Append(s);
23 EXPECT_EQ(S::EncodedSize(), fb.size());
24 return fb.buffer();
25 }
26
27 // Randomize the members of out, in a manner that yields encodeable contents
28 // (e.g. a "uint24" field has only the low 24 bits set).
29 void Randomize(Http2FrameHeader* out, RandomBase* rng);
30 void Randomize(Http2PriorityFields* out, RandomBase* rng);
31 void Randomize(Http2RstStreamFields* out, RandomBase* rng);
32 void Randomize(Http2SettingFields* out, RandomBase* rng);
33 void Randomize(Http2PushPromiseFields* out, RandomBase* rng);
34 void Randomize(Http2PingFields* out, RandomBase* rng);
35 void Randomize(Http2GoAwayFields* out, RandomBase* rng);
36 void Randomize(Http2WindowUpdateFields* out, RandomBase* rng);
37 void Randomize(Http2AltSvcFields* out, RandomBase* rng);
38
39 // Clear bits of header->flags that are known to be invalid for the
40 // type. For unknown frame types, no change is made.
41 void ScrubFlagsOfHeader(Http2FrameHeader* header);
42
43 // Is the frame with this header padded? Only true for known/supported frame
44 // types.
45 bool FrameIsPadded(const Http2FrameHeader& header);
46
47 // Does the frame with this header have Http2PriorityFields?
48 bool FrameHasPriority(const Http2FrameHeader& header);
49
50 // Does the frame with this header have a variable length payload (including
51 // empty) payload (e.g. DATA or HEADERS)? Really a test of the frame type.
52 bool FrameCanHavePayload(const Http2FrameHeader& header);
53
54 // Does the frame with this header have a variable length HPACK payload
55 // (including empty) payload (e.g. HEADERS)? Really a test of the frame type.
56 bool FrameCanHaveHpackPayload(const Http2FrameHeader& header);
57
58 } // namespace test
59 } // namespace net
60
61 #endif // NET_HTTP2_HTTP2_STRUCTURES_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « net/http2/http2_structures_test.cc ('k') | net/http2/http2_structures_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698