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

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

Issue 6410022: Add content_settings::PrefProvider to HostContentSettingsMap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Worked on comments Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
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
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 enable GetContentSettings should return
Bernhard Bauer 2011/02/07 09:46:46 Nit: "enabled"
markusheintz_ 2011/02/07 15:57:10 Done.
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698