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

Side by Side Diff: chrome/browser/content_settings/host_content_settings_map_unittest.cc

Issue 2853983002: Ensure settings returned from Content Settings providers are valid (Closed)
Patch Set: Ensure settings returned from Content Settings providers are valid Created 3 years, 7 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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 host, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), 1214 host, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
1215 CONTENT_SETTING_BLOCK); 1215 CONTENT_SETTING_BLOCK);
1216 EXPECT_EQ(CONTENT_SETTING_BLOCK, 1216 EXPECT_EQ(CONTENT_SETTING_BLOCK,
1217 host_content_settings_map->GetContentSetting( 1217 host_content_settings_map->GetContentSetting(
1218 host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string())); 1218 host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
1219 EXPECT_EQ(CONTENT_SETTING_ALLOW, 1219 EXPECT_EQ(CONTENT_SETTING_ALLOW,
1220 host_content_settings_map->GetContentSetting( 1220 host_content_settings_map->GetContentSetting(
1221 embedder, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string())); 1221 embedder, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
1222 } 1222 }
1223 1223
1224 TEST_F(HostContentSettingsMapTest, IsDefaultSettingAllowedForType) {
1225 EXPECT_FALSE(HostContentSettingsMap::IsDefaultSettingAllowedForType(
1226 CONTENT_SETTING_ALLOW, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC));
1227 EXPECT_FALSE(HostContentSettingsMap::IsDefaultSettingAllowedForType(
1228 CONTENT_SETTING_ALLOW, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA));
1229 }
1230
1231 TEST_F(HostContentSettingsMapTest, AddContentSettingsObserver) { 1224 TEST_F(HostContentSettingsMapTest, AddContentSettingsObserver) {
1232 TestingProfile profile; 1225 TestingProfile profile;
1233 HostContentSettingsMap* host_content_settings_map = 1226 HostContentSettingsMap* host_content_settings_map =
1234 HostContentSettingsMapFactory::GetForProfile(&profile); 1227 HostContentSettingsMapFactory::GetForProfile(&profile);
1235 content_settings::MockObserver mock_observer; 1228 content_settings::MockObserver mock_observer;
1236 1229
1237 GURL host("http://example.com/"); 1230 GURL host("http://example.com/");
1238 ContentSettingsPattern pattern = 1231 ContentSettingsPattern pattern =
1239 ContentSettingsPattern::FromString("[*.]example.com"); 1232 ContentSettingsPattern::FromString("[*.]example.com");
1240 EXPECT_CALL(mock_observer, OnContentSettingChanged( 1233 EXPECT_CALL(mock_observer, OnContentSettingChanged(
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 EXPECT_TRUE(map->CanSetNarrowestContentSetting( 1744 EXPECT_TRUE(map->CanSetNarrowestContentSetting(
1752 valid_url, valid_url, 1745 valid_url, valid_url,
1753 CONTENT_SETTINGS_TYPE_POPUPS)); 1746 CONTENT_SETTINGS_TYPE_POPUPS));
1754 1747
1755 GURL invalid_url("about:blank"); 1748 GURL invalid_url("about:blank");
1756 EXPECT_FALSE(map->CanSetNarrowestContentSetting( 1749 EXPECT_FALSE(map->CanSetNarrowestContentSetting(
1757 invalid_url, invalid_url, 1750 invalid_url, invalid_url,
1758 CONTENT_SETTINGS_TYPE_POPUPS)); 1751 CONTENT_SETTINGS_TYPE_POPUPS));
1759 } 1752 }
1760 1753
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698