| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_web_ui.h" | 10 #include "chrome/browser/extensions/extension_web_ui.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 228 |
| 229 // TODO(devlin): This test seems a bit contrived. How would we end up with | 229 // TODO(devlin): This test seems a bit contrived. How would we end up with |
| 230 // duplicate entries created? | 230 // duplicate entries created? |
| 231 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, ShouldCleanUpDuplicateEntries) { | 231 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, ShouldCleanUpDuplicateEntries) { |
| 232 // Simulate several LoadExtension() calls happening over the lifetime of | 232 // Simulate several LoadExtension() calls happening over the lifetime of |
| 233 // a preferences file without corresponding UnloadExtension() calls. This is | 233 // a preferences file without corresponding UnloadExtension() calls. This is |
| 234 // the same as the above test, except for that it is testing the case where | 234 // the same as the above test, except for that it is testing the case where |
| 235 // the file already contains dupes when an extension is loaded. | 235 // the file already contains dupes when an extension is loaded. |
| 236 base::ListValue* list = new base::ListValue(); | 236 base::ListValue* list = new base::ListValue(); |
| 237 for (size_t i = 0; i < 3; ++i) { | 237 for (size_t i = 0; i < 3; ++i) { |
| 238 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 238 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 239 dict->SetString("entry", "http://www.google.com/"); | 239 dict->SetString("entry", "http://www.google.com/"); |
| 240 dict->SetBoolean("active", true); | 240 dict->SetBoolean("active", true); |
| 241 list->Append(std::move(dict)); | 241 list->Append(std::move(dict)); |
| 242 } | 242 } |
| 243 | 243 |
| 244 { | 244 { |
| 245 DictionaryPrefUpdate update(browser()->profile()->GetPrefs(), | 245 DictionaryPrefUpdate update(browser()->profile()->GetPrefs(), |
| 246 ExtensionWebUI::kExtensionURLOverrides); | 246 ExtensionWebUI::kExtensionURLOverrides); |
| 247 update.Get()->Set("history", list); | 247 update.Get()->Set("history", list); |
| 248 } | 248 } |
| 249 | 249 |
| 250 ASSERT_FALSE(CheckHistoryOverridesContainsNoDupes()); | 250 ASSERT_FALSE(CheckHistoryOverridesContainsNoDupes()); |
| 251 | 251 |
| 252 ExtensionWebUI::InitializeChromeURLOverrides(profile()); | 252 ExtensionWebUI::InitializeChromeURLOverrides(profile()); |
| 253 | 253 |
| 254 ASSERT_TRUE(CheckHistoryOverridesContainsNoDupes()); | 254 ASSERT_TRUE(CheckHistoryOverridesContainsNoDupes()); |
| 255 } | 255 } |
| 256 | 256 |
| 257 } // namespace extensions | 257 } // namespace extensions |
| OLD | NEW |