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

Unified Diff: components/sync/engine_impl/js_sync_encryption_handler_observer_unittest.cc

Issue 2889163002: Remove raw DictionaryValue::Set in //components (Closed)
Patch Set: Rebase 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..d54bbbc2f8ae17daf1e096b3e9a055fa9558e40d 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,6 +116,11 @@ TEST_F(JsSyncEncryptionHandlerObserverTest, OnEncryptedTypesChanged) {
encrypted_type_values->AppendString(ModelTypeToString(type));
}
+ base::DictionaryValue expected_details;
+ const bool encrypt_everything = false;
vabr (Chromium) 2017/06/01 19:53:33 optional nit: Should this actually be kEncryptEver
jdoerrie 2017/06/02 09:39:56 Done.
+ expected_details.Set("encryptedTypes", std::move(encrypted_type_values));
+ expected_details.SetBoolean("encryptEverything", encrypt_everything);
+
EXPECT_CALL(mock_js_event_handler_,
HandleJsEvent("onEncryptedTypesChanged",
HasDetailsAsDictionary(expected_details)));

Powered by Google App Engine
This is Rietveld 408576698