Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: components/webcrypto/algorithms/aes_kw_unittest.cc

Issue 2889163002: Remove raw DictionaryValue::Set in //components (Closed)
Patch Set: Nits Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h"
9 #include "base/stl_util.h" 10 #include "base/stl_util.h"
10 #include "base/values.h" 11 #include "base/values.h"
11 #include "components/webcrypto/algorithm_dispatch.h" 12 #include "components/webcrypto/algorithm_dispatch.h"
12 #include "components/webcrypto/algorithms/test_helpers.h" 13 #include "components/webcrypto/algorithms/test_helpers.h"
13 #include "components/webcrypto/crypto_data.h" 14 #include "components/webcrypto/crypto_data.h"
14 #include "components/webcrypto/status.h" 15 #include "components/webcrypto/status.h"
15 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" 16 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h"
16 #include "third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h" 17 #include "third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h"
17 18
18 namespace webcrypto { 19 namespace webcrypto {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 CryptoData(std::vector<uint8_t>(16)), 52 CryptoData(std::vector<uint8_t>(16)),
52 CreateAlgorithm(blink::kWebCryptoAlgorithmIdAesKw), true, 53 CreateAlgorithm(blink::kWebCryptoAlgorithmIdAesKw), true,
53 0, &key)); 54 0, &key));
54 } 55 }
55 56
56 TEST_F(WebCryptoAesKwTest, ImportKeyJwkKeyOpsWrapUnwrap) { 57 TEST_F(WebCryptoAesKwTest, ImportKeyJwkKeyOpsWrapUnwrap) {
57 blink::WebCryptoKey key; 58 blink::WebCryptoKey key;
58 base::DictionaryValue dict; 59 base::DictionaryValue dict;
59 dict.SetString("kty", "oct"); 60 dict.SetString("kty", "oct");
60 dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg"); 61 dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg");
61 base::ListValue* key_ops = new base::ListValue; 62 base::ListValue* key_ops =
62 dict.Set("key_ops", key_ops); // Takes ownership. 63 dict.SetList("key_ops", base::MakeUnique<base::ListValue>());
63 64
64 key_ops->AppendString("wrapKey"); 65 key_ops->AppendString("wrapKey");
65 66
66 EXPECT_EQ(Status::Success(), 67 EXPECT_EQ(Status::Success(),
67 ImportKeyJwkFromDict( 68 ImportKeyJwkFromDict(
68 dict, CreateAlgorithm(blink::kWebCryptoAlgorithmIdAesKw), false, 69 dict, CreateAlgorithm(blink::kWebCryptoAlgorithmIdAesKw), false,
69 blink::kWebCryptoKeyUsageWrapKey, &key)); 70 blink::kWebCryptoKeyUsageWrapKey, &key));
70 71
71 EXPECT_EQ(blink::kWebCryptoKeyUsageWrapKey, key.Usages()); 72 EXPECT_EQ(blink::kWebCryptoKeyUsageWrapKey, key.Usages());
72 73
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 CreateRsaHashedImportAlgorithm( 536 CreateRsaHashedImportAlgorithm(
536 blink::kWebCryptoAlgorithmIdRsaSsaPkcs1v1_5, 537 blink::kWebCryptoAlgorithmIdRsaSsaPkcs1v1_5,
537 blink::kWebCryptoAlgorithmIdSha256), 538 blink::kWebCryptoAlgorithmIdSha256),
538 true, bad_usages[i], &key)); 539 true, bad_usages[i], &key));
539 } 540 }
540 } 541 }
541 542
542 } // namespace 543 } // namespace
543 544
544 } // namespace webcrypto 545 } // namespace webcrypto
OLDNEW
« no previous file with comments | « components/webcrypto/algorithms/aes_cbc_unittest.cc ('k') | components/webcrypto/algorithms/hmac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698