Cleanup extensions unittests to use constant for extensions settings preference

Bug: 
Change-Id: I00d7ff48486400e111150cad2b654dd2700a90b6
Reviewed-on: https://chromium-review.googlesource.com/861625
Reviewed-by: Finnur Thorarinsson <[email protected]>
Commit-Queue: Finnur Thorarinsson <[email protected]>
Cr-Commit-Position: refs/heads/master@{#528620}
diff --git a/chrome/browser/extensions/extension_garbage_collector_unittest.cc b/chrome/browser/extensions/extension_garbage_collector_unittest.cc
index 5de2e94a..4294a39 100644
--- a/chrome/browser/extensions/extension_garbage_collector_unittest.cc
+++ b/chrome/browser/extensions/extension_garbage_collector_unittest.cc
@@ -20,6 +20,7 @@
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "content/public/test/test_utils.h"
 #include "extensions/browser/extension_prefs.h"
+#include "extensions/browser/pref_names.h"
 #include "ppapi/features/features.h"
 
 namespace extensions {
@@ -52,7 +53,7 @@
 
   // Simulate that one of them got partially deleted by clearing its pref.
   {
-    DictionaryPrefUpdate update(profile_->GetPrefs(), "extensions.settings");
+    DictionaryPrefUpdate update(profile_->GetPrefs(), pref_names::kExtensions);
     base::DictionaryValue* dict = update.Get();
     ASSERT_TRUE(dict != NULL);
     dict->Remove(kExtensionId, NULL);
@@ -87,7 +88,7 @@
 
   // Simulate that one of them got partially deleted by clearing its pref.
   {
-    DictionaryPrefUpdate update(profile_->GetPrefs(), "extensions.settings");
+    DictionaryPrefUpdate update(profile_->GetPrefs(), pref_names::kExtensions);
     base::DictionaryValue* dict = update.Get();
     ASSERT_TRUE(dict != NULL);
     dict->Remove(kExtensionId, NULL);
diff --git a/chrome/browser/extensions/extension_service_test_base.cc b/chrome/browser/extensions/extension_service_test_base.cc
index 74eee1b4..09b97fd9 100644
--- a/chrome/browser/extensions/extension_service_test_base.cc
+++ b/chrome/browser/extensions/extension_service_test_base.cc
@@ -32,6 +32,7 @@
 #include "content/public/browser/browser_context.h"
 #include "extensions/browser/extension_prefs.h"
 #include "extensions/browser/extension_registry.h"
+#include "extensions/browser/pref_names.h"
 
 #if defined(OS_CHROMEOS)
 #include "chrome/browser/chromeos/extensions/install_limiter.h"
@@ -190,7 +191,7 @@
 
 size_t ExtensionServiceTestBase::GetPrefKeyCount() {
   const base::DictionaryValue* dict =
-      profile()->GetPrefs()->GetDictionary("extensions.settings");
+      profile()->GetPrefs()->GetDictionary(pref_names::kExtensions);
   if (!dict) {
     ADD_FAILURE();
     return 0;
@@ -212,7 +213,7 @@
 
   PrefService* prefs = profile()->GetPrefs();
   const base::DictionaryValue* dict =
-      prefs->GetDictionary("extensions.settings");
+      prefs->GetDictionary(pref_names::kExtensions);
   if (!dict) {
     return testing::AssertionFailure()
         << "extension.settings does not exist " << msg;
@@ -245,7 +246,7 @@
 
   PrefService* prefs = profile()->GetPrefs();
   const base::DictionaryValue* dict =
-      prefs->GetDictionary("extensions.settings");
+      prefs->GetDictionary(pref_names::kExtensions);
   ASSERT_TRUE(dict != NULL) << msg;
   const base::DictionaryValue* pref = NULL;
   ASSERT_TRUE(dict->GetDictionary(extension_id, &pref)) << msg;
@@ -264,7 +265,7 @@
                                        expected_val.c_str());
 
   const base::DictionaryValue* dict =
-      profile()->GetPrefs()->GetDictionary("extensions.settings");
+      profile()->GetPrefs()->GetDictionary(pref_names::kExtensions);
   ASSERT_TRUE(dict != NULL) << msg;
   const base::DictionaryValue* pref = NULL;
   std::string manifest_path = extension_id + ".manifest";
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index 7de6ea1..3c9a7cf 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -112,6 +112,7 @@
 #include "extensions/browser/install_flag.h"
 #include "extensions/browser/management_policy.h"
 #include "extensions/browser/mock_external_provider.h"
+#include "extensions/browser/pref_names.h"
 #include "extensions/browser/test_extension_registry_observer.h"
 #include "extensions/browser/test_management_policy.h"
 #include "extensions/browser/uninstall_reason.h"
@@ -693,8 +694,8 @@
 
   bool IsPrefExist(const std::string& extension_id,
                    const std::string& pref_path) {
-    const base::DictionaryValue* dict =
-        profile()->GetPrefs()->GetDictionary("extensions.settings");
+    const base::DictionaryValue* dict = profile()->GetPrefs()->GetDictionary(
+        extensions::pref_names::kExtensions);
     if (dict == NULL) return false;
     const base::DictionaryValue* pref = NULL;
     if (!dict->GetDictionary(extension_id, &pref)) {
@@ -714,7 +715,8 @@
                const std::string& pref_path,
                std::unique_ptr<base::Value> value,
                const std::string& msg) {
-    DictionaryPrefUpdate update(profile()->GetPrefs(), "extensions.settings");
+    DictionaryPrefUpdate update(profile()->GetPrefs(),
+                                extensions::pref_names::kExtensions);
     base::DictionaryValue* dict = update.Get();
     ASSERT_TRUE(dict != NULL) << msg;
     base::DictionaryValue* pref = NULL;
@@ -752,7 +754,8 @@
     std::string msg = " while clearing: ";
     msg += extension_id + " " + pref_path;
 
-    DictionaryPrefUpdate update(profile()->GetPrefs(), "extensions.settings");
+    DictionaryPrefUpdate update(profile()->GetPrefs(),
+                                extensions::pref_names::kExtensions);
     base::DictionaryValue* dict = update.Get();
     ASSERT_TRUE(dict != NULL) << msg;
     base::DictionaryValue* pref = NULL;