OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "chrome/browser/ssl/captive_portal_blocking_page.h" | 5 #include "chrome/browser/ssl/captive_portal_blocking_page.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 FakeConnectionInfoDelegate* delegate = | 123 FakeConnectionInfoDelegate* delegate = |
124 new FakeConnectionInfoDelegate(is_wifi_connection, wifi_ssid); | 124 new FakeConnectionInfoDelegate(is_wifi_connection, wifi_ssid); |
125 net::SSLInfo ssl_info; | 125 net::SSLInfo ssl_info; |
126 ssl_info.cert = new net::X509Certificate( | 126 ssl_info.cert = new net::X509Certificate( |
127 login_url.host(), "CA", base::Time::Max(), base::Time::Max()); | 127 login_url.host(), "CA", base::Time::Max(), base::Time::Max()); |
128 | 128 |
129 // Blocking page is owned by the interstitial. | 129 // Blocking page is owned by the interstitial. |
130 CaptivePortalBlockingPage* blocking_page = new CaptivePortalBlockingPage( | 130 CaptivePortalBlockingPage* blocking_page = new CaptivePortalBlockingPage( |
131 contents, GURL(kBrokenSSL), login_url, ssl_cert_reporter.Pass(), ssl_info, | 131 contents, GURL(kBrokenSSL), login_url, ssl_cert_reporter.Pass(), ssl_info, |
132 base::Callback<void(bool)>()); | 132 base::Callback<void(bool)>()); |
133 blocking_page->SetDelegateForTesting(delegate); | 133 blocking_page->SetDelegate(delegate); |
134 blocking_page->Show(); | 134 blocking_page->Show(); |
135 | 135 |
136 WaitForInterstitialAttach(contents); | 136 WaitForInterstitialAttach(contents); |
137 EXPECT_TRUE( | 137 EXPECT_TRUE( |
138 WaitForRenderFrameReady(contents->GetInterstitialPage()->GetMainFrame())); | 138 WaitForRenderFrameReady(contents->GetInterstitialPage()->GetMainFrame())); |
139 EXPECT_EQ(expect_wifi == EXPECT_WIFI_YES, | 139 EXPECT_EQ(expect_wifi == EXPECT_WIFI_YES, |
140 IsInterstitialDisplayingText(contents->GetInterstitialPage(), | 140 IsInterstitialDisplayingText(contents->GetInterstitialPage(), |
141 "Wi-Fi")); | 141 "Wi-Fi")); |
142 if (!wifi_ssid.empty()) { | 142 if (!wifi_ssid.empty()) { |
143 EXPECT_EQ(expect_wifi_ssid == EXPECT_WIFI_SSID_YES, | 143 EXPECT_EQ(expect_wifi_ssid == EXPECT_WIFI_SSID_YES, |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 content::WebContents* contents, | 298 content::WebContents* contents, |
299 const GURL& request_url) const override { | 299 const GURL& request_url) const override { |
300 // Delegate is owned by the blocking page. | 300 // Delegate is owned by the blocking page. |
301 FakeConnectionInfoDelegate* delegate = | 301 FakeConnectionInfoDelegate* delegate = |
302 new FakeConnectionInfoDelegate(false, std::string()); | 302 new FakeConnectionInfoDelegate(false, std::string()); |
303 net::SSLInfo empty_ssl_info; | 303 net::SSLInfo empty_ssl_info; |
304 // Blocking page is owned by the interstitial. | 304 // Blocking page is owned by the interstitial. |
305 CaptivePortalBlockingPage* blocking_page = new CaptivePortalBlockingPage( | 305 CaptivePortalBlockingPage* blocking_page = new CaptivePortalBlockingPage( |
306 contents, GURL(kBrokenSSL), request_url, nullptr, empty_ssl_info, | 306 contents, GURL(kBrokenSSL), request_url, nullptr, empty_ssl_info, |
307 base::Callback<void(bool)>()); | 307 base::Callback<void(bool)>()); |
308 blocking_page->SetDelegateForTesting(delegate); | 308 blocking_page->SetDelegate(delegate); |
309 return blocking_page; | 309 return blocking_page; |
310 } | 310 } |
311 }; | 311 }; |
312 | 312 |
313 // Test that an IDN login domain is decoded properly. | 313 // Test that an IDN login domain is decoded properly. |
314 IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageIDNTest, | 314 IN_PROC_BROWSER_TEST_F(CaptivePortalBlockingPageIDNTest, |
315 ShowLoginIDNIfPortalRedirectsDetectionURL) { | 315 ShowLoginIDNIfPortalRedirectsDetectionURL) { |
316 EXPECT_TRUE(VerifyIDNDecoded()); | 316 EXPECT_TRUE(VerifyIDNDecoded()); |
317 } | 317 } |
OLD | NEW |