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 #include <map> | 5 #include <map> |
6 #include <set> | 6 #include <set> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpsNonTimeoutError) { | 1554 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpsNonTimeoutError) { |
1555 GURL url = URLRequestFailedJob::GetMockHttpsUrl(net::ERR_UNEXPECTED); | 1555 GURL url = URLRequestFailedJob::GetMockHttpsUrl(net::ERR_UNEXPECTED); |
1556 NavigateToPageExpectNoTest(browser(), url, 1); | 1556 NavigateToPageExpectNoTest(browser(), url, 1); |
1557 } | 1557 } |
1558 | 1558 |
1559 // Make sure no captive portal test triggers on HTTPS timeouts of iframes. | 1559 // Make sure no captive portal test triggers on HTTPS timeouts of iframes. |
1560 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpsIframeTimeout) { | 1560 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpsIframeTimeout) { |
1561 // Use an HTTPS server for the top level page. | 1561 // Use an HTTPS server for the top level page. |
1562 net::TestServer https_server( | 1562 net::TestServer https_server( |
1563 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, | 1563 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, |
1564 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 1564 net::TestServer::GetTestDataPath()); |
1565 ASSERT_TRUE(https_server.Start()); | 1565 ASSERT_TRUE(https_server.Start()); |
1566 | 1566 |
1567 GURL url = https_server.GetURL(kTestServerIframeTimeoutPath); | 1567 GURL url = https_server.GetURL(kTestServerIframeTimeoutPath); |
1568 NavigateToPageExpectNoTest(browser(), url, 1); | 1568 NavigateToPageExpectNoTest(browser(), url, 1); |
1569 } | 1569 } |
1570 | 1570 |
1571 // Check the captive portal result when the test request reports a network | 1571 // Check the captive portal result when the test request reports a network |
1572 // error. The check is triggered by a slow loading page, and the page | 1572 // error. The check is triggered by a slow loading page, and the page |
1573 // errors out only after getting a captive portal result. | 1573 // errors out only after getting a captive portal result. |
1574 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, RequestFails) { | 1574 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, RequestFails) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 // SSL certificate error. | 1609 // SSL certificate error. |
1610 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, RedirectSSLCertError) { | 1610 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, RedirectSSLCertError) { |
1611 // Need an HTTP TestServer to handle a dynamically created server redirect. | 1611 // Need an HTTP TestServer to handle a dynamically created server redirect. |
1612 ASSERT_TRUE(test_server()->Start()); | 1612 ASSERT_TRUE(test_server()->Start()); |
1613 | 1613 |
1614 net::TestServer::SSLOptions ssl_options; | 1614 net::TestServer::SSLOptions ssl_options; |
1615 ssl_options.server_certificate = | 1615 ssl_options.server_certificate = |
1616 net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; | 1616 net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; |
1617 net::TestServer https_server( | 1617 net::TestServer https_server( |
1618 net::TestServer::TYPE_HTTPS, ssl_options, | 1618 net::TestServer::TYPE_HTTPS, ssl_options, |
1619 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 1619 net::TestServer::GetTestDataPath()); |
1620 ASSERT_TRUE(https_server.Start()); | 1620 ASSERT_TRUE(https_server.Start()); |
1621 | 1621 |
1622 GURL ssl_login_url = https_server.GetURL(kTestServerLoginPath); | 1622 GURL ssl_login_url = https_server.GetURL(kTestServerLoginPath); |
1623 | 1623 |
1624 CaptivePortalService* captive_portal_service = | 1624 CaptivePortalService* captive_portal_service = |
1625 CaptivePortalServiceFactory::GetForProfile(browser()->profile()); | 1625 CaptivePortalServiceFactory::GetForProfile(browser()->profile()); |
1626 ASSERT_TRUE(captive_portal_service); | 1626 ASSERT_TRUE(captive_portal_service); |
1627 SetUpCaptivePortalService( | 1627 SetUpCaptivePortalService( |
1628 browser()->profile(), | 1628 browser()->profile(), |
1629 test_server()->GetURL(CreateServerRedirect(ssl_login_url.spec()))); | 1629 test_server()->GetURL(CreateServerRedirect(ssl_login_url.spec()))); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 // tab. The user then logs in and the page with the error is reloaded. | 1697 // tab. The user then logs in and the page with the error is reloaded. |
1698 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, SSLCertErrorLogin) { | 1698 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, SSLCertErrorLogin) { |
1699 // Need an HTTP TestServer to handle a dynamically created server redirect. | 1699 // Need an HTTP TestServer to handle a dynamically created server redirect. |
1700 ASSERT_TRUE(test_server()->Start()); | 1700 ASSERT_TRUE(test_server()->Start()); |
1701 | 1701 |
1702 net::TestServer::SSLOptions https_options; | 1702 net::TestServer::SSLOptions https_options; |
1703 https_options.server_certificate = | 1703 https_options.server_certificate = |
1704 net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; | 1704 net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; |
1705 net::TestServer https_server( | 1705 net::TestServer https_server( |
1706 net::TestServer::TYPE_HTTPS, https_options, | 1706 net::TestServer::TYPE_HTTPS, https_options, |
1707 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 1707 net::TestServer::GetTestDataPath()); |
1708 ASSERT_TRUE(https_server.Start()); | 1708 ASSERT_TRUE(https_server.Start()); |
1709 | 1709 |
1710 // The path does not matter. | 1710 // The path does not matter. |
1711 GURL cert_error_url = https_server.GetURL(kTestServerLoginPath); | 1711 GURL cert_error_url = https_server.GetURL(kTestServerLoginPath); |
1712 // The interstitial should trigger a captive portal check when it opens, just | 1712 // The interstitial should trigger a captive portal check when it opens, just |
1713 // like navigating to kMockHttpsQuickTimeoutUrl. | 1713 // like navigating to kMockHttpsQuickTimeoutUrl. |
1714 FastErrorBehindCaptivePortal(browser(), true, cert_error_url); | 1714 FastErrorBehindCaptivePortal(browser(), true, cert_error_url); |
1715 | 1715 |
1716 // Simulate logging in. Can't use Login() because the interstitial tab looks | 1716 // Simulate logging in. Can't use Login() because the interstitial tab looks |
1717 // like a cross between a hung tab (Load was never committed) and a tab at an | 1717 // like a cross between a hung tab (Load was never committed) and a tab at an |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2153 1); | 2153 1); |
2154 Login(browser(), 1, 0); | 2154 Login(browser(), 1, 0); |
2155 FailLoadsAfterLogin(browser(), 1); | 2155 FailLoadsAfterLogin(browser(), 1); |
2156 } | 2156 } |
2157 | 2157 |
2158 // An HTTPS page redirects to an HTTP page. | 2158 // An HTTPS page redirects to an HTTP page. |
2159 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpsToHttpRedirect) { | 2159 IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest, HttpsToHttpRedirect) { |
2160 // Use an HTTPS server for the top level page. | 2160 // Use an HTTPS server for the top level page. |
2161 net::TestServer https_server( | 2161 net::TestServer https_server( |
2162 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, | 2162 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, |
2163 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 2163 net::TestServer::GetTestDataPath()); |
2164 ASSERT_TRUE(https_server.Start()); | 2164 ASSERT_TRUE(https_server.Start()); |
2165 | 2165 |
2166 GURL http_timeout_url = | 2166 GURL http_timeout_url = |
2167 URLRequestFailedJob::GetMockHttpUrl(net::ERR_CONNECTION_TIMED_OUT); | 2167 URLRequestFailedJob::GetMockHttpUrl(net::ERR_CONNECTION_TIMED_OUT); |
2168 | 2168 |
2169 // 2 navigations due to the Link Doctor. | 2169 // 2 navigations due to the Link Doctor. |
2170 NavigateToPageExpectNoTest( | 2170 NavigateToPageExpectNoTest( |
2171 browser(), | 2171 browser(), |
2172 https_server.GetURL(CreateServerRedirect(http_timeout_url.spec())), | 2172 https_server.GetURL(CreateServerRedirect(http_timeout_url.spec())), |
2173 2); | 2173 2); |
(...skipping 23 matching lines...) Expand all Loading... |
2197 base::Bind(&AddHstsHost, | 2197 base::Bind(&AddHstsHost, |
2198 make_scoped_refptr(browser()->profile()->GetRequestContext()), | 2198 make_scoped_refptr(browser()->profile()->GetRequestContext()), |
2199 http_timeout_url.host())); | 2199 http_timeout_url.host())); |
2200 | 2200 |
2201 SlowLoadBehindCaptivePortal(browser(), true, http_timeout_url, 1, 1); | 2201 SlowLoadBehindCaptivePortal(browser(), true, http_timeout_url, 1, 1); |
2202 Login(browser(), 1, 0); | 2202 Login(browser(), 1, 0); |
2203 FailLoadsAfterLogin(browser(), 1); | 2203 FailLoadsAfterLogin(browser(), 1); |
2204 } | 2204 } |
2205 | 2205 |
2206 } // namespace captive_portal | 2206 } // namespace captive_portal |
OLD | NEW |