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

Side by Side Diff: chrome/browser/cocoa/content_settings_dialog_controller_unittest.mm

Issue 2963006: Remove the cookie prompt from the settings UI and migrate prefs from ask to block. (Closed)
Patch Set: updates Created 10 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
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 #import "chrome/browser/cocoa/content_settings_dialog_controller.h" 5 #import "chrome/browser/cocoa/content_settings_dialog_controller.h"
6 6
7 #import "base/scoped_nsobject.h" 7 #import "base/scoped_nsobject.h"
8 #include "base/ref_counted.h" 8 #include "base/ref_counted.h"
9 #include "chrome/browser/cocoa/browser_test_helper.h" 9 #include "chrome/browser/cocoa/browser_test_helper.h"
10 #include "chrome/browser/cocoa/cocoa_test_helper.h" 10 #include "chrome/browser/cocoa/cocoa_test_helper.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 EXPECT_TRUE(controller_); 48 EXPECT_TRUE(controller_);
49 } 49 }
50 50
51 TEST_F(ContentSettingsDialogControllerTest, CookieSetting) { 51 TEST_F(ContentSettingsDialogControllerTest, CookieSetting) {
52 // Change setting, check dialog property. 52 // Change setting, check dialog property.
53 settingsMap_->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, 53 settingsMap_->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES,
54 CONTENT_SETTING_ALLOW); 54 CONTENT_SETTING_ALLOW);
55 EXPECT_EQ([controller_ cookieSettingIndex], kCookieEnabledIndex); 55 EXPECT_EQ([controller_ cookieSettingIndex], kCookieEnabledIndex);
56 56
57 settingsMap_->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, 57 settingsMap_->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES,
58 CONTENT_SETTING_ASK);
59 EXPECT_EQ([controller_ cookieSettingIndex], kCookieAskIndex);
60
61 settingsMap_->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES,
62 CONTENT_SETTING_BLOCK); 58 CONTENT_SETTING_BLOCK);
63 EXPECT_EQ([controller_ cookieSettingIndex], kCookieDisabledIndex); 59 EXPECT_EQ([controller_ cookieSettingIndex], kCookieDisabledIndex);
64 60
65 // Change dialog property, check setting. 61 // Change dialog property, check setting.
66 NSInteger setting; 62 NSInteger setting;
67 [controller_ setCookieSettingIndex:kCookieEnabledIndex]; 63 [controller_ setCookieSettingIndex:kCookieEnabledIndex];
68 setting = 64 setting =
69 settingsMap_->GetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES); 65 settingsMap_->GetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES);
70 EXPECT_EQ(setting, CONTENT_SETTING_ALLOW); 66 EXPECT_EQ(setting, CONTENT_SETTING_ALLOW);
71 67
72 [controller_ setCookieSettingIndex:kCookieAskIndex];
73 setting =
74 settingsMap_->GetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES);
75 EXPECT_EQ(setting, CONTENT_SETTING_ASK);
76
77 [controller_ setCookieSettingIndex:kCookieDisabledIndex]; 68 [controller_ setCookieSettingIndex:kCookieDisabledIndex];
78 setting = 69 setting =
79 settingsMap_->GetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES); 70 settingsMap_->GetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES);
80 EXPECT_EQ(setting, CONTENT_SETTING_BLOCK); 71 EXPECT_EQ(setting, CONTENT_SETTING_BLOCK);
81 } 72 }
82 73
83 TEST_F(ContentSettingsDialogControllerTest, BlockThirdPartyCookiesSetting) { 74 TEST_F(ContentSettingsDialogControllerTest, BlockThirdPartyCookiesSetting) {
84 // Change setting, check dialog property. 75 // Change setting, check dialog property.
85 settingsMap_->SetBlockThirdPartyCookies(YES); 76 settingsMap_->SetBlockThirdPartyCookies(YES);
86 EXPECT_TRUE([controller_ blockThirdPartyCookies]); 77 EXPECT_TRUE([controller_ blockThirdPartyCookies]);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 EXPECT_EQ(setting, CONTENT_SETTING_ASK); 253 EXPECT_EQ(setting, CONTENT_SETTING_ASK);
263 254
264 [controller_ setNotificationsSettingIndex:kNotificationsDisabledIndex]; 255 [controller_ setNotificationsSettingIndex:kNotificationsDisabledIndex];
265 setting = 256 setting =
266 notificationsService_->GetDefaultContentSetting(); 257 notificationsService_->GetDefaultContentSetting();
267 EXPECT_EQ(setting, CONTENT_SETTING_BLOCK); 258 EXPECT_EQ(setting, CONTENT_SETTING_BLOCK);
268 } 259 }
269 260
270 } // namespace 261 } // namespace
271 262
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/content_settings_dialog_controller.mm ('k') | chrome/browser/content_exceptions_table_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698