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

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

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix various builds. Created 4 years, 6 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 "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 21 matching lines...) Expand all
32 // There should be no duplicate entries in the preferences. 32 // There should be no duplicate entries in the preferences.
33 const base::DictionaryValue* overrides = 33 const base::DictionaryValue* overrides =
34 browser()->profile()->GetPrefs()->GetDictionary( 34 browser()->profile()->GetPrefs()->GetDictionary(
35 ExtensionWebUI::kExtensionURLOverrides); 35 ExtensionWebUI::kExtensionURLOverrides);
36 36
37 const base::ListValue* values = nullptr; 37 const base::ListValue* values = nullptr;
38 if (!overrides->GetList("history", &values)) 38 if (!overrides->GetList("history", &values))
39 return false; 39 return false;
40 40
41 std::set<std::string> seen_overrides; 41 std::set<std::string> seen_overrides;
42 for (const base::Value* val : *values) { 42 for (const auto& val : *values) {
43 const base::DictionaryValue* dict = nullptr; 43 const base::DictionaryValue* dict = nullptr;
44 std::string entry; 44 std::string entry;
45 if (!val->GetAsDictionary(&dict) || !dict->GetString("entry", &entry) || 45 if (!val->GetAsDictionary(&dict) || !dict->GetString("entry", &entry) ||
46 seen_overrides.count(entry) != 0) 46 seen_overrides.count(entry) != 0)
47 return false; 47 return false;
48 seen_overrides.insert(entry); 48 seen_overrides.insert(entry);
49 } 49 }
50 50
51 return true; 51 return true;
52 } 52 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698