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

Side by Side Diff: chrome/browser/ui/website_settings/website_settings_unittest.cc

Issue 1312453005: Removed Profile::GetHostContentSettingsMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed patch conflict Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/website_settings/website_settings.h" 5 #include "chrome/browser/ui/website_settings/website_settings.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
11 #include "chrome/browser/infobars/infobar_service.h" 12 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/ui/website_settings/website_settings_ui.h" 13 #include "chrome/browser/ui/website_settings/website_settings_ui.h"
13 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 14 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
14 #include "chrome/test/base/testing_profile.h" 15 #include "chrome/test/base/testing_profile.h"
15 #include "components/content_settings/core/browser/host_content_settings_map.h" 16 #include "components/content_settings/core/browser/host_content_settings_map.h"
16 #include "components/content_settings/core/common/content_settings.h" 17 #include "components/content_settings/core/common/content_settings.h"
17 #include "components/content_settings/core/common/content_settings_types.h" 18 #include "components/content_settings/core/common/content_settings_types.h"
18 #include "components/infobars/core/infobar.h" 19 #include "components/infobars/core/infobar.h"
19 #include "content/public/browser/cert_store.h" 20 #include "content/public/browser/cert_store.h"
20 #include "content/public/common/ssl_status.h" 21 #include "content/public/common/ssl_status.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 scoped_refptr<net::X509Certificate> cert_; 148 scoped_refptr<net::X509Certificate> cert_;
148 MockCertStore cert_store_; 149 MockCertStore cert_store_;
149 GURL url_; 150 GURL url_;
150 }; 151 };
151 152
152 } // namespace 153 } // namespace
153 154
154 TEST_F(WebsiteSettingsTest, OnPermissionsChanged) { 155 TEST_F(WebsiteSettingsTest, OnPermissionsChanged) {
155 // Setup site permissions. 156 // Setup site permissions.
156 HostContentSettingsMap* content_settings = 157 HostContentSettingsMap* content_settings =
157 profile()->GetHostContentSettingsMap(); 158 HostContentSettingsMapFactory::GetForProfile(profile());
158 ContentSetting setting = content_settings->GetContentSetting( 159 ContentSetting setting = content_settings->GetContentSetting(
159 url(), url(), CONTENT_SETTINGS_TYPE_POPUPS, std::string()); 160 url(), url(), CONTENT_SETTINGS_TYPE_POPUPS, std::string());
160 EXPECT_EQ(setting, CONTENT_SETTING_BLOCK); 161 EXPECT_EQ(setting, CONTENT_SETTING_BLOCK);
161 #if defined(ENABLE_PLUGINS) 162 #if defined(ENABLE_PLUGINS)
162 setting = content_settings->GetContentSetting( 163 setting = content_settings->GetContentSetting(
163 url(), url(), CONTENT_SETTINGS_TYPE_PLUGINS, std::string()); 164 url(), url(), CONTENT_SETTINGS_TYPE_PLUGINS, std::string());
164 EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); 165 EXPECT_EQ(setting, CONTENT_SETTING_ALLOW);
165 #endif 166 #endif
166 setting = content_settings->GetContentSetting( 167 setting = content_settings->GetContentSetting(
167 url(), url(), CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()); 168 url(), url(), CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string());
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string()); 217 url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string());
217 EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); 218 EXPECT_EQ(setting, CONTENT_SETTING_ALLOW);
218 setting = content_settings->GetContentSetting( 219 setting = content_settings->GetContentSetting(
219 url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string()); 220 url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string());
220 EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); 221 EXPECT_EQ(setting, CONTENT_SETTING_ALLOW);
221 } 222 }
222 223
223 TEST_F(WebsiteSettingsTest, OnPermissionsChanged_Fullscreen) { 224 TEST_F(WebsiteSettingsTest, OnPermissionsChanged_Fullscreen) {
224 // Setup site permissions. 225 // Setup site permissions.
225 HostContentSettingsMap* content_settings = 226 HostContentSettingsMap* content_settings =
226 profile()->GetHostContentSettingsMap(); 227 HostContentSettingsMapFactory::GetForProfile(profile());
227 ContentSetting setting = content_settings->GetContentSetting( 228 ContentSetting setting = content_settings->GetContentSetting(
228 url(), url(), CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string()); 229 url(), url(), CONTENT_SETTINGS_TYPE_FULLSCREEN, std::string());
229 EXPECT_EQ(setting, CONTENT_SETTING_ASK); 230 EXPECT_EQ(setting, CONTENT_SETTING_ASK);
230 231
231 EXPECT_CALL(*mock_ui(), SetIdentityInfo(_)); 232 EXPECT_CALL(*mock_ui(), SetIdentityInfo(_));
232 EXPECT_CALL(*mock_ui(), SetCookieInfo(_)); 233 EXPECT_CALL(*mock_ui(), SetCookieInfo(_));
233 EXPECT_CALL(*mock_ui(), SetSelectedTab( 234 EXPECT_CALL(*mock_ui(), SetSelectedTab(
234 WebsiteSettingsUI::TAB_ID_PERMISSIONS)); 235 WebsiteSettingsUI::TAB_ID_PERMISSIONS));
235 236
236 // SetPermissionInfo() is called once initially, and then again every time 237 // SetPermissionInfo() is called once initially, and then again every time
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 436
436 TEST_F(WebsiteSettingsTest, InternalPage) { 437 TEST_F(WebsiteSettingsTest, InternalPage) {
437 SetURL("chrome://bookmarks"); 438 SetURL("chrome://bookmarks");
438 SetDefaultUIExpectations(mock_ui()); 439 SetDefaultUIExpectations(mock_ui());
439 EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_INTERNAL_PAGE, 440 EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_INTERNAL_PAGE,
440 website_settings()->site_connection_status()); 441 website_settings()->site_connection_status());
441 EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE, 442 EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE,
442 website_settings()->site_identity_status()); 443 website_settings()->site_identity_status());
443 EXPECT_EQ(base::string16(), website_settings()->organization_name()); 444 EXPECT_EQ(base::string16(), website_settings()->organization_name());
444 } 445 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/website_settings/website_settings.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