OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_TEST_UTILS_H_ | 5 #ifndef NET_SPDY_TEST_UTILS_H_ |
6 #define NET_SPDY_TEST_UTILS_H_ | 6 #define NET_SPDY_TEST_UTILS_H_ |
7 | 7 |
8 #include <stdint.h> | |
9 | |
10 #include <string> | 8 #include <string> |
11 | 9 |
12 #include "net/spdy/spdy_protocol.h" | 10 #include "net/spdy/spdy_protocol.h" |
13 | 11 |
14 namespace net { | 12 namespace net { |
15 | 13 |
16 class HashValue; | |
17 class TransportSecurityState; | |
18 | |
19 namespace test { | 14 namespace test { |
20 | 15 |
21 std::string HexDumpWithMarks(const unsigned char* data, int length, | 16 std::string HexDumpWithMarks(const unsigned char* data, int length, |
22 const bool* marks, int mark_length); | 17 const bool* marks, int mark_length); |
23 | 18 |
24 void CompareCharArraysWithHexError( | 19 void CompareCharArraysWithHexError( |
25 const std::string& description, | 20 const std::string& description, |
26 const unsigned char* actual, | 21 const unsigned char* actual, |
27 const int actual_len, | 22 const int actual_len, |
28 const unsigned char* expected, | 23 const unsigned char* expected, |
29 const int expected_len); | 24 const int expected_len); |
30 | 25 |
31 void SetFrameFlags(SpdyFrame* frame, | 26 void SetFrameFlags(SpdyFrame* frame, |
32 uint8 flags, | 27 uint8 flags, |
33 SpdyMajorVersion spdy_version); | 28 SpdyMajorVersion spdy_version); |
34 | 29 |
35 void SetFrameLength(SpdyFrame* frame, | 30 void SetFrameLength(SpdyFrame* frame, |
36 size_t length, | 31 size_t length, |
37 SpdyMajorVersion spdy_version); | 32 SpdyMajorVersion spdy_version); |
38 | 33 |
39 std::string a2b_hex(const char* hex_data); | 34 std::string a2b_hex(const char* hex_data); |
40 | 35 |
41 // Returns a SHA1 HashValue in which each byte has the value |label|. | |
42 HashValue GetTestHashValue(uint8_t label); | |
43 | |
44 // Returns SHA1 pinning header for the of the base64 encoding of | |
45 // GetTestHashValue(|label|). | |
46 std::string GetTestPin(uint8_t label); | |
47 | |
48 // Adds a pin for |host| to |state|. | |
49 void AddPin(TransportSecurityState* state, | |
50 const std::string& host, | |
51 uint8_t primary_label, | |
52 uint8_t backup_label); | |
53 | |
54 } // namespace test | 36 } // namespace test |
55 | 37 |
56 } // namespace net | 38 } // namespace net |
57 | 39 |
58 #endif // NET_SPDY_TEST_UTILS_H_ | 40 #endif // NET_SPDY_TEST_UTILS_H_ |
OLD | NEW |