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/host_content_settings_map.h" | 5 #include "chrome/browser/host_content_settings_map.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 settings.settings[CONTENT_SETTINGS_TYPE_GEOLOCATION]); | 520 settings.settings[CONTENT_SETTINGS_TYPE_GEOLOCATION]); |
521 EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_COOKIES], | 521 EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_COOKIES], |
522 settings.settings[CONTENT_SETTINGS_TYPE_COOKIES]); | 522 settings.settings[CONTENT_SETTINGS_TYPE_COOKIES]); |
523 } | 523 } |
524 | 524 |
525 TEST_F(HostContentSettingsMapTest, OffTheRecord) { | 525 TEST_F(HostContentSettingsMapTest, OffTheRecord) { |
526 TestingProfile profile; | 526 TestingProfile profile; |
527 HostContentSettingsMap* host_content_settings_map = | 527 HostContentSettingsMap* host_content_settings_map = |
528 profile.GetHostContentSettingsMap(); | 528 profile.GetHostContentSettingsMap(); |
529 profile.set_off_the_record(true); | 529 profile.set_off_the_record(true); |
530 scoped_refptr<HostContentSettingsMap> otr_map = | 530 scoped_refptr<HostContentSettingsMap> otr_map( |
531 new HostContentSettingsMap(&profile); | 531 new HostContentSettingsMap(&profile)); |
532 profile.set_off_the_record(false); | 532 profile.set_off_the_record(false); |
533 | 533 |
534 GURL host("http://example.com/"); | 534 GURL host("http://example.com/"); |
535 HostContentSettingsMap::Pattern pattern("[*.]example.com"); | 535 HostContentSettingsMap::Pattern pattern("[*.]example.com"); |
536 | 536 |
537 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 537 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
538 host_content_settings_map->GetContentSetting( | 538 host_content_settings_map->GetContentSetting( |
539 host, CONTENT_SETTINGS_TYPE_IMAGES, "")); | 539 host, CONTENT_SETTINGS_TYPE_IMAGES, "")); |
540 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 540 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
541 otr_map->GetContentSetting( | 541 otr_map->GetContentSetting( |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 | 739 |
740 content_setting_prefs = | 740 content_setting_prefs = |
741 profile.GetPrefs()->GetDictionary(prefs::kContentSettingsPatterns); | 741 profile.GetPrefs()->GetDictionary(prefs::kContentSettingsPatterns); |
742 base::JSONWriter::Write(content_setting_prefs, false, &prefs_as_json); | 742 base::JSONWriter::Write(content_setting_prefs, false, &prefs_as_json); |
743 EXPECT_STREQ("{\"[*.]example.com\":{\"per_plugin\":{\"otherplugin\":2}}}", | 743 EXPECT_STREQ("{\"[*.]example.com\":{\"per_plugin\":{\"otherplugin\":2}}}", |
744 prefs_as_json.c_str()); | 744 prefs_as_json.c_str()); |
745 *CommandLine::ForCurrentProcess() = cl; | 745 *CommandLine::ForCurrentProcess() = cl; |
746 } | 746 } |
747 | 747 |
748 } // namespace | 748 } // namespace |
OLD | NEW |