| 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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 CONTENT_SETTING_ALLOW); | 719 CONTENT_SETTING_ALLOW); |
| 720 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 720 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 721 host_content_settings_map->GetContentSetting( | 721 host_content_settings_map->GetContentSetting( |
| 722 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); | 722 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
| 723 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 723 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 724 otr_map->GetContentSetting( | 724 otr_map->GetContentSetting( |
| 725 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); | 725 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
| 726 } | 726 } |
| 727 | 727 |
| 728 TEST_F(HostContentSettingsMapTest, OffTheRecordPartialInheritPref) { | 728 TEST_F(HostContentSettingsMapTest, OffTheRecordPartialInheritPref) { |
| 729 // Permissions marked INHERIT_IN_INCOGNITO_EXCEPT_ALLOW in | 729 // Permissions marked DENY_IN_INCOGNITO_AFTER_DELAY in ContentSettingsRegistry |
| 730 // ContentSettingsRegistry (e.g. push & notifications) only inherit BLOCK | 730 // (e.g. push & notifications) only inherit BLOCKs from regular to incognito. |
| 731 // settings from regular to incognito. | |
| 732 TestingProfile profile; | 731 TestingProfile profile; |
| 733 Profile* otr_profile = profile.GetOffTheRecordProfile(); | 732 Profile* otr_profile = profile.GetOffTheRecordProfile(); |
| 734 HostContentSettingsMap* host_content_settings_map = | 733 HostContentSettingsMap* host_content_settings_map = |
| 735 HostContentSettingsMapFactory::GetForProfile(&profile); | 734 HostContentSettingsMapFactory::GetForProfile(&profile); |
| 736 HostContentSettingsMap* otr_map = | 735 HostContentSettingsMap* otr_map = |
| 737 HostContentSettingsMapFactory::GetForProfile(otr_profile); | 736 HostContentSettingsMapFactory::GetForProfile(otr_profile); |
| 738 | 737 |
| 739 GURL host("http://example.com/"); | 738 GURL host("http://example.com/"); |
| 740 ContentSettingsPattern pattern = | 739 ContentSettingsPattern pattern = |
| 741 ContentSettingsPattern::FromURLNoWildcard(host); | 740 ContentSettingsPattern::FromURLNoWildcard(host); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 CONTENT_SETTING_ALLOW, | 776 CONTENT_SETTING_ALLOW, |
| 778 host_content_settings_map->GetContentSetting( | 777 host_content_settings_map->GetContentSetting( |
| 779 host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); | 778 host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); |
| 780 EXPECT_EQ( | 779 EXPECT_EQ( |
| 781 CONTENT_SETTING_ASK, | 780 CONTENT_SETTING_ASK, |
| 782 otr_map->GetContentSetting( | 781 otr_map->GetContentSetting( |
| 783 host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); | 782 host, host, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); |
| 784 } | 783 } |
| 785 | 784 |
| 786 TEST_F(HostContentSettingsMapTest, OffTheRecordPartialInheritDefault) { | 785 TEST_F(HostContentSettingsMapTest, OffTheRecordPartialInheritDefault) { |
| 787 // Permissions marked INHERIT_IN_INCOGNITO_EXCEPT_ALLOW in | 786 // Permissions marked DENY_IN_INCOGNITO_AFTER_DELAY in ContentSettingsRegistry |
| 788 // ContentSettingsRegistry (e.g. push & notifications) only inherit BLOCK | 787 // (e.g. push & notifications) only inherit BLOCKs from regular to incognito. |
| 789 // default settings from regular to incognito. | |
| 790 TestingProfile profile; | 788 TestingProfile profile; |
| 791 Profile* otr_profile = profile.GetOffTheRecordProfile(); | 789 Profile* otr_profile = profile.GetOffTheRecordProfile(); |
| 792 HostContentSettingsMap* host_content_settings_map = | 790 HostContentSettingsMap* host_content_settings_map = |
| 793 HostContentSettingsMapFactory::GetForProfile(&profile); | 791 HostContentSettingsMapFactory::GetForProfile(&profile); |
| 794 HostContentSettingsMap* otr_map = | 792 HostContentSettingsMap* otr_map = |
| 795 HostContentSettingsMapFactory::GetForProfile(otr_profile); | 793 HostContentSettingsMapFactory::GetForProfile(otr_profile); |
| 796 | 794 |
| 797 GURL host("http://example.com/"); | 795 GURL host("http://example.com/"); |
| 798 | 796 |
| 799 EXPECT_EQ(CONTENT_SETTING_ASK, | 797 EXPECT_EQ(CONTENT_SETTING_ASK, |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1153 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 1156 host_content_settings_map->GetContentSetting( | 1154 host_content_settings_map->GetContentSetting( |
| 1157 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); | 1155 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
| 1158 host_content_settings_map->SetContentSetting( | 1156 host_content_settings_map->SetContentSetting( |
| 1159 pattern, | 1157 pattern, |
| 1160 ContentSettingsPattern::Wildcard(), | 1158 ContentSettingsPattern::Wildcard(), |
| 1161 CONTENT_SETTINGS_TYPE_IMAGES, | 1159 CONTENT_SETTINGS_TYPE_IMAGES, |
| 1162 std::string(), | 1160 std::string(), |
| 1163 CONTENT_SETTING_DEFAULT); | 1161 CONTENT_SETTING_DEFAULT); |
| 1164 } | 1162 } |
| OLD | NEW |