| 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" |
| 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 "net/test/test_certificate_data.h" |
| 13 #include "testing/gtest_mac.h" | 14 #include "testing/gtest_mac.h" |
| 14 | 15 |
| 15 @interface WebsiteSettingsBubbleController (ExposedForTesting) | 16 @interface WebsiteSettingsBubbleController (ExposedForTesting) |
| 16 - (NSView*)permissionsView; | 17 - (NSView*)permissionsView; |
| 17 - (NSButton*)resetDecisionsButton; | 18 - (NSButton*)resetDecisionsButton; |
| 18 - (NSButton*)securityDetailsButton; | 19 - (NSButton*)securityDetailsButton; |
| 19 @end | 20 @end |
| 20 | 21 |
| 21 @implementation WebsiteSettingsBubbleController (ExposedForTesting) | 22 @implementation WebsiteSettingsBubbleController (ExposedForTesting) |
| 22 - (NSView*)permissionsView { | 23 - (NSView*)permissionsView { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 info.identity_status = WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN; | 254 info.identity_status = WebsiteSettings::SITE_IDENTITY_STATUS_UNKNOWN; |
| 254 | 255 |
| 255 CreateBubble(); | 256 CreateBubble(); |
| 256 | 257 |
| 257 // Set identity info, specifying that the button should not be shown. | 258 // Set identity info, specifying that the button should not be shown. |
| 258 info.show_ssl_decision_revoke_button = false; | 259 info.show_ssl_decision_revoke_button = false; |
| 259 bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info)); | 260 bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info)); |
| 260 EXPECT_EQ([controller_ resetDecisionsButton], nil); | 261 EXPECT_EQ([controller_ resetDecisionsButton], nil); |
| 261 | 262 |
| 262 // Set identity info, specifying that the button should be shown. | 263 // Set identity info, specifying that the button should be shown. |
| 263 info.cert_id = 1; | 264 info.certificate = net::X509Certificate::CreateFromBytes( |
| 265 reinterpret_cast<const char*>(google_der), sizeof(google_der)); |
| 264 info.show_ssl_decision_revoke_button = true; | 266 info.show_ssl_decision_revoke_button = true; |
| 265 bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info)); | 267 bridge_->SetIdentityInfo(const_cast<WebsiteSettingsUI::IdentityInfo&>(info)); |
| 266 EXPECT_NE([controller_ resetDecisionsButton], nil); | 268 EXPECT_NE([controller_ resetDecisionsButton], nil); |
| 267 | 269 |
| 268 // Check that clicking the button calls the right selector. | 270 // Check that clicking the button calls the right selector. |
| 269 EXPECT_EQ([[controller_ resetDecisionsButton] action], | 271 EXPECT_EQ([[controller_ resetDecisionsButton] action], |
| 270 @selector(resetCertificateDecisions:)); | 272 @selector(resetCertificateDecisions:)); |
| 271 | 273 |
| 272 // Since the bubble is only created once per identity, we only need to check | 274 // Since the bubble is only created once per identity, we only need to check |
| 273 // the button is *added* when needed. So we don't check that it's removed | 275 // the button is *added* when needed. So we don't check that it's removed |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 } | 346 } |
| 345 if ([view isKindOfClass:[NSPopUpButton class]]) { | 347 if ([view isKindOfClass:[NSPopUpButton class]]) { |
| 346 NSPopUpButton* button = static_cast<NSPopUpButton*>(view); | 348 NSPopUpButton* button = static_cast<NSPopUpButton*>(view); |
| 347 EXPECT_LT(NSMaxX([button frame]), window_width); | 349 EXPECT_LT(NSMaxX([button frame]), window_width); |
| 348 } | 350 } |
| 349 } | 351 } |
| 350 } | 352 } |
| 351 } | 353 } |
| 352 | 354 |
| 353 } // namespace | 355 } // namespace |
| OLD | NEW |