OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |