| Index: chrome/browser/ui/cocoa/page_info/page_info_bubble_controller_unittest.mm
|
| diff --git a/chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/page_info/page_info_bubble_controller_unittest.mm
|
| similarity index 83%
|
| rename from chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller_unittest.mm
|
| rename to chrome/browser/ui/cocoa/page_info/page_info_bubble_controller_unittest.mm
|
| index ee3762a31f5d5d3f2b2c6a921367349ef76a7a1a..d3d804d31aed715dbdb9401ff8e678d7c42a99f0 100644
|
| --- a/chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller_unittest.mm
|
| +++ b/chrome/browser/ui/cocoa/page_info/page_info_bubble_controller_unittest.mm
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#import "chrome/browser/ui/cocoa/page_info/website_settings_bubble_controller.h"
|
| +#import "chrome/browser/ui/cocoa/page_info/page_info_bubble_controller.h"
|
|
|
| #include <stddef.h>
|
|
|
| @@ -16,13 +16,13 @@
|
| #include "net/test/test_certificate_data.h"
|
| #include "testing/gtest_mac.h"
|
|
|
| -@interface WebsiteSettingsBubbleController (ExposedForTesting)
|
| +@interface PageInfoBubbleController (ExposedForTesting)
|
| - (NSView*)permissionsView;
|
| - (NSButton*)resetDecisionsButton;
|
| - (NSButton*)connectionHelpButton;
|
| @end
|
|
|
| -@implementation WebsiteSettingsBubbleController (ExposedForTesting)
|
| +@implementation PageInfoBubbleController (ExposedForTesting)
|
| - (NSView*)permissionsView {
|
| return permissionsView_;
|
| }
|
| @@ -34,14 +34,13 @@
|
| }
|
| @end
|
|
|
| -@interface WebsiteSettingsBubbleControllerForTesting
|
| - : WebsiteSettingsBubbleController {
|
| +@interface PageInfoBubbleControllerForTesting : PageInfoBubbleController {
|
| @private
|
| CGFloat defaultWindowWidth_;
|
| }
|
| @end
|
|
|
| -@implementation WebsiteSettingsBubbleControllerForTesting
|
| +@implementation PageInfoBubbleControllerForTesting
|
| - (void)setDefaultWindowWidth:(CGFloat)width {
|
| defaultWindowWidth_ = width;
|
| }
|
| @@ -83,9 +82,9 @@ const content_settings::SettingSource kTestSettingSources[] = {
|
| content_settings::SETTING_SOURCE_POLICY,
|
| content_settings::SETTING_SOURCE_EXTENSION};
|
|
|
| -class WebsiteSettingsBubbleControllerTest : public CocoaTest {
|
| +class PageInfoBubbleControllerTest : public CocoaTest {
|
| public:
|
| - WebsiteSettingsBubbleControllerTest() { controller_ = nil; }
|
| + PageInfoBubbleControllerTest() { controller_ = nil; }
|
|
|
| void TearDown() override {
|
| [controller_ close];
|
| @@ -93,23 +92,23 @@ class WebsiteSettingsBubbleControllerTest : public CocoaTest {
|
| }
|
|
|
| protected:
|
| - WebsiteSettingsUIBridge* bridge_; // Weak, owned by controller.
|
| + PageInfoUIBridge* bridge_; // Weak, owned by controller.
|
|
|
| enum MatchType { TEXT_EQUAL = 0, TEXT_NOT_EQUAL };
|
|
|
| - // Creates a new website settings bubble, with the given default width.
|
| + // Creates a new page info bubble, with the given default width.
|
| // If |default_width| is 0, the *default* default width will be used.
|
| void CreateBubbleWithWidth(CGFloat default_width) {
|
| - bridge_ = new WebsiteSettingsUIBridge(nullptr);
|
| + bridge_ = new PageInfoUIBridge(nullptr);
|
|
|
| // The controller cleans up after itself when the window closes.
|
| - controller_ = [WebsiteSettingsBubbleControllerForTesting alloc];
|
| + controller_ = [PageInfoBubbleControllerForTesting alloc];
|
| [controller_ setDefaultWindowWidth:default_width];
|
| - [controller_ initWithParentWindow:test_window()
|
| - websiteSettingsUIBridge:bridge_
|
| - webContents:web_contents_factory_.CreateWebContents(
|
| - &profile_)
|
| - url:GURL("https://www.google.com")];
|
| + [controller_
|
| + initWithParentWindow:test_window()
|
| + pageInfoUIBridge:bridge_
|
| + webContents:web_contents_factory_.CreateWebContents(&profile_)
|
| + url:GURL("https://www.google.com")];
|
| window_ = [controller_ window];
|
| [controller_ showWindow:nil];
|
| }
|
| @@ -162,7 +161,7 @@ class WebsiteSettingsBubbleControllerTest : public CocoaTest {
|
| // - [allow, block, ask] by default
|
| // - [block, allow] * [by user, by policy, by extension]
|
| PermissionInfoList permission_info_list;
|
| - WebsiteSettingsUI::PermissionInfo info;
|
| + PageInfoUI::PermissionInfo info;
|
| for (size_t i = 0; i < arraysize(kTestPermissionTypes); ++i) {
|
| info.type = kTestPermissionTypes[i];
|
| info.setting = kTestSettings[i];
|
| @@ -181,33 +180,33 @@ class WebsiteSettingsBubbleControllerTest : public CocoaTest {
|
| TestingProfile profile_;
|
| content::TestWebContentsFactory web_contents_factory_;
|
|
|
| - WebsiteSettingsBubbleControllerForTesting* controller_; // Weak, owns self.
|
| + PageInfoBubbleControllerForTesting* controller_; // Weak, owns self.
|
| NSWindow* window_; // Weak, owned by controller.
|
| };
|
|
|
| -TEST_F(WebsiteSettingsBubbleControllerTest, ConnectionHelpButton) {
|
| - WebsiteSettingsUI::IdentityInfo info;
|
| +TEST_F(PageInfoBubbleControllerTest, ConnectionHelpButton) {
|
| + PageInfoUI::IdentityInfo info;
|
| info.site_identity = std::string("example.com");
|
| - info.identity_status = WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN;
|
| + info.identity_status = PageInfo::SITE_IDENTITY_STATUS_UNKNOWN;
|
|
|
| CreateBubble();
|
|
|
| - bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info));
|
| + bridge_->SetIdentityInfo(const_cast<PageInfoUI::IdentityInfo&>(info));
|
|
|
| EXPECT_EQ([[controller_ connectionHelpButton] action],
|
| @selector(openConnectionHelp:));
|
| }
|
|
|
| -TEST_F(WebsiteSettingsBubbleControllerTest, ResetDecisionsButton) {
|
| - WebsiteSettingsUI::IdentityInfo info;
|
| +TEST_F(PageInfoBubbleControllerTest, ResetDecisionsButton) {
|
| + PageInfoUI::IdentityInfo info;
|
| info.site_identity = std::string("example.com");
|
| - info.identity_status = WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN;
|
| + info.identity_status = PageInfo::SITE_IDENTITY_STATUS_UNKNOWN;
|
|
|
| CreateBubble();
|
|
|
| // Set identity info, specifying that the button should not be shown.
|
| info.show_ssl_decision_revoke_button = false;
|
| - bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info));
|
| + bridge_->SetIdentityInfo(const_cast<PageInfoUI::IdentityInfo&>(info));
|
| EXPECT_EQ([controller_ resetDecisionsButton], nil);
|
|
|
| // Set identity info, specifying that the button should be shown.
|
| @@ -215,7 +214,7 @@ TEST_F(WebsiteSettingsBubbleControllerTest, ResetDecisionsButton) {
|
| reinterpret_cast<const char*>(google_der), sizeof(google_der));
|
| ASSERT_TRUE(info.certificate);
|
| info.show_ssl_decision_revoke_button = true;
|
| - bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info));
|
| + bridge_->SetIdentityInfo(const_cast<PageInfoUI::IdentityInfo&>(info));
|
| EXPECT_NE([controller_ resetDecisionsButton], nil);
|
|
|
| // Check that clicking the button calls the right selector.
|
| @@ -228,7 +227,7 @@ TEST_F(WebsiteSettingsBubbleControllerTest, ResetDecisionsButton) {
|
| // again.
|
| }
|
|
|
| -TEST_F(WebsiteSettingsBubbleControllerTest, SetPermissionInfo) {
|
| +TEST_F(PageInfoBubbleControllerTest, SetPermissionInfo) {
|
| CreateBubble();
|
| SetTestPermissions();
|
|
|
| @@ -264,7 +263,7 @@ TEST_F(WebsiteSettingsBubbleControllerTest, SetPermissionInfo) {
|
| EXPECT_EQ(3, disabled_count);
|
| }
|
|
|
| -TEST_F(WebsiteSettingsBubbleControllerTest, WindowWidth) {
|
| +TEST_F(PageInfoBubbleControllerTest, WindowWidth) {
|
| const CGFloat kBigEnoughBubbleWidth = 310;
|
| // Creating a window that should fit everything.
|
| CreateBubbleWithWidth(kBigEnoughBubbleWidth);
|
|
|