| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/content_settings/host_content_settings_map_unittest.h" | 5 #include "chrome/browser/content_settings/host_content_settings_map_unittest.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 host_content_settings_map->GetContentSetting( | 608 host_content_settings_map->GetContentSetting( |
| 609 host, CONTENT_SETTINGS_TYPE_PLUGINS, resource1)); | 609 host, CONTENT_SETTINGS_TYPE_PLUGINS, resource1)); |
| 610 host_content_settings_map->SetContentSetting(pattern, | 610 host_content_settings_map->SetContentSetting(pattern, |
| 611 CONTENT_SETTINGS_TYPE_PLUGINS, resource1, CONTENT_SETTING_BLOCK); | 611 CONTENT_SETTINGS_TYPE_PLUGINS, resource1, CONTENT_SETTING_BLOCK); |
| 612 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 612 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 613 host_content_settings_map->GetContentSetting( | 613 host_content_settings_map->GetContentSetting( |
| 614 host, CONTENT_SETTINGS_TYPE_PLUGINS, resource1)); | 614 host, CONTENT_SETTINGS_TYPE_PLUGINS, resource1)); |
| 615 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 615 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 616 host_content_settings_map->GetContentSetting( | 616 host_content_settings_map->GetContentSetting( |
| 617 host, CONTENT_SETTINGS_TYPE_PLUGINS, resource2)); | 617 host, CONTENT_SETTINGS_TYPE_PLUGINS, resource2)); |
| 618 |
| 619 // If resource content settings are enabled GetContentSettings should return |
| 620 // CONTENT_SETTING_DEFAULT for content types that require resource |
| 621 // identifiers. |
| 622 ContentSettings settings = |
| 623 host_content_settings_map->GetContentSettings(host); |
| 624 EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
| 625 settings.settings[CONTENT_SETTINGS_TYPE_PLUGINS]); |
| 618 } | 626 } |
| 619 | 627 |
| 620 TEST_F(HostContentSettingsMapTest, ResourceIdentifierPrefs) { | 628 TEST_F(HostContentSettingsMapTest, ResourceIdentifierPrefs) { |
| 621 // This feature is currently behind a flag. | 629 // This feature is currently behind a flag. |
| 622 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 630 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 623 AutoReset<CommandLine> auto_reset(cmd, *cmd); | 631 AutoReset<CommandLine> auto_reset(cmd, *cmd); |
| 624 cmd->AppendSwitch(switches::kEnableResourceContentSettings); | 632 cmd->AppendSwitch(switches::kEnableResourceContentSettings); |
| 625 | 633 |
| 626 TestingProfile profile; | 634 TestingProfile profile; |
| 627 scoped_ptr<Value> value(base::JSONReader::Read( | 635 scoped_ptr<Value> value(base::JSONReader::Read( |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 EXPECT_TRUE(host_content_settings_map->BlockThirdPartyCookies()); | 852 EXPECT_TRUE(host_content_settings_map->BlockThirdPartyCookies()); |
| 845 | 853 |
| 846 // After unsetting the managed value for the preference BlockThirdPartyCookies | 854 // After unsetting the managed value for the preference BlockThirdPartyCookies |
| 847 // the default value should be returned now. | 855 // the default value should be returned now. |
| 848 prefs->RemoveManagedPref(prefs::kBlockThirdPartyCookies); | 856 prefs->RemoveManagedPref(prefs::kBlockThirdPartyCookies); |
| 849 EXPECT_FALSE(host_content_settings_map->IsBlockThirdPartyCookiesManaged()); | 857 EXPECT_FALSE(host_content_settings_map->IsBlockThirdPartyCookiesManaged()); |
| 850 EXPECT_FALSE(host_content_settings_map->BlockThirdPartyCookies()); | 858 EXPECT_FALSE(host_content_settings_map->BlockThirdPartyCookies()); |
| 851 } | 859 } |
| 852 | 860 |
| 853 } // namespace | 861 } // namespace |
| OLD | NEW |