| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
| 6 #include "chrome/browser/extensions/extension_service.h" | 6 #include "chrome/browser/extensions/extension_service.h" |
| 7 #include "chrome/browser/extensions/extension_web_ui.h" | 7 #include "chrome/browser/extensions/extension_web_ui.h" |
| 8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
| 9 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 9 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 ASSERT_TRUE(CheckHistoryOverridesContainsNoDupes()); | 128 ASSERT_TRUE(CheckHistoryOverridesContainsNoDupes()); |
| 129 } | 129 } |
| 130 | 130 |
| 131 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, ShouldCleanUpDuplicateEntries) { | 131 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, ShouldCleanUpDuplicateEntries) { |
| 132 // Simulate several LoadExtension() calls happening over the lifetime of | 132 // Simulate several LoadExtension() calls happening over the lifetime of |
| 133 // a preferences file without corresponding UnloadExtension() calls. This is | 133 // a preferences file without corresponding UnloadExtension() calls. This is |
| 134 // the same as the above test, except for that it is testing the case where | 134 // the same as the above test, except for that it is testing the case where |
| 135 // the file already contains dupes when an extension is loaded. | 135 // the file already contains dupes when an extension is loaded. |
| 136 ListValue* list = new ListValue(); | 136 ListValue* list = new ListValue(); |
| 137 for (size_t i = 0; i < 3; ++i) | 137 for (size_t i = 0; i < 3; ++i) |
| 138 list->Append(Value::CreateStringValue("http://www.google.com/")); | 138 list->Append(base::StringValue::New("http://www.google.com/")); |
| 139 | 139 |
| 140 { | 140 { |
| 141 DictionaryPrefUpdate update(browser()->profile()->GetPrefs(), | 141 DictionaryPrefUpdate update(browser()->profile()->GetPrefs(), |
| 142 ExtensionWebUI::kExtensionURLOverrides); | 142 ExtensionWebUI::kExtensionURLOverrides); |
| 143 update.Get()->Set("history", list); | 143 update.Get()->Set("history", list); |
| 144 } | 144 } |
| 145 | 145 |
| 146 ASSERT_FALSE(CheckHistoryOverridesContainsNoDupes()); | 146 ASSERT_FALSE(CheckHistoryOverridesContainsNoDupes()); |
| 147 | 147 |
| 148 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("override/history"))); | 148 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("override/history"))); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 172 const ExtensionList *extensions = | 172 const ExtensionList *extensions = |
| 173 browser()->profile()->GetExtensionService()->extensions(); | 173 browser()->profile()->GetExtensionService()->extensions(); |
| 174 UnloadExtension((*extensions->rbegin())->id()); | 174 UnloadExtension((*extensions->rbegin())->id()); |
| 175 { | 175 { |
| 176 ResultCatcher catcher; | 176 ResultCatcher catcher; |
| 177 NavigateToKeyboard(); | 177 NavigateToKeyboard(); |
| 178 ASSERT_TRUE(catcher.GetNextResult()); | 178 ASSERT_TRUE(catcher.GetNextResult()); |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 #endif | 181 #endif |
| OLD | NEW |