OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/webcrypto/algorithms/test_helpers.h" | 5 #include "components/webcrypto/algorithms/test_helpers.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 CryptoData(MakeJsonVector(dict)), algorithm, extractable, | 384 CryptoData(MakeJsonVector(dict)), algorithm, extractable, |
385 usages, key); | 385 usages, key); |
386 } | 386 } |
387 | 387 |
388 std::unique_ptr<base::DictionaryValue> GetJwkDictionary( | 388 std::unique_ptr<base::DictionaryValue> GetJwkDictionary( |
389 const std::vector<uint8_t>& json) { | 389 const std::vector<uint8_t>& json) { |
390 base::StringPiece json_string(reinterpret_cast<const char*>(json.data()), | 390 base::StringPiece json_string(reinterpret_cast<const char*>(json.data()), |
391 json.size()); | 391 json.size()); |
392 std::unique_ptr<base::Value> value = base::JSONReader::Read(json_string); | 392 std::unique_ptr<base::Value> value = base::JSONReader::Read(json_string); |
393 EXPECT_TRUE(value.get()); | 393 EXPECT_TRUE(value.get()); |
394 EXPECT_TRUE(value->IsType(base::Value::TYPE_DICTIONARY)); | 394 EXPECT_TRUE(value->IsType(base::Value::Type::DICTIONARY)); |
395 | 395 |
396 return std::unique_ptr<base::DictionaryValue>( | 396 return std::unique_ptr<base::DictionaryValue>( |
397 static_cast<base::DictionaryValue*>(value.release())); | 397 static_cast<base::DictionaryValue*>(value.release())); |
398 } | 398 } |
399 | 399 |
400 // Verifies the input dictionary contains the expected values. Exact matches are | 400 // Verifies the input dictionary contains the expected values. Exact matches are |
401 // required on the fields examined. | 401 // required on the fields examined. |
402 ::testing::AssertionResult VerifyJwk( | 402 ::testing::AssertionResult VerifyJwk( |
403 const std::unique_ptr<base::DictionaryValue>& dict, | 403 const std::unique_ptr<base::DictionaryValue>& dict, |
404 const std::string& kty_expected, | 404 const std::string& kty_expected, |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 } | 686 } |
687 | 687 |
688 blink::WebCryptoAlgorithm CreateEcImportAlgorithm( | 688 blink::WebCryptoAlgorithm CreateEcImportAlgorithm( |
689 blink::WebCryptoAlgorithmId id, | 689 blink::WebCryptoAlgorithmId id, |
690 blink::WebCryptoNamedCurve named_curve) { | 690 blink::WebCryptoNamedCurve named_curve) { |
691 return blink::WebCryptoAlgorithm::adoptParamsAndCreate( | 691 return blink::WebCryptoAlgorithm::adoptParamsAndCreate( |
692 id, new blink::WebCryptoEcKeyImportParams(named_curve)); | 692 id, new blink::WebCryptoEcKeyImportParams(named_curve)); |
693 } | 693 } |
694 | 694 |
695 } // namespace webcrypto | 695 } // namespace webcrypto |
OLD | NEW |