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

Unified Diff: components/sync/engine_impl/js_sync_encryption_handler_observer_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
Index: components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc
diff --git a/components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc b/components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc
index 8ce7f06b28e56fc7a7f997ccf1a50d35829cec05..05b6013fad9591a318c90a9c7529710bb6f1132e 100644
--- a/components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc
+++ b/components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc
@@ -4,7 +4,10 @@
#include "components/sync/engine_impl/js_sync_encryption_handler_observer.h"
+#include <utility>
+
#include "base/location.h"
+#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "base/values.h"
@@ -104,11 +107,7 @@ TEST_F(JsSyncEncryptionHandlerObserverTest, OnBootstrapTokenUpdated) {
}
TEST_F(JsSyncEncryptionHandlerObserverTest, OnEncryptedTypesChanged) {
- base::DictionaryValue expected_details;
- base::ListValue* encrypted_type_values = new base::ListValue();
- const bool encrypt_everything = false;
- expected_details.Set("encryptedTypes", encrypted_type_values);
- expected_details.SetBoolean("encryptEverything", encrypt_everything);
+ auto encrypted_type_values = base::MakeUnique<base::ListValue>();
ModelTypeSet encrypted_types;
for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) {
@@ -117,12 +116,17 @@ TEST_F(JsSyncEncryptionHandlerObserverTest, OnEncryptedTypesChanged) {
encrypted_type_values->AppendString(ModelTypeToString(type));
}
+ base::DictionaryValue expected_details;
+ const bool kEncrytEverything = false;
+ expected_details.Set("encryptedTypes", std::move(encrypted_type_values));
+ expected_details.SetBoolean("encryptEverything", kEncrytEverything);
+
EXPECT_CALL(mock_js_event_handler_,
HandleJsEvent("onEncryptedTypesChanged",
HasDetailsAsDictionary(expected_details)));
js_sync_encryption_handler_observer_.OnEncryptedTypesChanged(
- encrypted_types, encrypt_everything);
+ encrypted_types, kEncrytEverything);
PumpLoop();
}
« no previous file with comments | « components/sync/engine_impl/js_mutation_event_observer_unittest.cc ('k') | components/sync/js/js_event_details_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698