Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/fuzzer_support.h" | 5 #include "components/webcrypto/fuzzer_support.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
| 10 #include "components/test_runner/test_common.h" | |
| 11 #include "components/webcrypto/algorithm_dispatch.h" | 10 #include "components/webcrypto/algorithm_dispatch.h" |
| 12 #include "components/webcrypto/crypto_data.h" | 11 #include "components/webcrypto/crypto_data.h" |
| 13 #include "components/webcrypto/status.h" | 12 #include "components/webcrypto/status.h" |
| 13 #include "third_party/WebKit/public/platform/Platform.h" | |
| 14 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" | 14 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" |
| 15 #include "third_party/WebKit/public/web/WebKit.h" | |
| 15 | 16 |
| 16 namespace webcrypto { | 17 namespace webcrypto { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 // This mock is used to initialize blink. | 21 // This mock is used to initialize blink. |
| 21 class InitOnce { | 22 class InitOnce : NON_EXPORTED_BASE(public blink::Platform) { |
| 22 public: | 23 public: |
| 23 InitOnce() { | 24 InitOnce() { |
| 24 // EnsureBlinkInitialized() depends on the command line singleton being | 25 // EnsureBlinkInitialized() depends on the command line singleton being |
|
eroman
2016/08/11 17:55:36
Please update or remove this comment (now refers t
jam
2016/08/11 19:12:29
Done.
| |
| 25 // initialized. | 26 // initialized. |
| 26 base::CommandLine::Init(0, nullptr); | 27 base::CommandLine::Init(0, nullptr); |
| 27 test_runner::EnsureBlinkInitialized(); | 28 blink::Platform::initialize(this); |
| 28 } | 29 } |
| 30 ~InitOnce() override {} | |
| 29 }; | 31 }; |
| 30 | 32 |
| 31 base::LazyInstance<InitOnce>::Leaky g_once = LAZY_INSTANCE_INITIALIZER; | 33 base::LazyInstance<InitOnce>::Leaky g_once = LAZY_INSTANCE_INITIALIZER; |
| 32 | 34 |
| 33 void EnsureInitialized() { | 35 void EnsureInitialized() { |
| 34 g_once.Get(); | 36 g_once.Get(); |
| 35 } | 37 } |
| 36 | 38 |
| 37 blink::WebCryptoAlgorithm CreateRsaHashedImportAlgorithm( | 39 blink::WebCryptoAlgorithm CreateRsaHashedImportAlgorithm( |
| 38 blink::WebCryptoAlgorithmId id, | 40 blink::WebCryptoAlgorithmId id, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 | 125 |
| 124 // These errors imply a bad setup of parameters, and means ImportKey() may not | 126 // These errors imply a bad setup of parameters, and means ImportKey() may not |
| 125 // be testing the actual parsing. | 127 // be testing the actual parsing. |
| 126 DCHECK_NE(status.error_details(), | 128 DCHECK_NE(status.error_details(), |
| 127 Status::ErrorUnsupportedImportKeyFormat().error_details()); | 129 Status::ErrorUnsupportedImportKeyFormat().error_details()); |
| 128 DCHECK_NE(status.error_details(), | 130 DCHECK_NE(status.error_details(), |
| 129 Status::ErrorCreateKeyBadUsages().error_details()); | 131 Status::ErrorCreateKeyBadUsages().error_details()); |
| 130 } | 132 } |
| 131 | 133 |
| 132 } // namespace webcrypto | 134 } // namespace webcrypto |
| OLD | NEW |