OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ssl_client_certificate_selector_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.h" |
6 | 6 |
7 #import <SecurityInterface/SFChooseIdentityPanel.h> | 7 #import <SecurityInterface/SFChooseIdentityPanel.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #import "base/mac/mac_util.h" |
10 #include "chrome/browser/ssl/ssl_client_certificate_selector_test.h" | 11 #include "chrome/browser/ssl/ssl_client_certificate_selector_test.h" |
11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_commands.h" | 13 #include "chrome/browser/ui/browser_commands.h" |
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
14 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" | 15 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" |
15 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" | 16 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" |
16 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
17 #include "content/public/browser/web_contents_view.h" | 18 #include "content/public/browser/web_contents_view.h" |
18 #include "content/public/test/test_utils.h" | 19 #include "content/public/test/test_utils.h" |
19 #include "ui/base/cocoa/window_size_constants.h" | 20 #include "ui/base/cocoa/window_size_constants.h" |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 void OnCertificateSelected(net::X509Certificate** out_cert, | 24 void OnCertificateSelected(net::X509Certificate** out_cert, |
24 int* out_count, | 25 int* out_count, |
25 net::X509Certificate* cert) { | 26 net::X509Certificate* cert) { |
26 *out_cert = cert; | 27 *out_cert = cert; |
27 ++(*out_count); | 28 ++(*out_count); |
28 } | 29 } |
29 | 30 |
30 } // namespace | 31 } // namespace |
31 | 32 |
32 typedef SSLClientCertificateSelectorTestBase | 33 typedef SSLClientCertificateSelectorTestBase |
33 SSLClientCertificateSelectorCocoaTest; | 34 SSLClientCertificateSelectorCocoaTest; |
34 | 35 |
35 IN_PROC_BROWSER_TEST_F(SSLClientCertificateSelectorCocoaTest, Basic) { | 36 IN_PROC_BROWSER_TEST_F(SSLClientCertificateSelectorCocoaTest, Basic) { |
| 37 // TODO(kbr): re-enable: http://crbug.com/222296 |
| 38 if (base::mac::IsOSMountainLionOrLater()) |
| 39 return; |
| 40 |
36 content::WebContents* web_contents = | 41 content::WebContents* web_contents = |
37 browser()->tab_strip_model()->GetActiveWebContents(); | 42 browser()->tab_strip_model()->GetActiveWebContents(); |
38 WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 43 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
39 WebContentsModalDialogManager::FromWebContents(web_contents); | 44 WebContentsModalDialogManager::FromWebContents(web_contents); |
40 EXPECT_FALSE(web_contents_modal_dialog_manager->IsShowingDialog()); | 45 EXPECT_FALSE(web_contents_modal_dialog_manager->IsShowingDialog()); |
41 | 46 |
42 net::X509Certificate* cert = NULL; | 47 net::X509Certificate* cert = NULL; |
43 int count = 0; | 48 int count = 0; |
44 SSLClientCertificateSelectorCocoa* selector = | 49 SSLClientCertificateSelectorCocoa* selector = |
45 [[SSLClientCertificateSelectorCocoa alloc] | 50 [[SSLClientCertificateSelectorCocoa alloc] |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 AddBlankTabAndShow(browser()); | 88 AddBlankTabAndShow(browser()); |
84 EXPECT_EQ(0.0, [sheetWindow alphaValue]); | 89 EXPECT_EQ(0.0, [sheetWindow alphaValue]); |
85 EXPECT_TRUE(NSEqualRects(ui::kWindowSizeDeterminedLater, | 90 EXPECT_TRUE(NSEqualRects(ui::kWindowSizeDeterminedLater, |
86 [sheetWindow frame])); | 91 [sheetWindow frame])); |
87 | 92 |
88 // Switch back and verify that the sheet is shown. | 93 // Switch back and verify that the sheet is shown. |
89 chrome::SelectNumberedTab(browser(), 0); | 94 chrome::SelectNumberedTab(browser(), 0); |
90 EXPECT_EQ(1.0, [sheetWindow alphaValue]); | 95 EXPECT_EQ(1.0, [sheetWindow alphaValue]); |
91 EXPECT_TRUE(NSEqualRects(sheetFrame, [sheetWindow frame])); | 96 EXPECT_TRUE(NSEqualRects(sheetFrame, [sheetWindow frame])); |
92 } | 97 } |
OLD | NEW |