| 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 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 } | 954 } |
| 955 | 955 |
| 956 TEST_F(HostContentSettingsMapTest, IsSettingAllowedForType) { | 956 TEST_F(HostContentSettingsMapTest, IsSettingAllowedForType) { |
| 957 TestingProfile profile; | 957 TestingProfile profile; |
| 958 PrefService* prefs = profile.GetPrefs(); | 958 PrefService* prefs = profile.GetPrefs(); |
| 959 | 959 |
| 960 EXPECT_TRUE(HostContentSettingsMap::IsSettingAllowedForType( | 960 EXPECT_TRUE(HostContentSettingsMap::IsSettingAllowedForType( |
| 961 prefs, CONTENT_SETTING_ASK, | 961 prefs, CONTENT_SETTING_ASK, |
| 962 CONTENT_SETTINGS_TYPE_FULLSCREEN)); | 962 CONTENT_SETTINGS_TYPE_FULLSCREEN)); |
| 963 | 963 |
| 964 EXPECT_FALSE(HostContentSettingsMap::IsSettingAllowedForType( |
| 965 prefs, CONTENT_SETTING_ALLOW, |
| 966 CONTENT_SETTINGS_TYPE_MEDIASTREAM)); |
| 967 EXPECT_FALSE(HostContentSettingsMap::IsSettingAllowedForType( |
| 968 prefs, CONTENT_SETTING_ASK, |
| 969 CONTENT_SETTINGS_TYPE_MEDIASTREAM)); |
| 970 EXPECT_FALSE(HostContentSettingsMap::IsSettingAllowedForType( |
| 971 prefs, CONTENT_SETTING_BLOCK, |
| 972 CONTENT_SETTINGS_TYPE_MEDIASTREAM)); |
| 973 |
| 964 // TODO(msramek): Add more checks for setting type - setting pairs where | 974 // TODO(msramek): Add more checks for setting type - setting pairs where |
| 965 // it is not obvious whether or not they are allowed. | 975 // it is not obvious whether or not they are allowed. |
| 966 } | 976 } |
| 967 | 977 |
| 968 TEST_F(HostContentSettingsMapTest, AddContentSettingsObserver) { | 978 TEST_F(HostContentSettingsMapTest, AddContentSettingsObserver) { |
| 969 TestingProfile profile; | 979 TestingProfile profile; |
| 970 HostContentSettingsMap* host_content_settings_map = | 980 HostContentSettingsMap* host_content_settings_map = |
| 971 profile.GetHostContentSettingsMap(); | 981 profile.GetHostContentSettingsMap(); |
| 972 content_settings::MockObserver mock_observer; | 982 content_settings::MockObserver mock_observer; |
| 973 | 983 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 CONTENT_SETTINGS_TYPE_IMAGES, true); | 1062 CONTENT_SETTINGS_TYPE_IMAGES, true); |
| 1053 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1063 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 1054 host_content_settings_map->GetContentSetting( | 1064 host_content_settings_map->GetContentSetting( |
| 1055 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); | 1065 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
| 1056 host_content_settings_map->SetDefaultContentSetting( | 1066 host_content_settings_map->SetDefaultContentSetting( |
| 1057 CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK); | 1067 CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK); |
| 1058 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 1068 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 1059 host_content_settings_map->GetContentSetting( | 1069 host_content_settings_map->GetContentSetting( |
| 1060 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); | 1070 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
| 1061 } | 1071 } |
| OLD | NEW |