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

Unified Diff: components/webcrypto/algorithms/hmac_unittest.cc

Issue 2889163002: Remove raw DictionaryValue::Set in //components (Closed)
Patch Set: Nits Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/webcrypto/algorithms/aes_kw_unittest.cc ('k') | components/webcrypto/jwk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/webcrypto/algorithms/hmac_unittest.cc
diff --git a/components/webcrypto/algorithms/hmac_unittest.cc b/components/webcrypto/algorithms/hmac_unittest.cc
index fe5b331323e2d0484e5b942c4923491a7eee7b50..a57cdd825be9103af27456fc97fdcc53dae7a3c3 100644
--- a/components/webcrypto/algorithms/hmac_unittest.cc
+++ b/components/webcrypto/algorithms/hmac_unittest.cc
@@ -6,7 +6,10 @@
#include <stddef.h>
#include <stdint.h>
+#include <utility>
+
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "components/webcrypto/algorithm_dispatch.h"
#include "components/webcrypto/algorithms/test_helpers.h"
@@ -228,8 +231,8 @@ TEST_F(WebCryptoHmacTest, ImportKeyJwkKeyOpsSignVerify) {
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg");
- base::ListValue* key_ops = new base::ListValue;
- dict.Set("key_ops", key_ops); // Takes ownership.
+ base::ListValue* key_ops =
+ dict.SetList("key_ops", base::MakeUnique<base::ListValue>());
key_ops->AppendString("sign");
@@ -258,14 +261,14 @@ TEST_F(WebCryptoHmacTest, ImportKeyJwkUseInconsisteWithKeyOps) {
base::DictionaryValue dict;
dict.SetString("kty", "oct");
dict.SetString("k", "GADWrMRHwQfoNaXU5fZvTg");
- base::ListValue* key_ops = new base::ListValue;
- dict.Set("key_ops", key_ops); // Takes ownership.
-
dict.SetString("alg", "HS256");
dict.SetString("use", "sig");
+
+ auto key_ops = base::MakeUnique<base::ListValue>();
key_ops->AppendString("sign");
key_ops->AppendString("verify");
key_ops->AppendString("encrypt");
+ dict.Set("key_ops", std::move(key_ops));
EXPECT_EQ(
Status::ErrorJwkUseAndKeyopsInconsistent(),
ImportKeyJwkFromDict(
« no previous file with comments | « components/webcrypto/algorithms/aes_kw_unittest.cc ('k') | components/webcrypto/jwk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698