xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/spdy/test_tools/spdy_test_utils.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright (c) 2012 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 QUICHE_SPDY_TEST_TOOLS_SPDY_TEST_UTILS_H_
6 #define QUICHE_SPDY_TEST_TOOLS_SPDY_TEST_UTILS_H_
7 
8 #include <cstddef>
9 #include <cstdint>
10 #include <string>
11 
12 #include "absl/strings/string_view.h"
13 #include "quiche/spdy/core/http2_header_block.h"
14 #include "quiche/spdy/core/spdy_protocol.h"
15 
16 namespace spdy {
17 
18 inline bool operator==(absl::string_view x,
19                        const Http2HeaderBlock::ValueProxy& y) {
20   return y.operator==(x);
21 }
22 
23 namespace test {
24 
25 std::string HexDumpWithMarks(const unsigned char* data, int length,
26                              const bool* marks, int mark_length);
27 
28 void CompareCharArraysWithHexError(const std::string& description,
29                                    const unsigned char* actual,
30                                    const int actual_len,
31                                    const unsigned char* expected,
32                                    const int expected_len);
33 
34 void SetFrameFlags(SpdySerializedFrame* frame, uint8_t flags);
35 
36 void SetFrameLength(SpdySerializedFrame* frame, size_t length);
37 
38 // Makes a SpdySerializedFrame by copying the memory identified by `data` and
39 // `length`.
40 SpdySerializedFrame MakeSerializedFrame(const char* data, size_t length);
41 
42 }  // namespace test
43 }  // namespace spdy
44 
45 #endif  // QUICHE_SPDY_TEST_TOOLS_SPDY_TEST_UTILS_H_
46