Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(902)

Side by Side Diff: chrome/browser/prerender/prerender_browsertest.cc

Issue 9372065: Update clients to use new TestServer constructor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove files that were reviewed and committed separately. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( 701 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements(
702 loader_path_, 702 loader_path_,
703 replacement_text, 703 replacement_text,
704 &replacement_path)); 704 &replacement_path));
705 705
706 net::TestServer* src_server = test_server(); 706 net::TestServer* src_server = test_server();
707 scoped_ptr<net::TestServer> https_src_server; 707 scoped_ptr<net::TestServer> https_src_server;
708 if (use_https_src_server_) { 708 if (use_https_src_server_) {
709 https_src_server.reset( 709 https_src_server.reset(
710 new net::TestServer(net::TestServer::TYPE_HTTPS, 710 new net::TestServer(net::TestServer::TYPE_HTTPS,
711 net::TestServer::kLocalhost,
711 FilePath(FILE_PATH_LITERAL("chrome/test/data")))); 712 FilePath(FILE_PATH_LITERAL("chrome/test/data"))));
712 ASSERT_TRUE(https_src_server->Start()); 713 ASSERT_TRUE(https_src_server->Start());
713 src_server = https_src_server.get(); 714 src_server = https_src_server.get();
714 } 715 }
715 GURL src_url = src_server->GetURL(replacement_path); 716 GURL src_url = src_server->GetURL(replacement_path);
716 717
717 ASSERT_TRUE(prerender_manager()); 718 ASSERT_TRUE(prerender_manager());
718 prerender_manager()->mutable_config().rate_limit_enabled = false; 719 prerender_manager()->mutable_config().rate_limit_enabled = false;
719 prerender_manager()->mutable_config().https_allowed = true; 720 prerender_manager()->mutable_config().https_allowed = true;
720 ASSERT_TRUE(prerender_contents_factory_ == NULL); 721 ASSERT_TRUE(prerender_contents_factory_ == NULL);
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 PrerenderClientRedirectNavigateToSecond) { 962 PrerenderClientRedirectNavigateToSecond) {
962 PrerenderTestURL(CreateClientRedirect("files/prerender/prerender_page.html"), 963 PrerenderTestURL(CreateClientRedirect("files/prerender/prerender_page.html"),
963 FINAL_STATUS_USED, 964 FINAL_STATUS_USED,
964 2); 965 2);
965 NavigateToURL("files/prerender/prerender_page.html"); 966 NavigateToURL("files/prerender/prerender_page.html");
966 } 967 }
967 968
968 // Checks that a prerender for an https will prevent a prerender from happening. 969 // Checks that a prerender for an https will prevent a prerender from happening.
969 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHttps) { 970 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHttps) {
970 net::TestServer https_server(net::TestServer::TYPE_HTTPS, 971 net::TestServer https_server(net::TestServer::TYPE_HTTPS,
972 net::TestServer::kLocalhost,
971 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); 973 FilePath(FILE_PATH_LITERAL("chrome/test/data")));
972 ASSERT_TRUE(https_server.Start()); 974 ASSERT_TRUE(https_server.Start());
973 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); 975 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html");
974 PrerenderTestURL(https_url, 976 PrerenderTestURL(https_url,
975 FINAL_STATUS_USED, 977 FINAL_STATUS_USED,
976 1); 978 1);
977 NavigateToDestURL(); 979 NavigateToDestURL();
978 } 980 }
979 981
980 // Checks that client-issued redirects to an https page will cancel prerenders. 982 // Checks that client-issued redirects to an https page will cancel prerenders.
981 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClientRedirectToHttps) { 983 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClientRedirectToHttps) {
982 net::TestServer https_server(net::TestServer::TYPE_HTTPS, 984 net::TestServer https_server(net::TestServer::TYPE_HTTPS,
985 net::TestServer::kLocalhost,
983 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); 986 FilePath(FILE_PATH_LITERAL("chrome/test/data")));
984 ASSERT_TRUE(https_server.Start()); 987 ASSERT_TRUE(https_server.Start());
985 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); 988 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html");
986 PrerenderTestURL(CreateClientRedirect(https_url.spec()), 989 PrerenderTestURL(CreateClientRedirect(https_url.spec()),
987 FINAL_STATUS_USED, 990 FINAL_STATUS_USED,
988 2); 991 2);
989 NavigateToDestURL(); 992 NavigateToDestURL();
990 } 993 }
991 994
992 // Checks that client-issued redirects within an iframe in a prerendered 995 // Checks that client-issued redirects within an iframe in a prerendered
(...skipping 14 matching lines...) Expand all
1007 "files/prerender/prerender_embedded_content.html")); 1010 "files/prerender/prerender_embedded_content.html"));
1008 NavigateToDestURL(); 1011 NavigateToDestURL();
1009 } 1012 }
1010 1013
1011 // Checks that client-issued redirects within an iframe in a prerendered 1014 // Checks that client-issued redirects within an iframe in a prerendered
1012 // page to an https page will not cancel the prerender, nor will it 1015 // page to an https page will not cancel the prerender, nor will it
1013 // count as an "alias" for the prerendered page. 1016 // count as an "alias" for the prerendered page.
1014 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, 1017 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
1015 PrerenderClientRedirectToHttpsInIframe) { 1018 PrerenderClientRedirectToHttpsInIframe) {
1016 net::TestServer https_server(net::TestServer::TYPE_HTTPS, 1019 net::TestServer https_server(net::TestServer::TYPE_HTTPS,
1020 net::TestServer::kLocalhost,
1017 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); 1021 FilePath(FILE_PATH_LITERAL("chrome/test/data")));
1018 ASSERT_TRUE(https_server.Start()); 1022 ASSERT_TRUE(https_server.Start());
1019 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); 1023 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html");
1020 std::string redirect_path = CreateClientRedirect(https_url.spec()); 1024 std::string redirect_path = CreateClientRedirect(https_url.spec());
1021 std::vector<net::TestServer::StringPair> replacement_text; 1025 std::vector<net::TestServer::StringPair> replacement_text;
1022 replacement_text.push_back( 1026 replacement_text.push_back(
1023 std::make_pair("REPLACE_WITH_URL", "/" + redirect_path)); 1027 std::make_pair("REPLACE_WITH_URL", "/" + redirect_path));
1024 std::string replacement_path; 1028 std::string replacement_path;
1025 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( 1029 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements(
1026 "files/prerender/prerender_with_iframe.html", 1030 "files/prerender/prerender_with_iframe.html",
(...skipping 24 matching lines...) Expand all
1051 FINAL_STATUS_USED, 1055 FINAL_STATUS_USED,
1052 1); 1056 1);
1053 NavigateToURL("files/prerender/prerender_page.html"); 1057 NavigateToURL("files/prerender/prerender_page.html");
1054 } 1058 }
1055 1059
1056 // Checks that server-issued redirects from an http to an https 1060 // Checks that server-issued redirects from an http to an https
1057 // location will cancel prerendering. 1061 // location will cancel prerendering.
1058 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, 1062 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
1059 PrerenderServerRedirectToHttps) { 1063 PrerenderServerRedirectToHttps) {
1060 net::TestServer https_server(net::TestServer::TYPE_HTTPS, 1064 net::TestServer https_server(net::TestServer::TYPE_HTTPS,
1065 net::TestServer::kLocalhost,
1061 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); 1066 FilePath(FILE_PATH_LITERAL("chrome/test/data")));
1062 ASSERT_TRUE(https_server.Start()); 1067 ASSERT_TRUE(https_server.Start());
1063 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); 1068 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html");
1064 PrerenderTestURL(CreateServerRedirect(https_url.spec()), 1069 PrerenderTestURL(CreateServerRedirect(https_url.spec()),
1065 FINAL_STATUS_USED, 1070 FINAL_STATUS_USED,
1066 1); 1071 1);
1067 NavigateToDestURL(); 1072 NavigateToDestURL();
1068 } 1073 }
1069 1074
1070 // Checks that server-issued redirects within an iframe in a prerendered 1075 // Checks that server-issued redirects within an iframe in a prerendered
(...skipping 14 matching lines...) Expand all
1085 "files/prerender/prerender_embedded_content.html")); 1090 "files/prerender/prerender_embedded_content.html"));
1086 NavigateToDestURL(); 1091 NavigateToDestURL();
1087 } 1092 }
1088 1093
1089 // Checks that server-issued redirects within an iframe in a prerendered 1094 // Checks that server-issued redirects within an iframe in a prerendered
1090 // page to an https page will not cancel the prerender, nor will it 1095 // page to an https page will not cancel the prerender, nor will it
1091 // count as an "alias" for the prerendered page. 1096 // count as an "alias" for the prerendered page.
1092 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, 1097 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
1093 PrerenderServerRedirectToHttpsInIframe) { 1098 PrerenderServerRedirectToHttpsInIframe) {
1094 net::TestServer https_server(net::TestServer::TYPE_HTTPS, 1099 net::TestServer https_server(net::TestServer::TYPE_HTTPS,
1100 net::TestServer::kLocalhost,
1095 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); 1101 FilePath(FILE_PATH_LITERAL("chrome/test/data")));
1096 ASSERT_TRUE(https_server.Start()); 1102 ASSERT_TRUE(https_server.Start());
1097 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); 1103 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html");
1098 std::string redirect_path = CreateServerRedirect(https_url.spec()); 1104 std::string redirect_path = CreateServerRedirect(https_url.spec());
1099 std::vector<net::TestServer::StringPair> replacement_text; 1105 std::vector<net::TestServer::StringPair> replacement_text;
1100 replacement_text.push_back( 1106 replacement_text.push_back(
1101 std::make_pair("REPLACE_WITH_URL", "/" + redirect_path)); 1107 std::make_pair("REPLACE_WITH_URL", "/" + redirect_path));
1102 std::string replacement_path; 1108 std::string replacement_path;
1103 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements( 1109 ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements(
1104 "files/prerender/prerender_with_iframe.html", 1110 "files/prerender/prerender_with_iframe.html",
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1940 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, MatchCompleteDummy) { 1946 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, MatchCompleteDummy) {
1941 std::deque<FinalStatus> expected_final_status_queue; 1947 std::deque<FinalStatus> expected_final_status_queue;
1942 expected_final_status_queue.push_back(FINAL_STATUS_JAVASCRIPT_ALERT); 1948 expected_final_status_queue.push_back(FINAL_STATUS_JAVASCRIPT_ALERT);
1943 expected_final_status_queue.push_back(FINAL_STATUS_WOULD_HAVE_BEEN_USED); 1949 expected_final_status_queue.push_back(FINAL_STATUS_WOULD_HAVE_BEEN_USED);
1944 PrerenderTestURL("files/prerender/prerender_alert_before_onload.html", 1950 PrerenderTestURL("files/prerender/prerender_alert_before_onload.html",
1945 expected_final_status_queue, 1); 1951 expected_final_status_queue, 1);
1946 NavigateToDestURL(); 1952 NavigateToDestURL();
1947 } 1953 }
1948 1954
1949 } // namespace prerender 1955 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/notifications/notifications_interactive_uitest.cc ('k') | chrome/browser/referrer_policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698