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 #include "net/spdy/spdy_test_utils.h" | 5 #include "net/spdy/spdy_test_utils.h" |
6 | 6 |
7 #include <cstring> | 7 #include <cstring> |
| 8 #include <vector> |
8 | 9 |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/strings/string_number_conversions.h" |
11 #include "base/sys_byteorder.h" | 13 #include "base/sys_byteorder.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
13 | 15 |
14 namespace net { | 16 namespace net { |
15 | 17 |
16 namespace test { | 18 namespace test { |
17 | 19 |
18 std::string HexDumpWithMarks(const unsigned char* data, int length, | 20 std::string HexDumpWithMarks(const unsigned char* data, int length, |
19 const bool* marks, int mark_length) { | 21 const bool* marks, int mark_length) { |
20 static const char kHexChars[] = "0123456789abcdef"; | 22 static const char kHexChars[] = "0123456789abcdef"; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 memcpy(frame->data(), | 124 memcpy(frame->data(), |
123 reinterpret_cast<char*>(&wire_length), | 125 reinterpret_cast<char*>(&wire_length), |
124 sizeof(uint16)); | 126 sizeof(uint16)); |
125 } | 127 } |
126 break; | 128 break; |
127 default: | 129 default: |
128 LOG(FATAL) << "Unsupported SPDY version."; | 130 LOG(FATAL) << "Unsupported SPDY version."; |
129 } | 131 } |
130 } | 132 } |
131 | 133 |
| 134 std::string a2b_hex(const char* hex_data) { |
| 135 std::vector<uint8> output; |
| 136 std::string result; |
| 137 if (base::HexStringToBytes(hex_data, &output)) |
| 138 result.assign(reinterpret_cast<const char*>(&output[0]), output.size()); |
| 139 return result; |
| 140 } |
132 | 141 |
133 } // namespace test | 142 } // namespace test |
134 | 143 |
135 } // namespace net | 144 } // namespace net |
OLD | NEW |