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

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

Issue 2039803002: Unregister Images, Plugins and Mouselock content settings on android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@only_register_platform_used_contentsettingtypes
Patch Set: address review comments, minor change Created 4 years, 6 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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 EXPECT_EQ(setting, CONTENT_SETTING_ASK); 223 EXPECT_EQ(setting, CONTENT_SETTING_ASK);
224 setting = content_settings->GetContentSetting( 224 setting = content_settings->GetContentSetting(
225 url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string()); 225 url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string());
226 EXPECT_EQ(setting, CONTENT_SETTING_ASK); 226 EXPECT_EQ(setting, CONTENT_SETTING_ASK);
227 227
228 EXPECT_CALL(*mock_ui(), SetIdentityInfo(_)); 228 EXPECT_CALL(*mock_ui(), SetIdentityInfo(_));
229 EXPECT_CALL(*mock_ui(), SetCookieInfo(_)); 229 EXPECT_CALL(*mock_ui(), SetCookieInfo(_));
230 230
231 // SetPermissionInfo() is called once initially, and then again every time 231 // SetPermissionInfo() is called once initially, and then again every time
232 // OnSitePermissionChanged() is called. 232 // OnSitePermissionChanged() is called.
233 #if !defined(ENABLE_PLUGINS)
234 // SetPermissionInfo for plugins didn't get called.
235 EXPECT_CALL(*mock_ui(), SetPermissionInfo(_, _)).Times(6);
236 #else
233 EXPECT_CALL(*mock_ui(), SetPermissionInfo(_, _)).Times(7); 237 EXPECT_CALL(*mock_ui(), SetPermissionInfo(_, _)).Times(7);
238 #endif
234 EXPECT_CALL(*mock_ui(), SetSelectedTab( 239 EXPECT_CALL(*mock_ui(), SetSelectedTab(
235 WebsiteSettingsUI::TAB_ID_PERMISSIONS)); 240 WebsiteSettingsUI::TAB_ID_PERMISSIONS));
236 241
237 // Execute code under tests. 242 // Execute code under tests.
238 website_settings()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_POPUPS, 243 website_settings()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_POPUPS,
239 CONTENT_SETTING_ALLOW); 244 CONTENT_SETTING_ALLOW);
245 #if defined(ENABLE_PLUGINS)
240 website_settings()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_PLUGINS, 246 website_settings()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_PLUGINS,
241 CONTENT_SETTING_BLOCK); 247 CONTENT_SETTING_BLOCK);
248 #endif
242 website_settings()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_GEOLOCATION, 249 website_settings()->OnSitePermissionChanged(CONTENT_SETTINGS_TYPE_GEOLOCATION,
243 CONTENT_SETTING_ALLOW); 250 CONTENT_SETTING_ALLOW);
244 website_settings()->OnSitePermissionChanged( 251 website_settings()->OnSitePermissionChanged(
245 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, CONTENT_SETTING_ALLOW); 252 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, CONTENT_SETTING_ALLOW);
246 website_settings()->OnSitePermissionChanged( 253 website_settings()->OnSitePermissionChanged(
247 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, CONTENT_SETTING_ALLOW); 254 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, CONTENT_SETTING_ALLOW);
248 website_settings()->OnSitePermissionChanged( 255 website_settings()->OnSitePermissionChanged(
249 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, CONTENT_SETTING_ALLOW); 256 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, CONTENT_SETTING_ALLOW);
250 257
251 // Verify that the site permissions were changed correctly. 258 // Verify that the site permissions were changed correctly.
252 setting = content_settings->GetContentSetting( 259 setting = content_settings->GetContentSetting(
253 url(), url(), CONTENT_SETTINGS_TYPE_POPUPS, std::string()); 260 url(), url(), CONTENT_SETTINGS_TYPE_POPUPS, std::string());
254 EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); 261 EXPECT_EQ(setting, CONTENT_SETTING_ALLOW);
262 #if defined(ENABLE_PLUGINS)
255 setting = content_settings->GetContentSetting( 263 setting = content_settings->GetContentSetting(
256 url(), url(), CONTENT_SETTINGS_TYPE_PLUGINS, std::string()); 264 url(), url(), CONTENT_SETTINGS_TYPE_PLUGINS, std::string());
257 EXPECT_EQ(setting, CONTENT_SETTING_BLOCK); 265 EXPECT_EQ(setting, CONTENT_SETTING_BLOCK);
266 #endif
258 setting = content_settings->GetContentSetting( 267 setting = content_settings->GetContentSetting(
259 url(), url(), CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()); 268 url(), url(), CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string());
260 EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); 269 EXPECT_EQ(setting, CONTENT_SETTING_ALLOW);
261 setting = content_settings->GetContentSetting( 270 setting = content_settings->GetContentSetting(
262 url(), url(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string()); 271 url(), url(), CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string());
263 EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); 272 EXPECT_EQ(setting, CONTENT_SETTING_ALLOW);
264 setting = content_settings->GetContentSetting( 273 setting = content_settings->GetContentSetting(
265 url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string()); 274 url(), url(), CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string());
266 EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); 275 EXPECT_EQ(setting, CONTENT_SETTING_ALLOW);
267 setting = content_settings->GetContentSetting( 276 setting = content_settings->GetContentSetting(
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 797
789 TEST_F(WebsiteSettingsTest, InternalPage) { 798 TEST_F(WebsiteSettingsTest, InternalPage) {
790 SetURL("chrome://bookmarks"); 799 SetURL("chrome://bookmarks");
791 SetDefaultUIExpectations(mock_ui()); 800 SetDefaultUIExpectations(mock_ui());
792 EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_INTERNAL_PAGE, 801 EXPECT_EQ(WebsiteSettings::SITE_CONNECTION_STATUS_INTERNAL_PAGE,
793 website_settings()->site_connection_status()); 802 website_settings()->site_connection_status());
794 EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE, 803 EXPECT_EQ(WebsiteSettings::SITE_IDENTITY_STATUS_INTERNAL_PAGE,
795 website_settings()->site_identity_status()); 804 website_settings()->site_identity_status());
796 EXPECT_EQ(base::string16(), website_settings()->organization_name()); 805 EXPECT_EQ(base::string16(), website_settings()->organization_name());
797 } 806 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698