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

Side by Side Diff: chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller_unittest.mm

Issue 2408613002: Replace kPreferHtmlOverPlugins feature checks with PluginUtils::ShouldPreferHtmlOverPlugi… (Closed)
Patch Set: Replace remaining kPreferHtmlOverPlugins feature checks with PluginUtils::ShouldPreferHtmlOverPlugi… Created 4 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ui/cocoa/website_settings/website_settings_bubble_contro ller.h" 5 #import "chrome/browser/ui/cocoa/website_settings/website_settings_bubble_contro ller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" 12 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
13 #include "chrome/test/base/testing_profile.h"
14 #include "content/public/test/test_browser_thread_bundle.h"
15 #include "content/public/test/test_web_contents_factory.h"
13 #include "net/test/test_certificate_data.h" 16 #include "net/test/test_certificate_data.h"
14 #include "testing/gtest_mac.h" 17 #include "testing/gtest_mac.h"
15 18
16 @interface WebsiteSettingsBubbleController (ExposedForTesting) 19 @interface WebsiteSettingsBubbleController (ExposedForTesting)
17 - (NSView*)permissionsView; 20 - (NSView*)permissionsView;
18 - (NSButton*)resetDecisionsButton; 21 - (NSButton*)resetDecisionsButton;
19 - (NSButton*)securityDetailsButton; 22 - (NSButton*)securityDetailsButton;
20 @end 23 @end
21 24
22 @implementation WebsiteSettingsBubbleController (ExposedForTesting) 25 @implementation WebsiteSettingsBubbleController (ExposedForTesting)
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // Creates a new website settings bubble, with the given default width. 127 // Creates a new website settings bubble, with the given default width.
125 // If |default_width| is 0, the *default* default width will be used. 128 // If |default_width| is 0, the *default* default width will be used.
126 void CreateBubbleWithWidth(CGFloat default_width) { 129 void CreateBubbleWithWidth(CGFloat default_width) {
127 bridge_ = new WebsiteSettingsUIBridge(nullptr); 130 bridge_ = new WebsiteSettingsUIBridge(nullptr);
128 131
129 // The controller cleans up after itself when the window closes. 132 // The controller cleans up after itself when the window closes.
130 controller_ = [WebsiteSettingsBubbleControllerForTesting alloc]; 133 controller_ = [WebsiteSettingsBubbleControllerForTesting alloc];
131 [controller_ setDefaultWindowWidth:default_width]; 134 [controller_ setDefaultWindowWidth:default_width];
132 [controller_ initWithParentWindow:test_window() 135 [controller_ initWithParentWindow:test_window()
133 websiteSettingsUIBridge:bridge_ 136 websiteSettingsUIBridge:bridge_
134 webContents:nil 137 webContents:web_contents_factory_.CreateWebContents(
138 &profile_)
135 url:GURL("https://www.google.com") 139 url:GURL("https://www.google.com")
136 isDevToolsDisabled:NO]; 140 isDevToolsDisabled:NO];
137 window_ = [controller_ window]; 141 window_ = [controller_ window];
138 [controller_ showWindow:nil]; 142 [controller_ showWindow:nil];
139 } 143 }
140 144
141 void CreateBubble() { 145 void CreateBubble() {
142 CreateBubbleWithWidth(0.0); 146 CreateBubbleWithWidth(0.0);
143 } 147 }
144 148
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 if (info.setting == CONTENT_SETTING_DEFAULT) 199 if (info.setting == CONTENT_SETTING_DEFAULT)
196 info.default_setting = kTestDefaultSettings[i]; 200 info.default_setting = kTestDefaultSettings[i];
197 info.source = kTestSettingSources[i]; 201 info.source = kTestSettingSources[i];
198 info.is_incognito = false; 202 info.is_incognito = false;
199 permission_info_list.push_back(info); 203 permission_info_list.push_back(info);
200 } 204 }
201 ChosenObjectInfoList chosen_object_info_list; 205 ChosenObjectInfoList chosen_object_info_list;
202 bridge_->SetPermissionInfo(permission_info_list, chosen_object_info_list); 206 bridge_->SetPermissionInfo(permission_info_list, chosen_object_info_list);
203 } 207 }
204 208
209 content::TestBrowserThreadBundle thread_bundle_;
210 TestingProfile profile_;
211 content::TestWebContentsFactory web_contents_factory_;
212
205 WebsiteSettingsBubbleControllerForTesting* controller_; // Weak, owns self. 213 WebsiteSettingsBubbleControllerForTesting* controller_; // Weak, owns self.
206 NSWindow* window_; // Weak, owned by controller. 214 NSWindow* window_; // Weak, owned by controller.
207 }; 215 };
208 216
209 TEST_F(WebsiteSettingsBubbleControllerTest, SecurityDetailsButton) { 217 TEST_F(WebsiteSettingsBubbleControllerTest, SecurityDetailsButton) {
210 WebsiteSettingsUI::IdentityInfo info; 218 WebsiteSettingsUI::IdentityInfo info;
211 info.site_identity = std::string("example.com"); 219 info.site_identity = std::string("example.com");
212 info.identity_status = WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN; 220 info.identity_status = WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN;
213 221
214 CreateBubble(); 222 CreateBubble();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 323 }
316 if ([view isKindOfClass:[NSPopUpButton class]]) { 324 if ([view isKindOfClass:[NSPopUpButton class]]) {
317 NSPopUpButton* button = static_cast<NSPopUpButton*>(view); 325 NSPopUpButton* button = static_cast<NSPopUpButton*>(view);
318 EXPECT_LT(NSMaxX([button frame]), window_width); 326 EXPECT_LT(NSMaxX([button frame]), window_width);
319 } 327 }
320 } 328 }
321 } 329 }
322 } 330 }
323 331
324 } // namespace 332 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698