Migrate chrome/browser/sync/test to new pref update classes.

ListPrefUpdate and DictPrefUpdate are now deprecated, in favor of
ScopedListPrefUpdate and ScopedDictPrefUpdate, which only expose
Value::List and Value::Dict, respectively, to discourage use of other
APIs to manipulate lists and dicts, which are all deprecated.

Bug: 1362719
Change-Id: I4ba30c19b448404330f011a0f153025c71194c3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3905136
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1049641}
diff --git a/chrome/browser/sync/test/integration/preferences_helper.cc b/chrome/browser/sync/test/integration/preferences_helper.cc
index 3774778..ef3b9d24 100644
--- a/chrome/browser/sync/test/integration/preferences_helper.cc
+++ b/chrome/browser/sync/test/integration/preferences_helper.cc
@@ -56,11 +56,11 @@
 
 void ChangeListPref(int index,
                     const char* pref_name,
-                    const base::ListValue& new_value) {
-  ListPrefUpdate update(GetPrefs(index), pref_name);
-  base::Value* list = update.Get();
-  for (const base::Value& it : new_value.GetListDeprecated()) {
-    list->Append(it.Clone());
+                    const base::Value::List& new_value) {
+  ScopedListPrefUpdate update(GetPrefs(index), pref_name);
+  base::Value::List& list = update.Get();
+  for (const base::Value& it : new_value) {
+    list.Append(it.Clone());
   }
 }
 
diff --git a/chrome/browser/sync/test/integration/preferences_helper.h b/chrome/browser/sync/test/integration/preferences_helper.h
index 8189be7..d4e54ac 100644
--- a/chrome/browser/sync/test/integration/preferences_helper.h
+++ b/chrome/browser/sync/test/integration/preferences_helper.h
@@ -62,7 +62,7 @@
 // profile with index |index| to |new_value|.
 void ChangeListPref(int index,
                     const char* pref_name,
-                    const base::ListValue& new_value);
+                    const base::Value::List& new_value);
 
 // Used to verify that the boolean preference with name |pref_name| has the
 // same value across all profiles.
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc
index 4b9c44dc..a422ea57 100644
--- a/chrome/browser/sync/test/integration/sync_test.cc
+++ b/chrome/browser/sync/test/integration/sync_test.cc
@@ -759,27 +759,25 @@
       // real clients, those are stored upon subscription with the
       // per-user-topic server. The pref name is defined in
       // per_user_topic_subscription_manager.cc.
-      DictionaryPrefUpdate update(
+      ScopedDictPrefUpdate update(
           GetProfile(index)->GetPrefs(),
           "invalidation.per_sender_registered_for_invalidation");
-      update->SetKey(kInvalidationGCMSenderId,
-                     base::Value(base::Value::Type::DICTIONARY));
+      update->Set(kInvalidationGCMSenderId, base::Value::Dict());
       for (syncer::ModelType model_type :
            GetSyncService(index)->GetPreferredDataTypes()) {
         std::string notification_type;
         if (!RealModelTypeToNotificationType(model_type, &notification_type)) {
           continue;
         }
-        update->FindDictKey(kInvalidationGCMSenderId)
-            ->SetKey(notification_type,
-                     base::Value("/private/" + notification_type +
-                                 "-topic_server_user_id"));
+        update->FindDict(kInvalidationGCMSenderId)
+            ->Set(notification_type,
+                  "/private/" + notification_type + "-topic_server_user_id");
       }
-      DictionaryPrefUpdate update_client_id(
+      ScopedDictPrefUpdate update_client_id(
           GetProfile(index)->GetPrefs(),
           invalidation::prefs::kInvalidationClientIDCache);
 
-      update_client_id->SetStringKey(kInvalidationGCMSenderId, client_id);
+      update_client_id->Set(kInvalidationGCMSenderId, client_id);
       break;
     }
     case SERVER_TYPE_UNDECIDED:
diff --git a/chrome/browser/sync/test/integration/two_client_preferences_sync_test.cc b/chrome/browser/sync/test/integration/two_client_preferences_sync_test.cc
index 03f49ea..0f5374b 100644
--- a/chrome/browser/sync/test/integration/two_client_preferences_sync_test.cc
+++ b/chrome/browser/sync/test/integration/two_client_preferences_sync_test.cc
@@ -152,7 +152,7 @@
   ChangeIntegerPref(0, prefs::kRestoreOnStartup, 0);
   ASSERT_TRUE(IntegerPrefMatchChecker(prefs::kRestoreOnStartup).Wait());
 
-  base::ListValue urls;
+  base::Value::List urls;
   urls.Append("http://www.google.com/");
   urls.Append("http://www.flickr.com/");
   ChangeIntegerPref(0, prefs::kRestoreOnStartup, 4);