OLD | NEW |
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 "chrome/browser/content_settings/host_content_settings_map.h" | 7 #include "chrome/browser/content_settings/host_content_settings_map.h" |
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" | 10 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 TEST_F(ContentSettingBubbleModelTest, MultiplePlugins) { | 105 TEST_F(ContentSettingBubbleModelTest, MultiplePlugins) { |
106 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 106 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
107 AutoReset<CommandLine> auto_reset(cmd, *cmd); | 107 AutoReset<CommandLine> auto_reset(cmd, *cmd); |
108 cmd->AppendSwitch(switches::kEnableResourceContentSettings); | 108 cmd->AppendSwitch(switches::kEnableResourceContentSettings); |
109 cmd->AppendSwitch(switches::kEnableClickToPlay); | 109 cmd->AppendSwitch(switches::kEnableClickToPlay); |
110 | 110 |
111 HostContentSettingsMap* map = profile_->GetHostContentSettingsMap(); | 111 HostContentSettingsMap* map = profile_->GetHostContentSettingsMap(); |
112 std::string fooPlugin = "foo"; | 112 std::string fooPlugin = "foo"; |
113 std::string barPlugin = "bar"; | 113 std::string barPlugin = "bar"; |
| 114 |
| 115 // Navigating to some sample url prevents the GetURL method from returning an |
| 116 // invalid empty URL. |
| 117 contents()->NavigateAndCommit(GURL("http://www.example.com")); |
114 GURL url = contents()->GetURL(); | 118 GURL url = contents()->GetURL(); |
115 map->AddExceptionForURL(url, | 119 map->AddExceptionForURL(url, |
116 CONTENT_SETTINGS_TYPE_PLUGINS, | 120 CONTENT_SETTINGS_TYPE_PLUGINS, |
117 fooPlugin, | 121 fooPlugin, |
118 CONTENT_SETTING_ALLOW); | 122 CONTENT_SETTING_ALLOW); |
119 map->AddExceptionForURL(url, | 123 map->AddExceptionForURL(url, |
120 CONTENT_SETTINGS_TYPE_PLUGINS, | 124 CONTENT_SETTINGS_TYPE_PLUGINS, |
121 barPlugin, | 125 barPlugin, |
122 CONTENT_SETTING_ASK); | 126 CONTENT_SETTING_ASK); |
123 | 127 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 std::string file_url("file:///tmp/test.html"); | 200 std::string file_url("file:///tmp/test.html"); |
197 NavigateAndCommit(GURL(file_url)); | 201 NavigateAndCommit(GURL(file_url)); |
198 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 202 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
199 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 203 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
200 NULL, contents_wrapper(), profile_.get(), | 204 NULL, contents_wrapper(), profile_.get(), |
201 CONTENT_SETTINGS_TYPE_IMAGES)); | 205 CONTENT_SETTINGS_TYPE_IMAGES)); |
202 std::string title = | 206 std::string title = |
203 content_setting_bubble_model->bubble_content().radio_group.radio_items[0]; | 207 content_setting_bubble_model->bubble_content().radio_group.radio_items[0]; |
204 ASSERT_NE(std::string::npos, title.find(file_url)); | 208 ASSERT_NE(std::string::npos, title.find(file_url)); |
205 } | 209 } |
OLD | NEW |