| OLD | NEW |
| 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" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 permission_info_list.push_back(info); | 199 permission_info_list.push_back(info); |
| 200 } | 200 } |
| 201 ChosenObjectInfoList chosen_object_info_list; | 201 ChosenObjectInfoList chosen_object_info_list; |
| 202 bridge_->SetPermissionInfo(permission_info_list, chosen_object_info_list); | 202 bridge_->SetPermissionInfo(permission_info_list, chosen_object_info_list); |
| 203 } | 203 } |
| 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, BasicIdentity) { | |
| 210 WebsiteSettingsUI::IdentityInfo info; | |
| 211 info.site_identity = std::string("nhl.com"); | |
| 212 info.identity_status = WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN; | |
| 213 | |
| 214 CreateBubble(); | |
| 215 | |
| 216 // Test setting the site identity. | |
| 217 bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info)); | |
| 218 NSTextField* identity_field = FindTextField(TEXT_EQUAL, @"nhl.com"); | |
| 219 ASSERT_TRUE(identity_field != nil); | |
| 220 | |
| 221 // Test changing the site identity, and ensure that the UI is updated. | |
| 222 info.site_identity = std::string("google.com"); | |
| 223 bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info)); | |
| 224 EXPECT_EQ(identity_field, FindTextField(TEXT_EQUAL, @"google.com")); | |
| 225 | |
| 226 // Find the identity status field. | |
| 227 NSTextField* identity_status_field = | |
| 228 FindTextField(TEXT_NOT_EQUAL, @"google.com"); | |
| 229 ASSERT_NE(identity_field, identity_status_field); | |
| 230 | |
| 231 // Ensure the text of the identity status field changes when the status does. | |
| 232 NSString* status = [identity_status_field stringValue]; | |
| 233 info.identity_status = WebsiteSettings::SITE_IDENTITY_STATUS_CERT; | |
| 234 bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info)); | |
| 235 EXPECT_NSNE(status, [identity_status_field stringValue]); | |
| 236 } | |
| 237 | |
| 238 TEST_F(WebsiteSettingsBubbleControllerTest, SecurityDetailsButton) { | 209 TEST_F(WebsiteSettingsBubbleControllerTest, SecurityDetailsButton) { |
| 239 WebsiteSettingsUI::IdentityInfo info; | 210 WebsiteSettingsUI::IdentityInfo info; |
| 240 info.site_identity = std::string("example.com"); | 211 info.site_identity = std::string("example.com"); |
| 241 info.identity_status = WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN; | 212 info.identity_status = WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN; |
| 242 | 213 |
| 243 CreateBubble(); | 214 CreateBubble(); |
| 244 | 215 |
| 245 bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info)); | 216 bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info)); |
| 246 | 217 |
| 247 EXPECT_EQ([[controller_ securityDetailsButton] action], | 218 EXPECT_EQ([[controller_ securityDetailsButton] action], |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 } | 317 } |
| 347 if ([view isKindOfClass:[NSPopUpButton class]]) { | 318 if ([view isKindOfClass:[NSPopUpButton class]]) { |
| 348 NSPopUpButton* button = static_cast<NSPopUpButton*>(view); | 319 NSPopUpButton* button = static_cast<NSPopUpButton*>(view); |
| 349 EXPECT_LT(NSMaxX([button frame]), window_width); | 320 EXPECT_LT(NSMaxX([button frame]), window_width); |
| 350 } | 321 } |
| 351 } | 322 } |
| 352 } | 323 } |
| 353 } | 324 } |
| 354 | 325 |
| 355 } // namespace | 326 } // namespace |
| OLD | NEW |