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

Side by Side Diff: chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc

Issue 7328018: Migrate default geolocation content setting to host content settings map. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nits 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 "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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 content_settings->OnGeolocationPermissionSet(frame1_url, true); 183 content_settings->OnGeolocationPermissionSet(frame1_url, true);
184 CheckGeolocationBubble(1, false, true); 184 CheckGeolocationBubble(1, false, true);
185 185
186 // Add it to the content map, should now have a clear link. 186 // Add it to the content map, should now have a clear link.
187 GeolocationContentSettingsMap* setting_map = 187 GeolocationContentSettingsMap* setting_map =
188 profile_->GetGeolocationContentSettingsMap(); 188 profile_->GetGeolocationContentSettingsMap();
189 setting_map->SetContentSetting(frame1_url, page_url, CONTENT_SETTING_ALLOW); 189 setting_map->SetContentSetting(frame1_url, page_url, CONTENT_SETTING_ALLOW);
190 CheckGeolocationBubble(1, true, false); 190 CheckGeolocationBubble(1, true, false);
191 191
192 // Change the default to allow: no message needed. 192 // Change the default to allow: no message needed.
193 setting_map->SetDefaultContentSetting(CONTENT_SETTING_ALLOW); 193 profile_->GetHostContentSettingsMap()->SetDefaultContentSetting(
194 CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTING_ALLOW);
194 CheckGeolocationBubble(1, false, false); 195 CheckGeolocationBubble(1, false, false);
195 196
196 // Second frame denied, but not stored in the content map: requires reload. 197 // Second frame denied, but not stored in the content map: requires reload.
197 content_settings->OnGeolocationPermissionSet(frame2_url, false); 198 content_settings->OnGeolocationPermissionSet(frame2_url, false);
198 CheckGeolocationBubble(2, false, true); 199 CheckGeolocationBubble(2, false, true);
199 200
200 // Change the default to block: offer a clear link for the persisted frame 1. 201 // Change the default to block: offer a clear link for the persisted frame 1.
201 setting_map->SetDefaultContentSetting(CONTENT_SETTING_BLOCK); 202 profile_->GetHostContentSettingsMap()->SetDefaultContentSetting(
203 CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTING_BLOCK);
202 CheckGeolocationBubble(2, true, false); 204 CheckGeolocationBubble(2, true, false);
203 } 205 }
204 206
205 TEST_F(ContentSettingBubbleModelTest, FileURL) { 207 TEST_F(ContentSettingBubbleModelTest, FileURL) {
206 std::string file_url("file:///tmp/test.html"); 208 std::string file_url("file:///tmp/test.html");
207 NavigateAndCommit(GURL(file_url)); 209 NavigateAndCommit(GURL(file_url));
208 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( 210 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
209 ContentSettingBubbleModel::CreateContentSettingBubbleModel( 211 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
210 NULL, contents_wrapper(), profile_.get(), 212 NULL, contents_wrapper(), profile_.get(),
211 CONTENT_SETTINGS_TYPE_IMAGES)); 213 CONTENT_SETTINGS_TYPE_IMAGES));
212 std::string title = 214 std::string title =
213 content_setting_bubble_model->bubble_content().radio_group.radio_items[0]; 215 content_setting_bubble_model->bubble_content().radio_group.radio_items[0];
214 ASSERT_NE(std::string::npos, title.find(file_url)); 216 ASSERT_NE(std::string::npos, title.find(file_url));
215 } 217 }
OLDNEW
« no previous file with comments | « chrome/browser/policy/configuration_policy_pref_store.cc ('k') | chrome/browser/ui/webui/options/content_settings_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698