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

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

Issue 2304953002: NoState Prefetch: nostate prefetch browser tests. (Closed)
Patch Set: All browser tests added and cleaned up for prefetch-specific issues. Created 4 years, 3 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 <stddef.h> 5 #include <stddef.h>
6 #include <deque> 6 #include <deque>
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <unordered_map> 9 #include <unordered_map>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ref_counted_memory.h" 17 #include "base/memory/ref_counted_memory.h"
18 #include "base/memory/scoped_vector.h" 18 #include "base/memory/scoped_vector.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/path_service.h" 20 #include "base/path_service.h"
21 #include "base/run_loop.h" 21 #include "base/run_loop.h"
22 #include "base/scoped_observer.h" 22 #include "base/scoped_observer.h"
23 #include "base/stl_util.h" 23 #include "base/stl_util.h"
24 #include "base/strings/string_split.h" 24 #include "base/strings/string_split.h"
25 #include "base/strings/string_util.h" 25 #include "base/strings/string_util.h"
26 #include "base/strings/stringprintf.h" 26 #include "base/strings/stringprintf.h"
27 #include "base/strings/utf_string_conversions.h" 27 #include "base/strings/utf_string_conversions.h"
28 #include "base/test/histogram_tester.h"
29 #include "base/test/test_timeouts.h" 28 #include "base/test/test_timeouts.h"
30 #include "base/values.h" 29 #include "base/values.h"
31 #include "build/build_config.h" 30 #include "build/build_config.h"
32 #include "chrome/browser/browsing_data/browsing_data_helper.h" 31 #include "chrome/browser/browsing_data/browsing_data_helper.h"
33 #include "chrome/browser/browsing_data/browsing_data_remover.h" 32 #include "chrome/browser/browsing_data/browsing_data_remover.h"
34 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" 33 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
35 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" 34 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h"
36 #include "chrome/browser/chrome_content_browser_client.h" 35 #include "chrome/browser/chrome_content_browser_client.h"
37 #include "chrome/browser/chrome_notification_types.h" 36 #include "chrome/browser/chrome_notification_types.h"
38 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 37 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
(...skipping 18 matching lines...) Expand all
57 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" 56 #include "chrome/browser/task_manager/task_manager_browsertest_util.h"
58 #include "chrome/browser/ui/browser.h" 57 #include "chrome/browser/ui/browser.h"
59 #include "chrome/browser/ui/browser_commands.h" 58 #include "chrome/browser/ui/browser_commands.h"
60 #include "chrome/browser/ui/browser_finder.h" 59 #include "chrome/browser/ui/browser_finder.h"
61 #include "chrome/browser/ui/browser_window.h" 60 #include "chrome/browser/ui/browser_window.h"
62 #include "chrome/browser/ui/location_bar/location_bar.h" 61 #include "chrome/browser/ui/location_bar/location_bar.h"
63 #include "chrome/browser/ui/tabs/tab_strip_model.h" 62 #include "chrome/browser/ui/tabs/tab_strip_model.h"
64 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" 63 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
65 #include "chrome/common/chrome_paths.h" 64 #include "chrome/common/chrome_paths.h"
66 #include "chrome/common/chrome_switches.h" 65 #include "chrome/common/chrome_switches.h"
67 #include "chrome/grit/generated_resources.h"
68 #include "chrome/test/base/ui_test_utils.h" 66 #include "chrome/test/base/ui_test_utils.h"
69 #include "components/content_settings/core/browser/host_content_settings_map.h" 67 #include "components/content_settings/core/browser/host_content_settings_map.h"
70 #include "components/favicon/content/content_favicon_driver.h" 68 #include "components/favicon/content/content_favicon_driver.h"
71 #include "components/favicon/core/favicon_driver_observer.h" 69 #include "components/favicon/core/favicon_driver_observer.h"
72 #include "components/omnibox/browser/omnibox_edit_model.h" 70 #include "components/omnibox/browser/omnibox_edit_model.h"
73 #include "components/omnibox/browser/omnibox_popup_model.h" 71 #include "components/omnibox/browser/omnibox_popup_model.h"
74 #include "components/omnibox/browser/omnibox_view.h" 72 #include "components/omnibox/browser/omnibox_view.h"
75 #include "components/safe_browsing_db/database_manager.h" 73 #include "components/safe_browsing_db/database_manager.h"
76 #include "components/safe_browsing_db/util.h" 74 #include "components/safe_browsing_db/util.h"
77 #include "components/variations/entropy_provider.h" 75 #include "components/variations/entropy_provider.h"
(...skipping 29 matching lines...) Expand all
107 #include "net/test/cert_test_util.h" 105 #include "net/test/cert_test_util.h"
108 #include "net/test/embedded_test_server/embedded_test_server.h" 106 #include "net/test/embedded_test_server/embedded_test_server.h"
109 #include "net/test/embedded_test_server/request_handler_util.h" 107 #include "net/test/embedded_test_server/request_handler_util.h"
110 #include "net/test/test_data_directory.h" 108 #include "net/test/test_data_directory.h"
111 #include "net/url_request/url_request_context.h" 109 #include "net/url_request/url_request_context.h"
112 #include "net/url_request/url_request_context_getter.h" 110 #include "net/url_request/url_request_context_getter.h"
113 #include "net/url_request/url_request_filter.h" 111 #include "net/url_request/url_request_filter.h"
114 #include "net/url_request/url_request_job.h" 112 #include "net/url_request/url_request_job.h"
115 #include "testing/gmock/include/gmock/gmock.h" 113 #include "testing/gmock/include/gmock/gmock.h"
116 #include "testing/gtest/include/gtest/gtest.h" 114 #include "testing/gtest/include/gtest/gtest.h"
117 #include "ui/base/l10n/l10n_util.h"
118 #include "url/gurl.h" 115 #include "url/gurl.h"
119 116
120 using chrome_browser_net::NetworkPredictionOptions; 117 using chrome_browser_net::NetworkPredictionOptions;
121 using content::BrowserThread; 118 using content::BrowserThread;
122 using content::DevToolsAgentHost; 119 using content::DevToolsAgentHost;
123 using content::NavigationController; 120 using content::NavigationController;
124 using content::OpenURLParams; 121 using content::OpenURLParams;
125 using content::Referrer; 122 using content::Referrer;
126 using content::RenderFrameHost; 123 using content::RenderFrameHost;
127 using content::RenderViewHost; 124 using content::RenderViewHost;
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 chrome::GoBack(current_browser(), WindowOpenDisposition::CURRENT_TAB); 723 chrome::GoBack(current_browser(), WindowOpenDisposition::CURRENT_TAB);
727 back_nav_observer.Wait(); 724 back_nav_observer.Wait();
728 bool js_result; 725 bool js_result;
729 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 726 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
730 tab, 727 tab,
731 "window.domAutomationController.send(DidBackToOriginalPagePass())", 728 "window.domAutomationController.send(DidBackToOriginalPagePass())",
732 &js_result)); 729 &js_result));
733 EXPECT_TRUE(js_result); 730 EXPECT_TRUE(js_result);
734 } 731 }
735 732
736 void UseHttpsSrcServer() {
737 if (https_src_server_)
738 return;
739 https_src_server_.reset(
740 new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS));
741 https_src_server_->ServeFilesFromSourceDirectory("chrome/test/data");
742 CHECK(https_src_server_->Start());
743 }
744
745 void DisableJavascriptCalls() { 733 void DisableJavascriptCalls() {
746 call_javascript_ = false; 734 call_javascript_ = false;
747 } 735 }
748 736
749 void DisableLoadEventCheck() { 737 void DisableLoadEventCheck() {
750 check_load_events_ = false; 738 check_load_events_ = false;
751 } 739 }
752 740
753 const PrerenderLinkManager* GetPrerenderLinkManager() const { 741 const PrerenderLinkManager* GetPrerenderLinkManager() const {
754 PrerenderLinkManager* prerender_link_manager = 742 PrerenderLinkManager* prerender_link_manager =
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 std::unique_ptr<base::DictionaryValue> prerender_dict = 821 std::unique_ptr<base::DictionaryValue> prerender_dict =
834 GetPrerenderManager()->GetAsValue(); 822 GetPrerenderManager()->GetAsValue();
835 if (!prerender_dict) 823 if (!prerender_dict)
836 return std::numeric_limits<size_t>::max(); 824 return std::numeric_limits<size_t>::max();
837 base::ListValue* history_list; 825 base::ListValue* history_list;
838 if (!prerender_dict->GetList("history", &history_list)) 826 if (!prerender_dict->GetList("history", &history_list))
839 return std::numeric_limits<size_t>::max(); 827 return std::numeric_limits<size_t>::max();
840 return history_list->GetSize(); 828 return history_list->GetSize();
841 } 829 }
842 830
843 test_utils::FakeSafeBrowsingDatabaseManager*
844 GetFakeSafeBrowsingDatabaseManager() {
845 return static_cast<test_utils::FakeSafeBrowsingDatabaseManager*>(
846 safe_browsing_factory()
847 ->test_safe_browsing_service()
848 ->database_manager()
849 .get());
850 }
851
852 void SetLoaderHostOverride(const std::string& host) { 831 void SetLoaderHostOverride(const std::string& host) {
853 loader_host_override_ = host; 832 loader_host_override_ = host;
854 host_resolver()->AddRule(host, "127.0.0.1"); 833 host_resolver()->AddRule(host, "127.0.0.1");
855 } 834 }
856 835
857 void set_loader_path(const std::string& path) { 836 void set_loader_path(const std::string& path) {
858 loader_path_ = path; 837 loader_path_ = path;
859 } 838 }
860 839
861 void set_loader_query(const std::string& query) { 840 void set_loader_query(const std::string& query) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 } 881 }
903 882
904 void AddPrerender(const GURL& url, int index) { 883 void AddPrerender(const GURL& url, int index) {
905 std::string javascript = base::StringPrintf( 884 std::string javascript = base::StringPrintf(
906 "AddPrerender('%s', %d)", url.spec().c_str(), index); 885 "AddPrerender('%s', %d)", url.spec().c_str(), index);
907 RenderFrameHost* render_frame_host = GetActiveWebContents()->GetMainFrame(); 886 RenderFrameHost* render_frame_host = GetActiveWebContents()->GetMainFrame();
908 render_frame_host->ExecuteJavaScriptForTests( 887 render_frame_host->ExecuteJavaScriptForTests(
909 base::ASCIIToUTF16(javascript)); 888 base::ASCIIToUTF16(javascript));
910 } 889 }
911 890
912 // Returns a string for pattern-matching TaskManager tab entries.
913 base::string16 MatchTaskManagerTab(const char* page_title) {
914 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_TAB_PREFIX,
915 base::ASCIIToUTF16(page_title));
916 }
917
918 // Returns a string for pattern-matching TaskManager prerender entries.
919 base::string16 MatchTaskManagerPrerender(const char* page_title) {
920 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PRERENDER_PREFIX,
921 base::ASCIIToUTF16(page_title));
922 }
923
924 const base::HistogramTester& histogram_tester() { return histogram_tester_; }
925
926 private: 891 private:
927 // TODO(davidben): Remove this altogether so the tests don't globally assume 892 // TODO(davidben): Remove this altogether so the tests don't globally assume
928 // only one prerender. 893 // only one prerender.
929 TestPrerenderContents* GetPrerenderContents() const { 894 TestPrerenderContents* GetPrerenderContents() const {
930 return GetPrerenderContentsFor(dest_url_); 895 return GetPrerenderContentsFor(dest_url_);
931 } 896 }
932 897
933 ScopedVector<TestPrerender> PrerenderTestURLImpl( 898 ScopedVector<TestPrerender> PrerenderTestURLImpl(
934 const GURL& prerender_url, 899 const GURL& prerender_url,
935 const std::vector<FinalStatus>& expected_final_status_queue, 900 const std::vector<FinalStatus>& expected_final_status_queue,
936 int expected_number_of_loads) override { 901 int expected_number_of_loads) override {
937 dest_url_ = prerender_url; 902 dest_url_ = prerender_url;
938 903
939 base::StringPairs replacement_text; 904 base::StringPairs replacement_text;
940 replacement_text.push_back( 905 replacement_text.push_back(
941 make_pair("REPLACE_WITH_PRERENDER_URL", prerender_url.spec())); 906 make_pair("REPLACE_WITH_PRERENDER_URL", prerender_url.spec()));
942 std::string replacement_path; 907 std::string replacement_path;
943 net::test_server::GetFilePathWithReplacements( 908 net::test_server::GetFilePathWithReplacements(
944 loader_path_, replacement_text, &replacement_path); 909 loader_path_, replacement_text, &replacement_path);
945 910
946 const net::EmbeddedTestServer* src_server = embedded_test_server(); 911 GURL loader_url =
947 if (https_src_server_) 912 src_server()->GetURL(replacement_path + "&" + loader_query_);
948 src_server = https_src_server_.get();
949 GURL loader_url = src_server->GetURL(
950 replacement_path + "&" + loader_query_);
951 913
952 GURL::Replacements loader_replacements; 914 GURL::Replacements loader_replacements;
953 if (!loader_host_override_.empty()) 915 if (!loader_host_override_.empty())
954 loader_replacements.SetHostStr(loader_host_override_); 916 loader_replacements.SetHostStr(loader_host_override_);
955 loader_url = loader_url.ReplaceComponents(loader_replacements); 917 loader_url = loader_url.ReplaceComponents(loader_replacements);
956 918
957 CHECK(!expected_final_status_queue.empty()); 919 ScopedVector<TestPrerender> prerenders = NavigateWithPrerenders(
958 ScopedVector<TestPrerender> prerenders; 920 loader_url, expected_final_status_queue, expected_number_of_loads);
959 for (size_t i = 0; i < expected_final_status_queue.size(); i++) {
960 prerenders.push_back(
961 prerender_contents_factory()
962 ->ExpectPrerenderContents(expected_final_status_queue[i])
963 .release());
964 }
965 921
966 FinalStatus expected_final_status = expected_final_status_queue.front(); 922 FinalStatus expected_final_status = expected_final_status_queue.front();
967
968 // Navigate to the loader URL and then wait for the first prerender to be
969 // created.
970 ui_test_utils::NavigateToURL(current_browser(), loader_url);
971 prerenders[0]->WaitForCreate();
972 prerenders[0]->WaitForLoads(expected_number_of_loads);
973
974 if (ShouldAbortPrerenderBeforeSwap(expected_final_status)) { 923 if (ShouldAbortPrerenderBeforeSwap(expected_final_status)) {
975 // The prerender will abort on its own. Assert it does so correctly. 924 // The prerender will abort on its own. Assert it does so correctly.
976 prerenders[0]->WaitForStop(); 925 prerenders[0]->WaitForStop();
977 EXPECT_FALSE(prerenders[0]->contents()); 926 EXPECT_FALSE(prerenders[0]->contents());
978 EXPECT_TRUE(DidReceivePrerenderStopEventForLinkNumber(0)); 927 EXPECT_TRUE(DidReceivePrerenderStopEventForLinkNumber(0));
979 } else { 928 } else {
980 // Otherwise, check that it prerendered correctly. 929 // Otherwise, check that it prerendered correctly.
981 TestPrerenderContents* prerender_contents = prerenders[0]->contents(); 930 TestPrerenderContents* prerender_contents = prerenders[0]->contents();
982 CHECK(prerender_contents); 931 CHECK(prerender_contents);
983 EXPECT_EQ(FINAL_STATUS_MAX, prerender_contents->final_status()); 932 EXPECT_EQ(FINAL_STATUS_MAX, prerender_contents->final_status());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 } else { 998 } else {
1050 NavigationOrSwapObserver observer(current_browser()->tab_strip_model(), 999 NavigationOrSwapObserver observer(current_browser()->tab_strip_model(),
1051 web_contents); 1000 web_contents);
1052 render_frame_host->ExecuteJavaScriptForTests( 1001 render_frame_host->ExecuteJavaScriptForTests(
1053 base::ASCIIToUTF16(javascript)); 1002 base::ASCIIToUTF16(javascript));
1054 observer.Wait(); 1003 observer.Wait();
1055 } 1004 }
1056 } 1005 }
1057 1006
1058 GURL dest_url_; 1007 GURL dest_url_;
1059 std::unique_ptr<net::EmbeddedTestServer> https_src_server_;
1060 bool call_javascript_; 1008 bool call_javascript_;
1061 bool check_load_events_; 1009 bool check_load_events_;
1062 std::string loader_host_override_; 1010 std::string loader_host_override_;
1063 std::string loader_path_; 1011 std::string loader_path_;
1064 std::string loader_query_; 1012 std::string loader_query_;
1065 base::HistogramTester histogram_tester_;
1066 }; 1013 };
1067 1014
1068 // Checks that a page is correctly prerendered in the case of a 1015 // Checks that a page is correctly prerendered in the case of a
1069 // <link rel=prerender> tag and then loaded into a tab in response to a 1016 // <link rel=prerender> tag and then loaded into a tab in response to a
1070 // navigation. 1017 // navigation.
1071 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPage) { 1018 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPage) {
1072 PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_USED, 1); 1019 PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
1073 EXPECT_EQ(1, GetPrerenderDomContentLoadedEventCountForLinkNumber(0)); 1020 EXPECT_EQ(1, GetPrerenderDomContentLoadedEventCountForLinkNumber(0));
1074 histogram_tester().ExpectTotalCount("Prerender.none_PerceivedPLT", 1); 1021 histogram_tester().ExpectTotalCount("Prerender.none_PerceivedPLT", 1);
1075 histogram_tester().ExpectTotalCount("Prerender.none_PerceivedPLTMatched", 0); 1022 histogram_tester().ExpectTotalCount("Prerender.none_PerceivedPLTMatched", 0);
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderReferrer) { 1603 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderReferrer) {
1657 PrerenderTestURL("/prerender/prerender_referrer.html", FINAL_STATUS_USED, 1); 1604 PrerenderTestURL("/prerender/prerender_referrer.html", FINAL_STATUS_USED, 1);
1658 NavigateToDestURL(); 1605 NavigateToDestURL();
1659 } 1606 }
1660 1607
1661 // Checks that the referrer is not set when prerendering and the source page is 1608 // Checks that the referrer is not set when prerendering and the source page is
1662 // HTTPS. 1609 // HTTPS.
1663 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, 1610 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
1664 PrerenderNoSSLReferrer) { 1611 PrerenderNoSSLReferrer) {
1665 UseHttpsSrcServer(); 1612 UseHttpsSrcServer();
1666 PrerenderTestURL("/prerender/prerender_no_referrer.html", FINAL_STATUS_USED, 1613 // Use non-https url for first page.
1667 1); 1614 GURL url(
1615 embedded_test_server()->GetURL("/prerender/prerender_no_referrer.html"));
1616 PrerenderTestURL(url, FINAL_STATUS_USED, 1);
1668 NavigateToDestURL(); 1617 NavigateToDestURL();
1669 } 1618 }
1670 1619
1671 // Checks that the referrer is set when prerendering is cancelled. 1620 // Checks that the referrer is set when prerendering is cancelled.
1672 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelReferrer) { 1621 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelReferrer) {
1673 std::unique_ptr<TestContentBrowserClient> test_content_browser_client( 1622 std::unique_ptr<TestContentBrowserClient> test_content_browser_client(
1674 new TestContentBrowserClient); 1623 new TestContentBrowserClient);
1675 content::ContentBrowserClient* original_browser_client = 1624 content::ContentBrowserClient* original_browser_client =
1676 content::SetBrowserClientForTesting(test_content_browser_client.get()); 1625 content::SetBrowserClientForTesting(test_content_browser_client.get());
1677 1626
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
2142 } 2091 }
2143 2092
2144 // Checks that xhr DELETE cancels prerenders. 2093 // Checks that xhr DELETE cancels prerenders.
2145 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderXhrDelete) { 2094 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderXhrDelete) {
2146 PrerenderTestURL("/prerender/prerender_xhr_delete.html", 2095 PrerenderTestURL("/prerender/prerender_xhr_delete.html",
2147 FINAL_STATUS_INVALID_HTTP_METHOD, 1); 2096 FINAL_STATUS_INVALID_HTTP_METHOD, 1);
2148 } 2097 }
2149 2098
2150 // Checks that a top-level page which would trigger an SSL error is canceled. 2099 // Checks that a top-level page which would trigger an SSL error is canceled.
2151 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorTopLevel) { 2100 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorTopLevel) {
2101 // We only send the loaded page, not the loader, through SSL.
2152 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); 2102 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
2153 https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME); 2103 https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
2154 https_server.ServeFilesFromSourceDirectory("chrome/test/data"); 2104 https_server.ServeFilesFromSourceDirectory("chrome/test/data");
2155 ASSERT_TRUE(https_server.Start()); 2105 ASSERT_TRUE(https_server.Start());
2156 GURL https_url = https_server.GetURL("/prerender/prerender_page.html"); 2106 GURL https_url = https_server.GetURL("/prerender/prerender_page.html");
2157 PrerenderTestURL(https_url, 2107 PrerenderTestURL(https_url, FINAL_STATUS_SSL_ERROR, 0);
2158 FINAL_STATUS_SSL_ERROR,
2159 0);
2160 } 2108 }
2161 2109
2162 // Checks that an SSL error that comes from a subresource does not cancel 2110 // Checks that an SSL error that comes from a subresource does not cancel
2163 // the page. Non-main-frame requests are simply cancelled if they run into 2111 // the page. Non-main-frame requests are simply cancelled if they run into
2164 // an SSL problem. 2112 // an SSL problem.
2165 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorSubresource) { 2113 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLErrorSubresource) {
2166 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); 2114 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
2167 https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME); 2115 https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_MISMATCHED_NAME);
2168 https_server.ServeFilesFromSourceDirectory("chrome/test/data"); 2116 https_server.ServeFilesFromSourceDirectory("chrome/test/data");
2169 ASSERT_TRUE(https_server.Start()); 2117 ASSERT_TRUE(https_server.Start());
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
3361 browser()->tab_strip_model()->GetActiveWebContents(); 3309 browser()->tab_strip_model()->GetActiveWebContents();
3362 bool display_test_result = false; 3310 bool display_test_result = false;
3363 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents, 3311 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents,
3364 "DidDisplayReallyPass()", 3312 "DidDisplayReallyPass()",
3365 &display_test_result)); 3313 &display_test_result));
3366 ASSERT_TRUE(display_test_result); 3314 ASSERT_TRUE(display_test_result);
3367 } 3315 }
3368 #endif // !defined(DISABLE_NACL) 3316 #endif // !defined(DISABLE_NACL)
3369 3317
3370 } // namespace prerender 3318 } // namespace prerender
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_contents.h » ('j') | chrome/browser/prerender/prerender_contents.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698