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

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

Issue 3163027: A quick fix for Bug 52808.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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/pref_service.h" 10 #include "chrome/browser/pref_service.h"
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 *CommandLine::ForCurrentProcess() = cl; 579 *CommandLine::ForCurrentProcess() = cl;
580 } 580 }
581 581
582 TEST_F(HostContentSettingsMapTest, ResourceIdentifierPrefs) { 582 TEST_F(HostContentSettingsMapTest, ResourceIdentifierPrefs) {
583 // This feature is currently behind a flag. 583 // This feature is currently behind a flag.
584 CommandLine cl(*CommandLine::ForCurrentProcess()); 584 CommandLine cl(*CommandLine::ForCurrentProcess());
585 CommandLine::ForCurrentProcess()->AppendSwitch( 585 CommandLine::ForCurrentProcess()->AppendSwitch(
586 switches::kEnableResourceContentSettings); 586 switches::kEnableResourceContentSettings);
587 587
588 TestingProfile profile; 588 TestingProfile profile;
589 profile.GetPrefs()->Set(prefs::kContentSettingsPatterns, 589 scoped_ptr<Value> value(base::JSONReader::Read(
590 *base::JSONReader::Read(
591 "{\"[*.]example.com\":{\"per_plugin\":{\"someplugin\":2}}}", false)); 590 "{\"[*.]example.com\":{\"per_plugin\":{\"someplugin\":2}}}", false));
591 profile.GetPrefs()->Set(prefs::kContentSettingsPatterns, *value);
592 HostContentSettingsMap* host_content_settings_map = 592 HostContentSettingsMap* host_content_settings_map =
593 profile.GetHostContentSettingsMap(); 593 profile.GetHostContentSettingsMap();
594 594
595 GURL host("http://example.com/"); 595 GURL host("http://example.com/");
596 HostContentSettingsMap::Pattern pattern("[*.]example.com"); 596 HostContentSettingsMap::Pattern pattern("[*.]example.com");
597 std::string resource1("someplugin"); 597 std::string resource1("someplugin");
598 std::string resource2("otherplugin"); 598 std::string resource2("otherplugin");
599 599
600 EXPECT_EQ(CONTENT_SETTING_BLOCK, 600 EXPECT_EQ(CONTENT_SETTING_BLOCK,
601 host_content_settings_map->GetContentSetting( 601 host_content_settings_map->GetContentSetting(
(...skipping 13 matching lines...) Expand all
615 615
616 content_setting_prefs = 616 content_setting_prefs =
617 profile.GetPrefs()->GetDictionary(prefs::kContentSettingsPatterns); 617 profile.GetPrefs()->GetDictionary(prefs::kContentSettingsPatterns);
618 base::JSONWriter::Write(content_setting_prefs, false, &prefs_as_json); 618 base::JSONWriter::Write(content_setting_prefs, false, &prefs_as_json);
619 EXPECT_STREQ("{\"[*.]example.com\":{\"per_plugin\":{\"otherplugin\":2}}}", 619 EXPECT_STREQ("{\"[*.]example.com\":{\"per_plugin\":{\"otherplugin\":2}}}",
620 prefs_as_json.c_str()); 620 prefs_as_json.c_str());
621 *CommandLine::ForCurrentProcess() = cl; 621 *CommandLine::ForCurrentProcess() = cl;
622 } 622 }
623 623
624 } // namespace 624 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698