| 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 "base/auto_reset.h" | 5 #include "base/auto_reset.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 #else | 951 #else |
| 952 EXPECT_FALSE(HostContentSettingsMap::ShouldAllowAllContent( | 952 EXPECT_FALSE(HostContentSettingsMap::ShouldAllowAllContent( |
| 953 extension, extension, CONTENT_SETTINGS_TYPE_COOKIES)); | 953 extension, extension, CONTENT_SETTINGS_TYPE_COOKIES)); |
| 954 #endif | 954 #endif |
| 955 EXPECT_FALSE(HostContentSettingsMap::ShouldAllowAllContent( | 955 EXPECT_FALSE(HostContentSettingsMap::ShouldAllowAllContent( |
| 956 extension, extension, CONTENT_SETTINGS_TYPE_PLUGINS)); | 956 extension, extension, CONTENT_SETTINGS_TYPE_PLUGINS)); |
| 957 EXPECT_FALSE(HostContentSettingsMap::ShouldAllowAllContent( | 957 EXPECT_FALSE(HostContentSettingsMap::ShouldAllowAllContent( |
| 958 extension, http_host, CONTENT_SETTINGS_TYPE_COOKIES)); | 958 extension, http_host, CONTENT_SETTINGS_TYPE_COOKIES)); |
| 959 } | 959 } |
| 960 | 960 |
| 961 TEST_F(HostContentSettingsMapTest, IsSettingAllowedForType) { |
| 962 TestingProfile profile; |
| 963 PrefService* prefs = profile.GetPrefs(); |
| 964 |
| 965 EXPECT_TRUE(HostContentSettingsMap::IsSettingAllowedForType( |
| 966 prefs, CONTENT_SETTING_ASK, |
| 967 CONTENT_SETTINGS_TYPE_FULLSCREEN)); |
| 968 |
| 969 // TODO(msramek): Add more checks for setting type - setting pairs where |
| 970 // it is not obvious whether or not they are allowed. |
| 971 } |
| 972 |
| 961 TEST_F(HostContentSettingsMapTest, AddContentSettingsObserver) { | 973 TEST_F(HostContentSettingsMapTest, AddContentSettingsObserver) { |
| 962 TestingProfile profile; | 974 TestingProfile profile; |
| 963 HostContentSettingsMap* host_content_settings_map = | 975 HostContentSettingsMap* host_content_settings_map = |
| 964 profile.GetHostContentSettingsMap(); | 976 profile.GetHostContentSettingsMap(); |
| 965 content_settings::MockObserver mock_observer; | 977 content_settings::MockObserver mock_observer; |
| 966 | 978 |
| 967 GURL host("http://example.com/"); | 979 GURL host("http://example.com/"); |
| 968 ContentSettingsPattern pattern = | 980 ContentSettingsPattern pattern = |
| 969 ContentSettingsPattern::FromString("[*.]example.com"); | 981 ContentSettingsPattern::FromString("[*.]example.com"); |
| 970 EXPECT_CALL(mock_observer, | 982 EXPECT_CALL(mock_observer, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 CONTENT_SETTINGS_TYPE_IMAGES, true); | 1057 CONTENT_SETTINGS_TYPE_IMAGES, true); |
| 1046 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1058 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 1047 host_content_settings_map->GetContentSetting( | 1059 host_content_settings_map->GetContentSetting( |
| 1048 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); | 1060 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
| 1049 host_content_settings_map->SetDefaultContentSetting( | 1061 host_content_settings_map->SetDefaultContentSetting( |
| 1050 CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK); | 1062 CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK); |
| 1051 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 1063 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 1052 host_content_settings_map->GetContentSetting( | 1064 host_content_settings_map->GetContentSetting( |
| 1053 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); | 1065 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
| 1054 } | 1066 } |
| OLD | NEW |