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

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

Issue 7218073: Explicitly ShutdownOnUIThread the HostContentSettingsMap when destroying the Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/content_settings/content_settings_details.h" 9 #include "chrome/browser/content_settings/content_settings_details.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h" 10 #include "chrome/browser/content_settings/host_content_settings_map.h"
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_GEOLOCATION], 610 EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_GEOLOCATION],
611 settings.settings[CONTENT_SETTINGS_TYPE_GEOLOCATION]); 611 settings.settings[CONTENT_SETTINGS_TYPE_GEOLOCATION]);
612 EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_COOKIES], 612 EXPECT_EQ(desired_settings.settings[CONTENT_SETTINGS_TYPE_COOKIES],
613 settings.settings[CONTENT_SETTINGS_TYPE_COOKIES]); 613 settings.settings[CONTENT_SETTINGS_TYPE_COOKIES]);
614 } 614 }
615 615
616 TEST_F(HostContentSettingsMapTest, OffTheRecord) { 616 TEST_F(HostContentSettingsMapTest, OffTheRecord) {
617 TestingProfile profile; 617 TestingProfile profile;
618 HostContentSettingsMap* host_content_settings_map = 618 HostContentSettingsMap* host_content_settings_map =
619 profile.GetHostContentSettingsMap(); 619 profile.GetHostContentSettingsMap();
620 profile.set_incognito(true);
621 scoped_refptr<HostContentSettingsMap> otr_map( 620 scoped_refptr<HostContentSettingsMap> otr_map(
622 new HostContentSettingsMap(&profile)); 621 new HostContentSettingsMap(profile.GetPrefs(),
623 profile.set_incognito(false); 622 profile.GetExtensionService(),
623 true));
624 624
625 GURL host("http://example.com/"); 625 GURL host("http://example.com/");
626 ContentSettingsPattern pattern = 626 ContentSettingsPattern pattern =
627 ContentSettingsPattern::FromString("[*.]example.com"); 627 ContentSettingsPattern::FromString("[*.]example.com");
628 628
629 EXPECT_EQ(CONTENT_SETTING_ALLOW, 629 EXPECT_EQ(CONTENT_SETTING_ALLOW,
630 host_content_settings_map->GetContentSetting( 630 host_content_settings_map->GetContentSetting(
631 host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); 631 host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
632 EXPECT_EQ(CONTENT_SETTING_ALLOW, 632 EXPECT_EQ(CONTENT_SETTING_ALLOW,
633 otr_map->GetContentSetting( 633 otr_map->GetContentSetting(
(...skipping 19 matching lines...) Expand all
653 otr_map->SetContentSetting( 653 otr_map->SetContentSetting(
654 pattern, 654 pattern,
655 ContentSettingsPattern::Wildcard(), 655 ContentSettingsPattern::Wildcard(),
656 CONTENT_SETTINGS_TYPE_IMAGES, "", CONTENT_SETTING_ALLOW); 656 CONTENT_SETTINGS_TYPE_IMAGES, "", CONTENT_SETTING_ALLOW);
657 EXPECT_EQ(CONTENT_SETTING_BLOCK, 657 EXPECT_EQ(CONTENT_SETTING_BLOCK,
658 host_content_settings_map->GetContentSetting( 658 host_content_settings_map->GetContentSetting(
659 host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); 659 host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
660 EXPECT_EQ(CONTENT_SETTING_ALLOW, 660 EXPECT_EQ(CONTENT_SETTING_ALLOW,
661 otr_map->GetContentSetting( 661 otr_map->GetContentSetting(
662 host, host, CONTENT_SETTINGS_TYPE_IMAGES, "")); 662 host, host, CONTENT_SETTINGS_TYPE_IMAGES, ""));
663
664 otr_map->ShutdownOnUIThread();
663 } 665 }
664 666
665 TEST_F(HostContentSettingsMapTest, MigrateObsoletePrefs) { 667 TEST_F(HostContentSettingsMapTest, MigrateObsoletePrefs) {
666 // This feature is currently behind a flag. 668 // This feature is currently behind a flag.
667 CommandLine* cmd = CommandLine::ForCurrentProcess(); 669 CommandLine* cmd = CommandLine::ForCurrentProcess();
668 AutoReset<CommandLine> auto_reset(cmd, *cmd); 670 AutoReset<CommandLine> auto_reset(cmd, *cmd);
669 cmd->AppendSwitch(switches::kEnableResourceContentSettings); 671 cmd->AppendSwitch(switches::kEnableResourceContentSettings);
670 672
671 TestingProfile profile; 673 TestingProfile profile;
672 PrefService* prefs = profile.GetPrefs(); 674 PrefService* prefs = profile.GetPrefs();
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 kAllowedSite, kFirstPartySite, true)); 1252 kAllowedSite, kFirstPartySite, true));
1251 EXPECT_EQ(CONTENT_SETTING_ALLOW, 1253 EXPECT_EQ(CONTENT_SETTING_ALLOW,
1252 host_content_settings_map->GetCookieContentSetting( 1254 host_content_settings_map->GetCookieContentSetting(
1253 kAllowedSite, kAllowedSite, false)); 1255 kAllowedSite, kAllowedSite, false));
1254 EXPECT_EQ(CONTENT_SETTING_ALLOW, 1256 EXPECT_EQ(CONTENT_SETTING_ALLOW,
1255 host_content_settings_map->GetCookieContentSetting( 1257 host_content_settings_map->GetCookieContentSetting(
1256 kAllowedSite, kAllowedSite, true)); 1258 kAllowedSite, kAllowedSite, true));
1257 } 1259 }
1258 1260
1259 } // namespace 1261 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/content_settings/host_content_settings_map.cc ('k') | chrome/browser/profiles/profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698