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

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

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

Powered by Google App Engine
This is Rietveld 408576698