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

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: Fix SupervisedUserWhitelistInstaller 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
jdoerrie 2017/04/06 14:25:51 #include <utility>
vabr (Chromium) 2017/04/07 20:40:41 Done.
7 #include "base/memory/ptr_util.h"
7 #include "build/build_config.h" 8 #include "build/build_config.h"
jdoerrie 2017/04/06 14:25:51 #include "base/values.h"
vabr (Chromium) 2017/04/07 20:40:41 Done.
8 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_web_ui.h" 11 #include "chrome/browser/extensions/extension_web_ui.h"
11 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" 15 #include "chrome/common/extensions/chrome_manifest_url_handlers.h"
15 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
16 #include "chrome/test/base/ui_test_utils.h" 17 #include "chrome/test/base/ui_test_utils.h"
17 #include "components/prefs/pref_service.h" 18 #include "components/prefs/pref_service.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 ASSERT_TRUE(CheckHistoryOverridesContainsNoDupes()); 268 ASSERT_TRUE(CheckHistoryOverridesContainsNoDupes());
268 } 269 }
269 270
270 // TODO(devlin): This test seems a bit contrived. How would we end up with 271 // TODO(devlin): This test seems a bit contrived. How would we end up with
271 // duplicate entries created? 272 // duplicate entries created?
272 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, ShouldCleanUpDuplicateEntries) { 273 IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, ShouldCleanUpDuplicateEntries) {
273 // Simulate several LoadExtension() calls happening over the lifetime of 274 // Simulate several LoadExtension() calls happening over the lifetime of
274 // a preferences file without corresponding UnloadExtension() calls. This is 275 // 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 276 // 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. 277 // the file already contains dupes when an extension is loaded.
277 base::ListValue* list = new base::ListValue(); 278 auto list = base::MakeUnique<base::ListValue>();
278 for (size_t i = 0; i < 3; ++i) { 279 for (size_t i = 0; i < 3; ++i) {
279 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 280 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
280 dict->SetString("entry", "http://www.google.com/"); 281 dict->SetString("entry", "http://www.google.com/");
281 dict->SetBoolean("active", true); 282 dict->SetBoolean("active", true);
282 list->Append(std::move(dict)); 283 list->Append(std::move(dict));
283 } 284 }
284 285
285 { 286 {
286 DictionaryPrefUpdate update(browser()->profile()->GetPrefs(), 287 DictionaryPrefUpdate update(browser()->profile()->GetPrefs(),
287 ExtensionWebUI::kExtensionURLOverrides); 288 ExtensionWebUI::kExtensionURLOverrides);
288 update.Get()->Set("history", list); 289 update.Get()->Set("history", std::move(list));
289 } 290 }
290 291
291 ASSERT_FALSE(CheckHistoryOverridesContainsNoDupes()); 292 ASSERT_FALSE(CheckHistoryOverridesContainsNoDupes());
292 293
293 ExtensionWebUI::InitializeChromeURLOverrides(profile()); 294 ExtensionWebUI::InitializeChromeURLOverrides(profile());
294 295
295 ASSERT_TRUE(CheckHistoryOverridesContainsNoDupes()); 296 ASSERT_TRUE(CheckHistoryOverridesContainsNoDupes());
296 } 297 }
297 298
298 } // namespace extensions 299 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698