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

Unified Diff: chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm

Issue 2624273003: Add a test for our workaround of an AppKit crash in SFChooseIdentityPanel. (Closed)
Patch Set: Simplify how we check that the certificate selector was deallocated. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm
diff --git a/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm b/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm
index bd1890344066e8cdf56eadf18b30f15e85872a80..058443e78bda54bc8f7e2c80ef0ba9babdd6916a 100644
--- a/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm
+++ b/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm
@@ -119,3 +119,57 @@ IN_PROC_BROWSER_TEST_F(SSLClientCertificateSelectorCocoaTest, HideShow) {
EXPECT_EQ(1.0, [sheetWindow alphaValue]);
EXPECT_FALSE([[selector overlayWindow] ignoresMouseEvents]);
}
+
+@interface DeallocTrackingSSLClientCertificateSelectorCocoa
+ : SSLClientCertificateSelectorCocoa
+@property(nonatomic) BOOL* wasDeallocated;
+@end
+
+@implementation DeallocTrackingSSLClientCertificateSelectorCocoa
+@synthesize wasDeallocated = wasDeallocated_;
+
+- (void)dealloc {
+ *wasDeallocated_ = true;
+ [super dealloc];
+}
+
+@end
+
+// Test that we can't trigger the crash from https://crbug.com/653093
+IN_PROC_BROWSER_TEST_F(SSLClientCertificateSelectorCocoaTest,
+ WorkaroundCrashySierra) {
+ BOOL selector_was_deallocated = false;
+
+ @autoreleasepool {
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ DeallocTrackingSSLClientCertificateSelectorCocoa* selector =
+ [[DeallocTrackingSSLClientCertificateSelectorCocoa alloc]
+ initWithBrowserContext:web_contents->GetBrowserContext()
+ certRequestInfo:auth_requestor_->cert_request_info_.get()
+ delegate:nil];
+ [selector displayForWebContents:web_contents];
+ content::RunAllPendingInMessageLoop();
+
+ selector.wasDeallocated = &selector_was_deallocated;
+
+ [selector.overlayWindow endSheet:selector.overlayWindow.attachedSheet];
+ content::RunAllPendingInMessageLoop();
+ }
+
+ EXPECT_TRUE(selector_was_deallocated);
+
+ // Without the workaround, this will crash on Sierra.
+ [[NSNotificationCenter defaultCenter]
+ postNotificationName:NSPreferredScrollerStyleDidChangeNotification
+ object:nil
+ userInfo:@{
+ @"NSScrollerStyle" : @(NSScrollerStyleLegacy)
+ }];
+ [[NSNotificationCenter defaultCenter]
+ postNotificationName:NSPreferredScrollerStyleDidChangeNotification
+ object:nil
+ userInfo:@{
+ @"NSScrollerStyle" : @(NSScrollerStyleOverlay)
+ }];
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698