| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "webcrypto_impl.h" | 5 #include "webcrypto_impl.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 // Ignore case, it's checking the hex value. | 118 // Ignore case, it's checking the hex value. |
| 119 EXPECT_STRCASEEQ( | 119 EXPECT_STRCASEEQ( |
| 120 input_set[set_index].hex_result[id_index], | 120 input_set[set_index].hex_result[id_index], |
| 121 base::HexEncode( | 121 base::HexEncode( |
| 122 array_buffer.data(), array_buffer.byteLength()).c_str()); | 122 array_buffer.data(), array_buffer.byteLength()).c_str()); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 | 126 |
| 127 // TODO(padolph) Enable these tests for OpenSSL once matching impl is available |
| 128 #if !defined(USE_OPENSSL) |
| 129 |
| 127 TEST_F(WebCryptoImplTest, HMACSampleSets) { | 130 TEST_F(WebCryptoImplTest, HMACSampleSets) { |
| 128 struct { | 131 struct { |
| 129 WebKit::WebCryptoAlgorithmId algorithm; | 132 WebKit::WebCryptoAlgorithmId algorithm; |
| 130 const char* key; | 133 const char* key; |
| 131 const char* message; | 134 const char* message; |
| 132 const char* mac; | 135 const char* mac; |
| 133 } input_set[] = { | 136 } input_set[] = { |
| 134 // Empty sets. Result generated via OpenSSL commandline tool. These | 137 // Empty sets. Result generated via OpenSSL commandline tool. These |
| 135 // particular results are also posted on the Wikipedia page examples: | 138 // particular results are also posted on the Wikipedia page examples: |
| 136 // http://en.wikipedia.org/wiki/Hash-based_message_authentication_code | 139 // http://en.wikipedia.org/wiki/Hash-based_message_authentication_code |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 &array_buffer)); | 270 &array_buffer)); |
| 268 | 271 |
| 269 // Ignore case, it's checking the hex value. | 272 // Ignore case, it's checking the hex value. |
| 270 EXPECT_STRCASEEQ( | 273 EXPECT_STRCASEEQ( |
| 271 input_set[index].mac, | 274 input_set[index].mac, |
| 272 base::HexEncode( | 275 base::HexEncode( |
| 273 array_buffer.data(), array_buffer.byteLength()).c_str()); | 276 array_buffer.data(), array_buffer.byteLength()).c_str()); |
| 274 } | 277 } |
| 275 } | 278 } |
| 276 | 279 |
| 280 #endif // #if !defined(USE_OPENSSL) |
| 281 |
| 277 } // namespace content | 282 } // namespace content |
| OLD | NEW |