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

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 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 host, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(), 1213 host, GURL(), CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
1214 CONTENT_SETTING_BLOCK); 1214 CONTENT_SETTING_BLOCK);
1215 EXPECT_EQ(CONTENT_SETTING_BLOCK, 1215 EXPECT_EQ(CONTENT_SETTING_BLOCK,
1216 host_content_settings_map->GetContentSetting( 1216 host_content_settings_map->GetContentSetting(
1217 host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string())); 1217 host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
1218 EXPECT_EQ(CONTENT_SETTING_ALLOW, 1218 EXPECT_EQ(CONTENT_SETTING_ALLOW,
1219 host_content_settings_map->GetContentSetting( 1219 host_content_settings_map->GetContentSetting(
1220 embedder, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string())); 1220 embedder, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
1221 } 1221 }
1222 1222
1223 TEST_F(HostContentSettingsMapTest, IsDefaultSettingAllowedForType) {
1224 EXPECT_FALSE(HostContentSettingsMap::IsDefaultSettingAllowedForType(
1225 CONTENT_SETTING_ALLOW, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC));
1226 EXPECT_FALSE(HostContentSettingsMap::IsDefaultSettingAllowedForType(
1227 CONTENT_SETTING_ALLOW, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA));
1228 }
1229
1230 TEST_F(HostContentSettingsMapTest, AddContentSettingsObserver) { 1223 TEST_F(HostContentSettingsMapTest, AddContentSettingsObserver) {
1231 TestingProfile profile; 1224 TestingProfile profile;
1232 HostContentSettingsMap* host_content_settings_map = 1225 HostContentSettingsMap* host_content_settings_map =
1233 HostContentSettingsMapFactory::GetForProfile(&profile); 1226 HostContentSettingsMapFactory::GetForProfile(&profile);
1234 content_settings::MockObserver mock_observer; 1227 content_settings::MockObserver mock_observer;
1235 1228
1236 GURL host("http://example.com/"); 1229 GURL host("http://example.com/");
1237 ContentSettingsPattern pattern = 1230 ContentSettingsPattern pattern =
1238 ContentSettingsPattern::FromString("[*.]example.com"); 1231 ContentSettingsPattern::FromString("[*.]example.com");
1239 EXPECT_CALL(mock_observer, OnContentSettingChanged( 1232 EXPECT_CALL(mock_observer, OnContentSettingChanged(
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 GURL valid_url("http://google.com"); 1798 GURL valid_url("http://google.com");
1806 EXPECT_TRUE(map->CanSetNarrowestContentSetting( 1799 EXPECT_TRUE(map->CanSetNarrowestContentSetting(
1807 valid_url, valid_url, 1800 valid_url, valid_url,
1808 CONTENT_SETTINGS_TYPE_POPUPS)); 1801 CONTENT_SETTINGS_TYPE_POPUPS));
1809 1802
1810 GURL invalid_url("about:blank"); 1803 GURL invalid_url("about:blank");
1811 EXPECT_FALSE(map->CanSetNarrowestContentSetting( 1804 EXPECT_FALSE(map->CanSetNarrowestContentSetting(
1812 invalid_url, invalid_url, 1805 invalid_url, invalid_url,
1813 CONTENT_SETTINGS_TYPE_POPUPS)); 1806 CONTENT_SETTINGS_TYPE_POPUPS));
1814 } 1807 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698