| 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.h" | 9 #include "base/message_loop.h" |
| 10 #include "chrome/browser/content_settings/content_settings_details.h" | 10 #include "chrome/browser/content_settings/content_settings_details.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 host_content_settings_map->GetContentSetting( | 136 host_content_settings_map->GetContentSetting( |
| 137 host, host, CONTENT_SETTINGS_TYPE_POPUPS, "")); | 137 host, host, CONTENT_SETTINGS_TYPE_POPUPS, "")); |
| 138 EXPECT_EQ(CONTENT_SETTING_ASK, | 138 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 139 host_content_settings_map->GetContentSetting( | 139 host_content_settings_map->GetContentSetting( |
| 140 host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, "")); | 140 host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, "")); |
| 141 EXPECT_EQ(CONTENT_SETTING_ASK, | 141 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 142 host_content_settings_map->GetContentSetting( | 142 host_content_settings_map->GetContentSetting( |
| 143 host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "")); | 143 host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "")); |
| 144 EXPECT_EQ(CONTENT_SETTING_ASK, | 144 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 145 host_content_settings_map->GetContentSetting( | 145 host_content_settings_map->GetContentSetting( |
| 146 host, host, CONTENT_SETTINGS_TYPE_INTENTS, "")); | |
| 147 EXPECT_EQ(CONTENT_SETTING_ASK, | |
| 148 host_content_settings_map->GetContentSetting( | |
| 149 host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, "")); | 146 host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, "")); |
| 150 EXPECT_EQ(CONTENT_SETTING_ASK, | 147 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 151 host_content_settings_map->GetContentSetting( | 148 host_content_settings_map->GetContentSetting( |
| 152 host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, "")); | 149 host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, "")); |
| 153 | 150 |
| 154 // Check returning all hosts for a setting. | 151 // Check returning all hosts for a setting. |
| 155 ContentSettingsPattern pattern2 = | 152 ContentSettingsPattern pattern2 = |
| 156 ContentSettingsPattern::FromString("[*.]example.org"); | 153 ContentSettingsPattern::FromString("[*.]example.org"); |
| 157 host_content_settings_map->SetContentSetting( | 154 host_content_settings_map->SetContentSetting( |
| 158 pattern2, | 155 pattern2, |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 host_content_settings_map->GetContentSetting( | 599 host_content_settings_map->GetContentSetting( |
| 603 host, host, CONTENT_SETTINGS_TYPE_POPUPS, "")); | 600 host, host, CONTENT_SETTINGS_TYPE_POPUPS, "")); |
| 604 EXPECT_EQ(CONTENT_SETTING_ASK, | 601 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 605 host_content_settings_map->GetContentSetting( | 602 host_content_settings_map->GetContentSetting( |
| 606 host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, "")); | 603 host, host, CONTENT_SETTINGS_TYPE_GEOLOCATION, "")); |
| 607 EXPECT_EQ(CONTENT_SETTING_ASK, | 604 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 608 host_content_settings_map->GetContentSetting( | 605 host_content_settings_map->GetContentSetting( |
| 609 host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "")); | 606 host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "")); |
| 610 EXPECT_EQ(CONTENT_SETTING_ASK, | 607 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 611 host_content_settings_map->GetContentSetting( | 608 host_content_settings_map->GetContentSetting( |
| 612 host, host, CONTENT_SETTINGS_TYPE_INTENTS, "")); | |
| 613 EXPECT_EQ(CONTENT_SETTING_ASK, | |
| 614 host_content_settings_map->GetContentSetting( | |
| 615 host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, "")); | 609 host, host, CONTENT_SETTINGS_TYPE_FULLSCREEN, "")); |
| 616 EXPECT_EQ(CONTENT_SETTING_ASK, | 610 EXPECT_EQ(CONTENT_SETTING_ASK, |
| 617 host_content_settings_map->GetContentSetting( | 611 host_content_settings_map->GetContentSetting( |
| 618 host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, "")); | 612 host, host, CONTENT_SETTINGS_TYPE_MOUSELOCK, "")); |
| 619 } | 613 } |
| 620 | 614 |
| 621 TEST_F(HostContentSettingsMapTest, OffTheRecord) { | 615 TEST_F(HostContentSettingsMapTest, OffTheRecord) { |
| 622 TestingProfile profile; | 616 TestingProfile profile; |
| 623 HostContentSettingsMap* host_content_settings_map = | 617 HostContentSettingsMap* host_content_settings_map = |
| 624 profile.GetHostContentSettingsMap(); | 618 profile.GetHostContentSettingsMap(); |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 EXPECT_TRUE(host_content_settings_map->ShouldAllowAllContent( | 1028 EXPECT_TRUE(host_content_settings_map->ShouldAllowAllContent( |
| 1035 https_host, embedder, CONTENT_SETTINGS_TYPE_COOKIES)); | 1029 https_host, embedder, CONTENT_SETTINGS_TYPE_COOKIES)); |
| 1036 EXPECT_TRUE(host_content_settings_map->ShouldAllowAllContent( | 1030 EXPECT_TRUE(host_content_settings_map->ShouldAllowAllContent( |
| 1037 https_host, embedder, CONTENT_SETTINGS_TYPE_COOKIES)); | 1031 https_host, embedder, CONTENT_SETTINGS_TYPE_COOKIES)); |
| 1038 EXPECT_TRUE(host_content_settings_map->ShouldAllowAllContent( | 1032 EXPECT_TRUE(host_content_settings_map->ShouldAllowAllContent( |
| 1039 embedder, http_host, CONTENT_SETTINGS_TYPE_COOKIES)); | 1033 embedder, http_host, CONTENT_SETTINGS_TYPE_COOKIES)); |
| 1040 EXPECT_TRUE(host_content_settings_map->ShouldAllowAllContent( | 1034 EXPECT_TRUE(host_content_settings_map->ShouldAllowAllContent( |
| 1041 extension, extension, CONTENT_SETTINGS_TYPE_COOKIES)); | 1035 extension, extension, CONTENT_SETTINGS_TYPE_COOKIES)); |
| 1042 EXPECT_FALSE(host_content_settings_map->ShouldAllowAllContent( | 1036 EXPECT_FALSE(host_content_settings_map->ShouldAllowAllContent( |
| 1043 extension, extension, CONTENT_SETTINGS_TYPE_PLUGINS)); | 1037 extension, extension, CONTENT_SETTINGS_TYPE_PLUGINS)); |
| 1044 EXPECT_TRUE(host_content_settings_map->ShouldAllowAllContent( | |
| 1045 extension, extension, CONTENT_SETTINGS_TYPE_INTENTS)); | |
| 1046 EXPECT_FALSE(host_content_settings_map->ShouldAllowAllContent( | 1038 EXPECT_FALSE(host_content_settings_map->ShouldAllowAllContent( |
| 1047 extension, http_host, CONTENT_SETTINGS_TYPE_COOKIES)); | 1039 extension, http_host, CONTENT_SETTINGS_TYPE_COOKIES)); |
| 1048 } | 1040 } |
| 1049 | 1041 |
| 1050 TEST_F(HostContentSettingsMapTest, MigrateClearOnExit) { | 1042 TEST_F(HostContentSettingsMapTest, MigrateClearOnExit) { |
| 1051 TestingProfile profile; | 1043 TestingProfile profile; |
| 1052 TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); | 1044 TestingPrefServiceSyncable* prefs = profile.GetTestingPrefService(); |
| 1053 | 1045 |
| 1054 prefs->SetBoolean(prefs::kClearSiteDataOnExit, true); | 1046 prefs->SetBoolean(prefs::kClearSiteDataOnExit, true); |
| 1055 | 1047 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1080 GURL("http://other.com"), | 1072 GURL("http://other.com"), |
| 1081 CONTENT_SETTINGS_TYPE_COOKIES, | 1073 CONTENT_SETTINGS_TYPE_COOKIES, |
| 1082 std::string())); | 1074 std::string())); |
| 1083 EXPECT_EQ(CONTENT_SETTING_SESSION_ONLY, | 1075 EXPECT_EQ(CONTENT_SETTING_SESSION_ONLY, |
| 1084 host_content_settings_map->GetContentSetting( | 1076 host_content_settings_map->GetContentSetting( |
| 1085 GURL("http://third.com"), | 1077 GURL("http://third.com"), |
| 1086 GURL("http://third.com"), | 1078 GURL("http://third.com"), |
| 1087 CONTENT_SETTINGS_TYPE_COOKIES, | 1079 CONTENT_SETTINGS_TYPE_COOKIES, |
| 1088 std::string())); | 1080 std::string())); |
| 1089 } | 1081 } |
| OLD | NEW |