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

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

Issue 2504453003: Page Info (native Mac): Change "Details" link (sec. panel) to "Learn more" (help center). (Closed)
Patch Set: Page Info (native Mac): Change "Details" link (sec. panel) to "Learn more" (help center). Created 4 years 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
« no previous file with comments | « chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" 13 #include "chrome/test/base/testing_profile.h"
14 #include "content/public/test/test_browser_thread_bundle.h" 14 #include "content/public/test/test_browser_thread_bundle.h"
15 #include "content/public/test/test_web_contents_factory.h" 15 #include "content/public/test/test_web_contents_factory.h"
16 #include "net/test/test_certificate_data.h" 16 #include "net/test/test_certificate_data.h"
17 #include "testing/gtest_mac.h" 17 #include "testing/gtest_mac.h"
18 18
19 @interface WebsiteSettingsBubbleController (ExposedForTesting) 19 @interface WebsiteSettingsBubbleController (ExposedForTesting)
20 - (NSView*)permissionsView; 20 - (NSView*)permissionsView;
21 - (NSButton*)resetDecisionsButton; 21 - (NSButton*)resetDecisionsButton;
22 - (NSButton*)securityDetailsButton; 22 - (NSButton*)connectionHelpButton;
23 @end 23 @end
24 24
25 @implementation WebsiteSettingsBubbleController (ExposedForTesting) 25 @implementation WebsiteSettingsBubbleController (ExposedForTesting)
26 - (NSView*)permissionsView { 26 - (NSView*)permissionsView {
27 return permissionsView_; 27 return permissionsView_;
28 } 28 }
29 - (NSButton*)resetDecisionsButton { 29 - (NSButton*)resetDecisionsButton {
30 return resetDecisionsButton_; 30 return resetDecisionsButton_;
31 } 31 }
32 - (NSButton*)securityDetailsButton { 32 - (NSButton*)connectionHelpButton {
33 return securityDetailsButton_; 33
34 return connectionHelpButton_;
34 } 35 }
35 @end 36 @end
36 37
37 @interface WebsiteSettingsBubbleControllerForTesting 38 @interface WebsiteSettingsBubbleControllerForTesting
38 : WebsiteSettingsBubbleController { 39 : WebsiteSettingsBubbleController {
39 @private 40 @private
40 CGFloat defaultWindowWidth_; 41 CGFloat defaultWindowWidth_;
41 } 42 }
42 @end 43 @end
43 44
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 void CreateBubbleWithWidth(CGFloat default_width) { 121 void CreateBubbleWithWidth(CGFloat default_width) {
121 bridge_ = new WebsiteSettingsUIBridge(nullptr); 122 bridge_ = new WebsiteSettingsUIBridge(nullptr);
122 123
123 // The controller cleans up after itself when the window closes. 124 // The controller cleans up after itself when the window closes.
124 controller_ = [WebsiteSettingsBubbleControllerForTesting alloc]; 125 controller_ = [WebsiteSettingsBubbleControllerForTesting alloc];
125 [controller_ setDefaultWindowWidth:default_width]; 126 [controller_ setDefaultWindowWidth:default_width];
126 [controller_ initWithParentWindow:test_window() 127 [controller_ initWithParentWindow:test_window()
127 websiteSettingsUIBridge:bridge_ 128 websiteSettingsUIBridge:bridge_
128 webContents:web_contents_factory_.CreateWebContents( 129 webContents:web_contents_factory_.CreateWebContents(
129 &profile_) 130 &profile_)
130 url:GURL("https://www.google.com") 131 url:GURL("https://www.google.com")];
131 isDevToolsDisabled:NO];
132 window_ = [controller_ window]; 132 window_ = [controller_ window];
133 [controller_ showWindow:nil]; 133 [controller_ showWindow:nil];
134 } 134 }
135 135
136 void CreateBubble() { 136 void CreateBubble() {
137 CreateBubbleWithWidth(0.0); 137 CreateBubbleWithWidth(0.0);
138 } 138 }
139 139
140 // Return a pointer to the first NSTextField found that either matches, or 140 // Return a pointer to the first NSTextField found that either matches, or
141 // doesn't match, the given text. 141 // doesn't match, the given text.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 199 }
200 200
201 content::TestBrowserThreadBundle thread_bundle_; 201 content::TestBrowserThreadBundle thread_bundle_;
202 TestingProfile profile_; 202 TestingProfile profile_;
203 content::TestWebContentsFactory web_contents_factory_; 203 content::TestWebContentsFactory web_contents_factory_;
204 204
205 WebsiteSettingsBubbleControllerForTesting* controller_; // Weak, owns self. 205 WebsiteSettingsBubbleControllerForTesting* controller_; // Weak, owns self.
206 NSWindow* window_; // Weak, owned by controller. 206 NSWindow* window_; // Weak, owned by controller.
207 }; 207 };
208 208
209 TEST_F(WebsiteSettingsBubbleControllerTest, SecurityDetailsButton) { 209 TEST_F(WebsiteSettingsBubbleControllerTest, ConnectionHelpButton) {
210 WebsiteSettingsUI::IdentityInfo info; 210 WebsiteSettingsUI::IdentityInfo info;
211 info.site_identity = std::string("example.com"); 211 info.site_identity = std::string("example.com");
212 info.identity_status = WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN; 212 info.identity_status = WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN;
213 213
214 CreateBubble(); 214 CreateBubble();
215 215
216 bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info)); 216 bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info));
217 217
218 EXPECT_EQ([[controller_ securityDetailsButton] action], 218 EXPECT_EQ([[controller_ connectionHelpButton] action],
219 @selector(showSecurityDetails:)); 219 @selector(openConnectionHelp:));
220 } 220 }
221 221
222 TEST_F(WebsiteSettingsBubbleControllerTest, ResetDecisionsButton) { 222 TEST_F(WebsiteSettingsBubbleControllerTest, ResetDecisionsButton) {
223 WebsiteSettingsUI::IdentityInfo info; 223 WebsiteSettingsUI::IdentityInfo info;
224 info.site_identity = std::string("example.com"); 224 info.site_identity = std::string("example.com");
225 info.identity_status = WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN; 225 info.identity_status = WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN;
226 226
227 CreateBubble(); 227 CreateBubble();
228 228
229 // Set identity info, specifying that the button should not be shown. 229 // Set identity info, specifying that the button should not be shown.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 315 }
316 if ([view isKindOfClass:[NSPopUpButton class]]) { 316 if ([view isKindOfClass:[NSPopUpButton class]]) {
317 NSPopUpButton* button = static_cast<NSPopUpButton*>(view); 317 NSPopUpButton* button = static_cast<NSPopUpButton*>(view);
318 EXPECT_LT(NSMaxX([button frame]), window_width); 318 EXPECT_LT(NSMaxX([button frame]), window_width);
319 } 319 }
320 } 320 }
321 } 321 }
322 } 322 }
323 323
324 } // namespace 324 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698