Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / net / spdy / spdy_test_utils.h
blobee3d6582fb86c0318abd2042098d180f0971bdc2
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.
5 #ifndef NET_SPDY_TEST_UTILS_H_
6 #define NET_SPDY_TEST_UTILS_H_
8 #include <stdint.h>
10 #include <string>
12 #include "net/spdy/spdy_protocol.h"
14 namespace net {
16 class HashValue;
17 class TransportSecurityState;
19 namespace test {
21 std::string HexDumpWithMarks(const unsigned char* data, int length,
22 const bool* marks, int mark_length);
24 void CompareCharArraysWithHexError(
25 const std::string& description,
26 const unsigned char* actual,
27 const int actual_len,
28 const unsigned char* expected,
29 const int expected_len);
31 void SetFrameFlags(SpdyFrame* frame,
32 uint8 flags,
33 SpdyMajorVersion spdy_version);
35 void SetFrameLength(SpdyFrame* frame,
36 size_t length,
37 SpdyMajorVersion spdy_version);
39 // Returns true if |a| and |b| are the same size, and contain the same
40 // entries in the same positions.
41 bool CompareSpdyHeaderBlocks(const SpdyHeaderBlock& a,
42 const SpdyHeaderBlock& b);
44 std::string a2b_hex(const char* hex_data);
46 // Returns a SHA1 HashValue in which each byte has the value |label|.
47 HashValue GetTestHashValue(uint8_t label);
49 // Returns SHA1 pinning header for the of the base64 encoding of
50 // GetTestHashValue(|label|).
51 std::string GetTestPin(uint8_t label);
53 // Adds a pin for |host| to |state|.
54 void AddPin(TransportSecurityState* state,
55 const std::string& host,
56 uint8_t primary_label,
57 uint8_t backup_label);
59 } // namespace test
60 } // namespace net
62 #endif // NET_SPDY_TEST_UTILS_H_