| 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 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 hex += mark ? '*' : ' '; | 41 hex += mark ? '*' : ' '; |
| 42 hex += kHexChars[(*p & 0xf0) >> 4]; | 42 hex += kHexChars[(*p & 0xf0) >> 4]; |
| 43 hex += kHexChars[*p & 0x0f]; | 43 hex += kHexChars[*p & 0x0f]; |
| 44 hex += mark ? '*' : ' '; | 44 hex += mark ? '*' : ' '; |
| 45 } else { | 45 } else { |
| 46 hex += " "; | 46 hex += " "; |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 hex = hex + " "; | 49 hex = hex + " "; |
| 50 | 50 |
| 51 for (const unsigned char *p = row; p < row + 4 && p < row + length; ++p) | 51 for (const unsigned char* p = row; p < row + 4 && p < row + length; ++p) { |
| 52 hex += (*p >= 0x20 && *p <= 0x7f) ? (*p) : '.'; | 52 hex += (*p >= 0x20 && *p <= 0x7f) ? (*p) : '.'; |
| 53 } |
| 53 | 54 |
| 54 hex = hex + '\n'; | 55 hex = hex + '\n'; |
| 55 } | 56 } |
| 56 return hex; | 57 return hex; |
| 57 } | 58 } |
| 58 | 59 |
| 59 void CompareCharArraysWithHexError( | 60 void CompareCharArraysWithHexError( |
| 60 const std::string& description, | 61 const std::string& description, |
| 61 const unsigned char* actual, | 62 const unsigned char* actual, |
| 62 const int actual_len, | 63 const int actual_len, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 168 |
| 168 // Construct a fake SSLInfo that will pass AddHPKPHeader's checks. | 169 // Construct a fake SSLInfo that will pass AddHPKPHeader's checks. |
| 169 SSLInfo ssl_info; | 170 SSLInfo ssl_info; |
| 170 ssl_info.is_issued_by_known_root = true; | 171 ssl_info.is_issued_by_known_root = true; |
| 171 ssl_info.public_key_hashes.push_back(GetTestHashValue(primary_label)); | 172 ssl_info.public_key_hashes.push_back(GetTestHashValue(primary_label)); |
| 172 EXPECT_TRUE(state->AddHPKPHeader(host, header, ssl_info)); | 173 EXPECT_TRUE(state->AddHPKPHeader(host, header, ssl_info)); |
| 173 } | 174 } |
| 174 | 175 |
| 175 } // namespace test | 176 } // namespace test |
| 176 } // namespace net | 177 } // namespace net |
| OLD | NEW |