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

Side by Side Diff: chrome/browser/ui/webui/site_settings_helper_unittest.cc

Issue 2577043002: Fix content settings for hosted apps not displayed correctly. (Closed)
Patch Set: add tests to verify kDisplayName is set for exceptions and exceptions for hosted apps Created 4 years 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
« no previous file with comments | « chrome/browser/ui/webui/site_settings_helper.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/memory/ptr_util.h" 5 #include "base/memory/ptr_util.h"
6 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 6 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
7 #include "chrome/browser/ui/webui/site_settings_helper.h" 7 #include "chrome/browser/ui/webui/site_settings_helper.h"
8 #include "chrome/test/base/testing_profile.h" 8 #include "chrome/test/base/testing_profile.h"
9 #include "components/content_settings/core/browser/host_content_settings_map.h" 9 #include "components/content_settings/core/browser/host_content_settings_map.h"
10 #include "components/content_settings/core/test/content_settings_mock_provider.h " 10 #include "components/content_settings/core/test/content_settings_mock_provider.h "
(...skipping 12 matching lines...) Expand all
23 public: 23 public:
24 void VerifySetting(const base::ListValue& exceptions, 24 void VerifySetting(const base::ListValue& exceptions,
25 int index, 25 int index,
26 const std::string& pattern, 26 const std::string& pattern,
27 const std::string& setting) { 27 const std::string& setting) {
28 const base::DictionaryValue* dict; 28 const base::DictionaryValue* dict;
29 exceptions.GetDictionary(index, &dict); 29 exceptions.GetDictionary(index, &dict);
30 std::string actual_pattern; 30 std::string actual_pattern;
31 dict->GetString("origin", &actual_pattern); 31 dict->GetString("origin", &actual_pattern);
32 EXPECT_EQ(pattern, actual_pattern); 32 EXPECT_EQ(pattern, actual_pattern);
33 std::string actual_display_name;
34 dict->GetString("displayName", &actual_display_name);
35 EXPECT_EQ(pattern, actual_display_name);
33 std::string actual_setting; 36 std::string actual_setting;
34 dict->GetString("setting", &actual_setting); 37 dict->GetString("setting", &actual_setting);
35 EXPECT_EQ(setting, actual_setting); 38 EXPECT_EQ(setting, actual_setting);
36 } 39 }
37 40
38 void AddSetting(HostContentSettingsMap* map, 41 void AddSetting(HostContentSettingsMap* map,
39 const std::string& pattern, 42 const std::string& pattern,
40 ContentSetting setting) { 43 ContentSetting setting) {
41 map->SetContentSettingCustomScope( 44 map->SetContentSettingCustomScope(
42 ContentSettingsPattern::FromString(pattern), 45 ContentSettingsPattern::FromString(pattern),
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 VerifySetting(exceptions, i++, "http://[*.]google.com", "block"); 106 VerifySetting(exceptions, i++, "http://[*.]google.com", "block");
104 // From extension provider: 107 // From extension provider:
105 VerifySetting(exceptions, i++, "http://drive.google.com", "ask"); 108 VerifySetting(exceptions, i++, "http://drive.google.com", "ask");
106 // From user preferences: 109 // From user preferences:
107 VerifySetting(exceptions, i++, "http://maps.google.com", "block"); 110 VerifySetting(exceptions, i++, "http://maps.google.com", "block");
108 VerifySetting(exceptions, i++, "http://[*.]google.com", "allow"); 111 VerifySetting(exceptions, i++, "http://[*.]google.com", "allow");
109 VerifySetting(exceptions, i++, "http://*", "block"); 112 VerifySetting(exceptions, i++, "http://*", "block");
110 } 113 }
111 114
112 } // namespace site_settings 115 } // namespace site_settings
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/site_settings_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698