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 #include "chrome/browser/ssl/ssl_client_certificate_selector_test.h" | 10 #include "chrome/browser/ssl/ssl_client_certificate_selector_test.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 } // namespace | 27 } // namespace |
28 | 28 |
29 typedef SSLClientCertificateSelectorTestBase | 29 typedef SSLClientCertificateSelectorTestBase |
30 SSLClientCertificateSelectorCocoaTest; | 30 SSLClientCertificateSelectorCocoaTest; |
31 | 31 |
32 IN_PROC_BROWSER_TEST_F(SSLClientCertificateSelectorCocoaTest, Basic) { | 32 IN_PROC_BROWSER_TEST_F(SSLClientCertificateSelectorCocoaTest, Basic) { |
33 content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); | 33 content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
34 ConstrainedWindowTabHelper* constrained_window_tab_helper = | 34 ConstrainedWindowTabHelper* constrained_window_tab_helper = |
35 ConstrainedWindowTabHelper::FromWebContents(web_contents); | 35 ConstrainedWindowTabHelper::FromWebContents(web_contents); |
36 EXPECT_EQ(0u, constrained_window_tab_helper->constrained_window_count()); | 36 EXPECT_EQ(0u, constrained_window_tab_helper->dialog_count()); |
37 | 37 |
38 net::X509Certificate* cert = NULL; | 38 net::X509Certificate* cert = NULL; |
39 int count = 0; | 39 int count = 0; |
40 SSLClientCertificateSelectorCocoa* selector = | 40 SSLClientCertificateSelectorCocoa* selector = |
41 [[SSLClientCertificateSelectorCocoa alloc] | 41 [[SSLClientCertificateSelectorCocoa alloc] |
42 initWithNetworkSession:auth_requestor_->http_network_session_ | 42 initWithNetworkSession:auth_requestor_->http_network_session_ |
43 certRequestInfo:auth_requestor_->cert_request_info_ | 43 certRequestInfo:auth_requestor_->cert_request_info_ |
44 callback:base::Bind(&OnCertificateSelected, | 44 callback:base::Bind(&OnCertificateSelected, |
45 &cert, | 45 &cert, |
46 &count)]; | 46 &count)]; |
47 [selector displayForWebContents:web_contents]; | 47 [selector displayForWebContents:web_contents]; |
48 content::RunAllPendingInMessageLoop(); | 48 content::RunAllPendingInMessageLoop(); |
49 EXPECT_TRUE([selector panel]); | 49 EXPECT_TRUE([selector panel]); |
50 EXPECT_EQ(1u, constrained_window_tab_helper->constrained_window_count()); | 50 EXPECT_EQ(1u, constrained_window_tab_helper->dialog_count()); |
51 | 51 |
52 constrained_window_tab_helper->CloseConstrainedWindows(); | 52 constrained_window_tab_helper->CloseAllDialogs(); |
53 content::RunAllPendingInMessageLoop(); | 53 content::RunAllPendingInMessageLoop(); |
54 EXPECT_EQ(0u, constrained_window_tab_helper->constrained_window_count()); | 54 EXPECT_EQ(0u, constrained_window_tab_helper->dialog_count()); |
55 | 55 |
56 EXPECT_EQ(NULL, cert); | 56 EXPECT_EQ(NULL, cert); |
57 EXPECT_EQ(1, count); | 57 EXPECT_EQ(1, count); |
58 } | 58 } |
OLD | NEW |