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

Side by Side Diff: chrome/browser/extensions/extension_override_apitest.cc

Issue 2806283002: Revert of Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 <utility>
8
9 #include "base/memory/ptr_util.h"
10 #include "base/values.h"
11 #include "build/build_config.h" 7 #include "build/build_config.h"
12 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
13 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/extension_web_ui.h" 10 #include "chrome/browser/extensions/extension_web_ui.h"
15 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" 13 #include "chrome/browser/ui/tabs/tab_strip_model.h"
18 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" 14 #include "chrome/common/extensions/chrome_manifest_url_handlers.h"
19 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
20 #include "chrome/test/base/ui_test_utils.h" 16 #include "chrome/test/base/ui_test_utils.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 ASSERT_TRUE(CheckHistoryOverridesContainsNoDupes()); 267 ASSERT_TRUE(CheckHistoryOverridesContainsNoDupes());
272 } 268 }
273 269
274 // TODO(devlin): This test seems a bit contrived. How would we end up with 270 // TODO(devlin): This test seems a bit contrived. How would we end up with
275 // duplicate entries created? 271 // duplicate entries created?
276 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, ShouldCleanUpDuplicateEntries) { 272 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, ShouldCleanUpDuplicateEntries) {
277 // Simulate several LoadExtension() calls happening over the lifetime of 273 // Simulate several LoadExtension() calls happening over the lifetime of
278 // a preferences file without corresponding UnloadExtension() calls. This is 274 // a preferences file without corresponding UnloadExtension() calls. This is
279 // the same as the above test, except for that it is testing the case where 275 // the same as the above test, except for that it is testing the case where
280 // the file already contains dupes when an extension is loaded. 276 // the file already contains dupes when an extension is loaded.
281 auto list = base::MakeUnique<base::ListValue>(); 277 base::ListValue* list = new base::ListValue();
282 for (size_t i = 0; i < 3; ++i) { 278 for (size_t i = 0; i < 3; ++i) {
283 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 279 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
284 dict->SetString("entry", "http://www.google.com/"); 280 dict->SetString("entry", "http://www.google.com/");
285 dict->SetBoolean("active", true); 281 dict->SetBoolean("active", true);
286 list->Append(std::move(dict)); 282 list->Append(std::move(dict));
287 } 283 }
288 284
289 { 285 {
290 DictionaryPrefUpdate update(browser()->profile()->GetPrefs(), 286 DictionaryPrefUpdate update(browser()->profile()->GetPrefs(),
291 ExtensionWebUI::kExtensionURLOverrides); 287 ExtensionWebUI::kExtensionURLOverrides);
292 update.Get()->Set("history", std::move(list)); 288 update.Get()->Set("history", list);
293 } 289 }
294 290
295 ASSERT_FALSE(CheckHistoryOverridesContainsNoDupes()); 291 ASSERT_FALSE(CheckHistoryOverridesContainsNoDupes());
296 292
297 ExtensionWebUI::InitializeChromeURLOverrides(profile()); 293 ExtensionWebUI::InitializeChromeURLOverrides(profile());
298 294
299 ASSERT_TRUE(CheckHistoryOverridesContainsNoDupes()); 295 ASSERT_TRUE(CheckHistoryOverridesContainsNoDupes());
300 } 296 }
301 297
302 } // namespace extensions 298 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management_test_util.cc ('k') | chrome/browser/extensions/extension_prefs_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698