| 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 <deque> | 5 #include <deque> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 loader_path_, | 1003 loader_path_, |
| 1004 replacement_text, | 1004 replacement_text, |
| 1005 &replacement_path)); | 1005 &replacement_path)); |
| 1006 | 1006 |
| 1007 const net::TestServer* src_server = test_server(); | 1007 const net::TestServer* src_server = test_server(); |
| 1008 scoped_ptr<net::TestServer> https_src_server; | 1008 scoped_ptr<net::TestServer> https_src_server; |
| 1009 if (use_https_src_server_) { | 1009 if (use_https_src_server_) { |
| 1010 https_src_server.reset( | 1010 https_src_server.reset( |
| 1011 new net::TestServer( | 1011 new net::TestServer( |
| 1012 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, | 1012 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, |
| 1013 base::FilePath(FILE_PATH_LITERAL("chrome/test/data")))); | 1013 net::TestServer::GetTestDataPath())); |
| 1014 ASSERT_TRUE(https_src_server->Start()); | 1014 ASSERT_TRUE(https_src_server->Start()); |
| 1015 src_server = https_src_server.get(); | 1015 src_server = https_src_server.get(); |
| 1016 } | 1016 } |
| 1017 GURL loader_url = src_server->GetURL(replacement_path + | 1017 GURL loader_url = src_server->GetURL(replacement_path + |
| 1018 loader_query_and_fragment_); | 1018 loader_query_and_fragment_); |
| 1019 | 1019 |
| 1020 PrerenderManager* prerender_manager = GetPrerenderManager(); | 1020 PrerenderManager* prerender_manager = GetPrerenderManager(); |
| 1021 ASSERT_TRUE(prerender_manager); | 1021 ASSERT_TRUE(prerender_manager); |
| 1022 prerender_manager->mutable_config().rate_limit_enabled = false; | 1022 prerender_manager->mutable_config().rate_limit_enabled = false; |
| 1023 prerender_manager->mutable_config().https_allowed = true; | 1023 prerender_manager->mutable_config().https_allowed = true; |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 GURL destination_url = test_server()->GetURL( | 1508 GURL destination_url = test_server()->GetURL( |
| 1509 "files/prerender/prerender_page.html"); | 1509 "files/prerender/prerender_page.html"); |
| 1510 PrerenderTestURL(prerender_url, destination_url, FINAL_STATUS_USED, 2); | 1510 PrerenderTestURL(prerender_url, destination_url, FINAL_STATUS_USED, 2); |
| 1511 OpenDestURLViaClick(); | 1511 OpenDestURLViaClick(); |
| 1512 } | 1512 } |
| 1513 | 1513 |
| 1514 // Checks that a prerender for an https will prevent a prerender from happening. | 1514 // Checks that a prerender for an https will prevent a prerender from happening. |
| 1515 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHttps) { | 1515 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHttps) { |
| 1516 net::TestServer https_server( | 1516 net::TestServer https_server( |
| 1517 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, | 1517 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, |
| 1518 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 1518 net::TestServer::GetTestDataPath()); |
| 1519 ASSERT_TRUE(https_server.Start()); | 1519 ASSERT_TRUE(https_server.Start()); |
| 1520 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); | 1520 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); |
| 1521 PrerenderTestURL(https_url, | 1521 PrerenderTestURL(https_url, |
| 1522 FINAL_STATUS_USED, | 1522 FINAL_STATUS_USED, |
| 1523 1); | 1523 1); |
| 1524 NavigateToDestURL(); | 1524 NavigateToDestURL(); |
| 1525 } | 1525 } |
| 1526 | 1526 |
| 1527 // Checks that client-issued redirects to an https page will cancel prerenders. | 1527 // Checks that client-issued redirects to an https page will cancel prerenders. |
| 1528 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClientRedirectToHttps) { | 1528 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClientRedirectToHttps) { |
| 1529 net::TestServer https_server( | 1529 net::TestServer https_server( |
| 1530 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, | 1530 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, |
| 1531 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 1531 net::TestServer::GetTestDataPath()); |
| 1532 ASSERT_TRUE(https_server.Start()); | 1532 ASSERT_TRUE(https_server.Start()); |
| 1533 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); | 1533 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); |
| 1534 PrerenderTestURL(CreateClientRedirect(https_url.spec()), | 1534 PrerenderTestURL(CreateClientRedirect(https_url.spec()), |
| 1535 FINAL_STATUS_USED, | 1535 FINAL_STATUS_USED, |
| 1536 2); | 1536 2); |
| 1537 NavigateToDestURL(); | 1537 NavigateToDestURL(); |
| 1538 } | 1538 } |
| 1539 | 1539 |
| 1540 // Checks that client-issued redirects within an iframe in a prerendered | 1540 // Checks that client-issued redirects within an iframe in a prerendered |
| 1541 // page will not count as an "alias" for the prerendered page. | 1541 // page will not count as an "alias" for the prerendered page. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1556 NavigateToDestURL(); | 1556 NavigateToDestURL(); |
| 1557 } | 1557 } |
| 1558 | 1558 |
| 1559 // Checks that client-issued redirects within an iframe in a prerendered | 1559 // Checks that client-issued redirects within an iframe in a prerendered |
| 1560 // page to an https page will not cancel the prerender, nor will it | 1560 // page to an https page will not cancel the prerender, nor will it |
| 1561 // count as an "alias" for the prerendered page. | 1561 // count as an "alias" for the prerendered page. |
| 1562 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1562 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
| 1563 PrerenderClientRedirectToHttpsInIframe) { | 1563 PrerenderClientRedirectToHttpsInIframe) { |
| 1564 net::TestServer https_server( | 1564 net::TestServer https_server( |
| 1565 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, | 1565 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, |
| 1566 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 1566 net::TestServer::GetTestDataPath()); |
| 1567 ASSERT_TRUE(https_server.Start()); | 1567 ASSERT_TRUE(https_server.Start()); |
| 1568 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); | 1568 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); |
| 1569 std::string redirect_path = CreateClientRedirect(https_url.spec()); | 1569 std::string redirect_path = CreateClientRedirect(https_url.spec()); |
| 1570 std::vector<net::TestServer::StringPair> replacement_text; | 1570 std::vector<net::TestServer::StringPair> replacement_text; |
| 1571 replacement_text.push_back( | 1571 replacement_text.push_back( |
| 1572 std::make_pair("REPLACE_WITH_URL", "/" + redirect_path)); | 1572 std::make_pair("REPLACE_WITH_URL", "/" + redirect_path)); |
| 1573 std::string replacement_path; | 1573 std::string replacement_path; |
| 1574 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( | 1574 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( |
| 1575 "files/prerender/prerender_with_iframe.html", | 1575 "files/prerender/prerender_with_iframe.html", |
| 1576 replacement_text, | 1576 replacement_text, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1614 PrerenderTestURL(prerender_url, destination_url, FINAL_STATUS_USED, 1); | 1614 PrerenderTestURL(prerender_url, destination_url, FINAL_STATUS_USED, 1); |
| 1615 OpenDestURLViaClick(); | 1615 OpenDestURLViaClick(); |
| 1616 } | 1616 } |
| 1617 | 1617 |
| 1618 // Checks that server-issued redirects from an http to an https | 1618 // Checks that server-issued redirects from an http to an https |
| 1619 // location will cancel prerendering. | 1619 // location will cancel prerendering. |
| 1620 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1620 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
| 1621 PrerenderServerRedirectToHttps) { | 1621 PrerenderServerRedirectToHttps) { |
| 1622 net::TestServer https_server( | 1622 net::TestServer https_server( |
| 1623 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, | 1623 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, |
| 1624 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 1624 net::TestServer::GetTestDataPath()); |
| 1625 ASSERT_TRUE(https_server.Start()); | 1625 ASSERT_TRUE(https_server.Start()); |
| 1626 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); | 1626 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); |
| 1627 PrerenderTestURL(CreateServerRedirect(https_url.spec()), | 1627 PrerenderTestURL(CreateServerRedirect(https_url.spec()), |
| 1628 FINAL_STATUS_USED, | 1628 FINAL_STATUS_USED, |
| 1629 1); | 1629 1); |
| 1630 NavigateToDestURL(); | 1630 NavigateToDestURL(); |
| 1631 } | 1631 } |
| 1632 | 1632 |
| 1633 // Checks that server-issued redirects within an iframe in a prerendered | 1633 // Checks that server-issued redirects within an iframe in a prerendered |
| 1634 // page will not count as an "alias" for the prerendered page. | 1634 // page will not count as an "alias" for the prerendered page. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1649 NavigateToDestURL(); | 1649 NavigateToDestURL(); |
| 1650 } | 1650 } |
| 1651 | 1651 |
| 1652 // Checks that server-issued redirects within an iframe in a prerendered | 1652 // Checks that server-issued redirects within an iframe in a prerendered |
| 1653 // page to an https page will not cancel the prerender, nor will it | 1653 // page to an https page will not cancel the prerender, nor will it |
| 1654 // count as an "alias" for the prerendered page. | 1654 // count as an "alias" for the prerendered page. |
| 1655 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1655 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
| 1656 PrerenderServerRedirectToHttpsInIframe) { | 1656 PrerenderServerRedirectToHttpsInIframe) { |
| 1657 net::TestServer https_server( | 1657 net::TestServer https_server( |
| 1658 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, | 1658 net::TestServer::TYPE_HTTPS, net::TestServer::kLocalhost, |
| 1659 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 1659 net::TestServer::GetTestDataPath()); |
| 1660 ASSERT_TRUE(https_server.Start()); | 1660 ASSERT_TRUE(https_server.Start()); |
| 1661 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); | 1661 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); |
| 1662 std::string redirect_path = CreateServerRedirect(https_url.spec()); | 1662 std::string redirect_path = CreateServerRedirect(https_url.spec()); |
| 1663 std::vector<net::TestServer::StringPair> replacement_text; | 1663 std::vector<net::TestServer::StringPair> replacement_text; |
| 1664 replacement_text.push_back( | 1664 replacement_text.push_back( |
| 1665 std::make_pair("REPLACE_WITH_URL", "/" + redirect_path)); | 1665 std::make_pair("REPLACE_WITH_URL", "/" + redirect_path)); |
| 1666 std::string replacement_path; | 1666 std::string replacement_path; |
| 1667 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( | 1667 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( |
| 1668 "files/prerender/prerender_with_iframe.html", | 1668 "files/prerender/prerender_with_iframe.html", |
| 1669 replacement_text, | 1669 replacement_text, |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2126 PrerenderTestURL("files/prerender/prerender_xhr_delete.html", | 2126 PrerenderTestURL("files/prerender/prerender_xhr_delete.html", |
| 2127 FINAL_STATUS_INVALID_HTTP_METHOD, | 2127 FINAL_STATUS_INVALID_HTTP_METHOD, |
| 2128 1); | 2128 1); |
| 2129 } | 2129 } |
| 2130 | 2130 |
| 2131 // Checks that a top-level page which would trigger an SSL error is canceled. | 2131 // Checks that a top-level page which would trigger an SSL error is canceled. |
| 2132 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorTopLevel) { | 2132 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorTopLevel) { |
| 2133 net::TestServer::SSLOptions ssl_options; | 2133 net::TestServer::SSLOptions ssl_options; |
| 2134 ssl_options.server_certificate = | 2134 ssl_options.server_certificate = |
| 2135 net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; | 2135 net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; |
| 2136 net::TestServer https_server( | 2136 net::TestServer https_server( |
| 2137 net::TestServer::TYPE_HTTPS, ssl_options, | 2137 net::TestServer::TYPE_HTTPS, ssl_options, |
| 2138 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 2138 net::TestServer::GetTestDataPath()); |
| 2139 ASSERT_TRUE(https_server.Start()); | 2139 ASSERT_TRUE(https_server.Start()); |
| 2140 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); | 2140 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); |
| 2141 PrerenderTestURL(https_url, | 2141 PrerenderTestURL(https_url, |
| 2142 FINAL_STATUS_SSL_ERROR, | 2142 FINAL_STATUS_SSL_ERROR, |
| 2143 1); | 2143 1); |
| 2144 } | 2144 } |
| 2145 | 2145 |
| 2146 // Checks that an SSL error that comes from a subresource does not cancel | 2146 // Checks that an SSL error that comes from a subresource does not cancel |
| 2147 // the page. Non-main-frame requests are simply cancelled if they run into | 2147 // the page. Non-main-frame requests are simply cancelled if they run into |
| 2148 // an SSL problem. | 2148 // an SSL problem. |
| 2149 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorSubresource) { | 2149 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorSubresource) { |
| 2150 net::TestServer::SSLOptions ssl_options; | 2150 net::TestServer::SSLOptions ssl_options; |
| 2151 ssl_options.server_certificate = | 2151 ssl_options.server_certificate = |
| 2152 net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; | 2152 net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; |
| 2153 net::TestServer https_server( | 2153 net::TestServer https_server( |
| 2154 net::TestServer::TYPE_HTTPS, ssl_options, | 2154 net::TestServer::TYPE_HTTPS, ssl_options, |
| 2155 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 2155 net::TestServer::GetTestDataPath()); |
| 2156 ASSERT_TRUE(https_server.Start()); | 2156 ASSERT_TRUE(https_server.Start()); |
| 2157 GURL https_url = https_server.GetURL("files/prerender/image.jpeg"); | 2157 GURL https_url = https_server.GetURL("files/prerender/image.jpeg"); |
| 2158 std::vector<net::TestServer::StringPair> replacement_text; | 2158 std::vector<net::TestServer::StringPair> replacement_text; |
| 2159 replacement_text.push_back( | 2159 replacement_text.push_back( |
| 2160 std::make_pair("REPLACE_WITH_IMAGE_URL", https_url.spec())); | 2160 std::make_pair("REPLACE_WITH_IMAGE_URL", https_url.spec())); |
| 2161 std::string replacement_path; | 2161 std::string replacement_path; |
| 2162 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( | 2162 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( |
| 2163 "files/prerender/prerender_with_image.html", | 2163 "files/prerender/prerender_with_image.html", |
| 2164 replacement_text, | 2164 replacement_text, |
| 2165 &replacement_path)); | 2165 &replacement_path)); |
| 2166 PrerenderTestURL(replacement_path, FINAL_STATUS_USED, 1); | 2166 PrerenderTestURL(replacement_path, FINAL_STATUS_USED, 1); |
| 2167 NavigateToDestURL(); | 2167 NavigateToDestURL(); |
| 2168 } | 2168 } |
| 2169 | 2169 |
| 2170 // Checks that an SSL error that comes from an iframe does not cancel | 2170 // Checks that an SSL error that comes from an iframe does not cancel |
| 2171 // the page. Non-main-frame requests are simply cancelled if they run into | 2171 // the page. Non-main-frame requests are simply cancelled if they run into |
| 2172 // an SSL problem. | 2172 // an SSL problem. |
| 2173 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorIframe) { | 2173 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorIframe) { |
| 2174 net::TestServer::SSLOptions ssl_options; | 2174 net::TestServer::SSLOptions ssl_options; |
| 2175 ssl_options.server_certificate = | 2175 ssl_options.server_certificate = |
| 2176 net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; | 2176 net::TestServer::SSLOptions::CERT_MISMATCHED_NAME; |
| 2177 net::TestServer https_server( | 2177 net::TestServer https_server( |
| 2178 net::TestServer::TYPE_HTTPS, ssl_options, | 2178 net::TestServer::TYPE_HTTPS, ssl_options, |
| 2179 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 2179 net::TestServer::GetTestDataPath()); |
| 2180 ASSERT_TRUE(https_server.Start()); | 2180 ASSERT_TRUE(https_server.Start()); |
| 2181 GURL https_url = https_server.GetURL( | 2181 GURL https_url = https_server.GetURL( |
| 2182 "files/prerender/prerender_embedded_content.html"); | 2182 "files/prerender/prerender_embedded_content.html"); |
| 2183 std::vector<net::TestServer::StringPair> replacement_text; | 2183 std::vector<net::TestServer::StringPair> replacement_text; |
| 2184 replacement_text.push_back( | 2184 replacement_text.push_back( |
| 2185 std::make_pair("REPLACE_WITH_URL", https_url.spec())); | 2185 std::make_pair("REPLACE_WITH_URL", https_url.spec())); |
| 2186 std::string replacement_path; | 2186 std::string replacement_path; |
| 2187 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( | 2187 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( |
| 2188 "files/prerender/prerender_with_iframe.html", | 2188 "files/prerender/prerender_with_iframe.html", |
| 2189 replacement_text, | 2189 replacement_text, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2217 FINAL_STATUS_APP_TERMINATING, | 2217 FINAL_STATUS_APP_TERMINATING, |
| 2218 1); | 2218 1); |
| 2219 OpenDestURLViaClickTarget(); | 2219 OpenDestURLViaClickTarget(); |
| 2220 } | 2220 } |
| 2221 | 2221 |
| 2222 // Checks that a top-level page which would normally request an SSL client | 2222 // Checks that a top-level page which would normally request an SSL client |
| 2223 // certificate will never be seen since it's an https top-level resource. | 2223 // certificate will never be seen since it's an https top-level resource. |
| 2224 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLClientCertTopLevel) { | 2224 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLClientCertTopLevel) { |
| 2225 net::TestServer::SSLOptions ssl_options; | 2225 net::TestServer::SSLOptions ssl_options; |
| 2226 ssl_options.request_client_certificate = true; | 2226 ssl_options.request_client_certificate = true; |
| 2227 net::TestServer https_server( | 2227 net::TestServer https_server( |
| 2228 net::TestServer::TYPE_HTTPS, ssl_options, | 2228 net::TestServer::TYPE_HTTPS, ssl_options, |
| 2229 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 2229 net::TestServer::GetTestDataPath()); |
| 2230 ASSERT_TRUE(https_server.Start()); | 2230 ASSERT_TRUE(https_server.Start()); |
| 2231 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); | 2231 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); |
| 2232 PrerenderTestURL(https_url, FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED, 1); | 2232 PrerenderTestURL(https_url, FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED, 1); |
| 2233 } | 2233 } |
| 2234 | 2234 |
| 2235 // Checks that an SSL Client Certificate request that originates from a | 2235 // Checks that an SSL Client Certificate request that originates from a |
| 2236 // subresource will cancel the prerendered page. | 2236 // subresource will cancel the prerendered page. |
| 2237 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 2237 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
| 2238 PrerenderSSLClientCertSubresource) { | 2238 PrerenderSSLClientCertSubresource) { |
| 2239 net::TestServer::SSLOptions ssl_options; | 2239 net::TestServer::SSLOptions ssl_options; |
| 2240 ssl_options.request_client_certificate = true; | 2240 ssl_options.request_client_certificate = true; |
| 2241 net::TestServer https_server( | 2241 net::TestServer https_server( |
| 2242 net::TestServer::TYPE_HTTPS, ssl_options, | 2242 net::TestServer::TYPE_HTTPS, ssl_options, |
| 2243 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 2243 net::TestServer::GetTestDataPath()); |
| 2244 ASSERT_TRUE(https_server.Start()); | 2244 ASSERT_TRUE(https_server.Start()); |
| 2245 GURL https_url = https_server.GetURL("files/prerender/image.jpeg"); | 2245 GURL https_url = https_server.GetURL("files/prerender/image.jpeg"); |
| 2246 std::vector<net::TestServer::StringPair> replacement_text; | 2246 std::vector<net::TestServer::StringPair> replacement_text; |
| 2247 replacement_text.push_back( | 2247 replacement_text.push_back( |
| 2248 std::make_pair("REPLACE_WITH_IMAGE_URL", https_url.spec())); | 2248 std::make_pair("REPLACE_WITH_IMAGE_URL", https_url.spec())); |
| 2249 std::string replacement_path; | 2249 std::string replacement_path; |
| 2250 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( | 2250 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( |
| 2251 "files/prerender/prerender_with_image.html", | 2251 "files/prerender/prerender_with_image.html", |
| 2252 replacement_text, | 2252 replacement_text, |
| 2253 &replacement_path)); | 2253 &replacement_path)); |
| 2254 PrerenderTestURL(replacement_path, | 2254 PrerenderTestURL(replacement_path, |
| 2255 FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED, | 2255 FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED, |
| 2256 1); | 2256 1); |
| 2257 } | 2257 } |
| 2258 | 2258 |
| 2259 // Checks that an SSL Client Certificate request that originates from an | 2259 // Checks that an SSL Client Certificate request that originates from an |
| 2260 // iframe will cancel the prerendered page. | 2260 // iframe will cancel the prerendered page. |
| 2261 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLClientCertIframe) { | 2261 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLClientCertIframe) { |
| 2262 net::TestServer::SSLOptions ssl_options; | 2262 net::TestServer::SSLOptions ssl_options; |
| 2263 ssl_options.request_client_certificate = true; | 2263 ssl_options.request_client_certificate = true; |
| 2264 net::TestServer https_server( | 2264 net::TestServer https_server( |
| 2265 net::TestServer::TYPE_HTTPS, ssl_options, | 2265 net::TestServer::TYPE_HTTPS, ssl_options, |
| 2266 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 2266 net::TestServer::GetTestDataPath()); |
| 2267 ASSERT_TRUE(https_server.Start()); | 2267 ASSERT_TRUE(https_server.Start()); |
| 2268 GURL https_url = https_server.GetURL( | 2268 GURL https_url = https_server.GetURL( |
| 2269 "files/prerender/prerender_embedded_content.html"); | 2269 "files/prerender/prerender_embedded_content.html"); |
| 2270 std::vector<net::TestServer::StringPair> replacement_text; | 2270 std::vector<net::TestServer::StringPair> replacement_text; |
| 2271 replacement_text.push_back( | 2271 replacement_text.push_back( |
| 2272 std::make_pair("REPLACE_WITH_URL", https_url.spec())); | 2272 std::make_pair("REPLACE_WITH_URL", https_url.spec())); |
| 2273 std::string replacement_path; | 2273 std::string replacement_path; |
| 2274 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( | 2274 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( |
| 2275 "files/prerender/prerender_with_iframe.html", | 2275 "files/prerender/prerender_with_iframe.html", |
| 2276 replacement_text, | 2276 replacement_text, |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2725 channel_close_watcher.WatchChannel(browser()->tab_strip_model()-> | 2725 channel_close_watcher.WatchChannel(browser()->tab_strip_model()-> |
| 2726 GetActiveWebContents()->GetRenderProcessHost()); | 2726 GetActiveWebContents()->GetRenderProcessHost()); |
| 2727 NavigateToDestURL(); | 2727 NavigateToDestURL(); |
| 2728 channel_close_watcher.WaitForChannelClose(); | 2728 channel_close_watcher.WaitForChannelClose(); |
| 2729 | 2729 |
| 2730 ASSERT_TRUE(IsEmptyPrerenderLinkManager()); | 2730 ASSERT_TRUE(IsEmptyPrerenderLinkManager()); |
| 2731 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 2731 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 2732 } | 2732 } |
| 2733 | 2733 |
| 2734 } // namespace prerender | 2734 } // namespace prerender |
| OLD | NEW |