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/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 case FINAL_STATUS_DEVTOOLS_ATTACHED: | 150 case FINAL_STATUS_DEVTOOLS_ATTACHED: |
151 case FINAL_STATUS_PAGE_BEING_CAPTURED: | 151 case FINAL_STATUS_PAGE_BEING_CAPTURED: |
152 case FINAL_STATUS_NAVIGATION_UNCOMMITTED: | 152 case FINAL_STATUS_NAVIGATION_UNCOMMITTED: |
153 case FINAL_STATUS_WOULD_HAVE_BEEN_USED: | 153 case FINAL_STATUS_WOULD_HAVE_BEEN_USED: |
154 return false; | 154 return false; |
155 default: | 155 default: |
156 return true; | 156 return true; |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 // Convenience function to wait for a title. Handles the case when the | |
161 // WebContents already has the expected title. | |
162 void WaitForASCIITitle(WebContents* web_contents, | |
163 const char* expected_title_ascii) { | |
164 base::string16 expected_title = base::ASCIIToUTF16(expected_title_ascii); | |
165 if (web_contents->GetTitle() == expected_title) | |
166 return; | |
167 content::TitleWatcher title_watcher(web_contents, expected_title); | |
168 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | |
169 } | |
170 | |
160 // Waits for the destruction of a RenderProcessHost's IPC channel. | 171 // Waits for the destruction of a RenderProcessHost's IPC channel. |
161 // Used to make sure the PrerenderLinkManager's OnChannelClosed function has | 172 // Used to make sure the PrerenderLinkManager's OnChannelClosed function has |
162 // been called, before checking its state. | 173 // been called, before checking its state. |
163 class ChannelDestructionWatcher { | 174 class ChannelDestructionWatcher { |
164 public: | 175 public: |
165 ChannelDestructionWatcher() : channel_destroyed_(false) { | 176 ChannelDestructionWatcher() : channel_destroyed_(false) { |
166 } | 177 } |
167 | 178 |
168 ~ChannelDestructionWatcher() { | 179 ~ChannelDestructionWatcher() { |
169 } | 180 } |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
369 | 380 |
370 virtual void AddPendingPrerender( | 381 virtual void AddPendingPrerender( |
371 scoped_ptr<PendingPrerenderInfo> pending_prerender_info) OVERRIDE { | 382 scoped_ptr<PendingPrerenderInfo> pending_prerender_info) OVERRIDE { |
372 PrerenderContents::AddPendingPrerender(pending_prerender_info.Pass()); | 383 PrerenderContents::AddPendingPrerender(pending_prerender_info.Pass()); |
373 if (expected_pending_prerenders_ > 0 && | 384 if (expected_pending_prerenders_ > 0 && |
374 pending_prerender_count() == expected_pending_prerenders_) { | 385 pending_prerender_count() == expected_pending_prerenders_) { |
375 base::MessageLoop::current()->Quit(); | 386 base::MessageLoop::current()->Quit(); |
376 } | 387 } |
377 } | 388 } |
378 | 389 |
379 virtual WebContents* CreateWebContents( | |
380 content::SessionStorageNamespace* session_storage_namespace) OVERRIDE { | |
mmenke
2014/01/17 22:00:38
PrerenderContents::CreateWebContents need no longe
davidben
2014/01/17 22:32:04
Ooh, forgot about that. Done.
| |
381 WebContents* web_contents = PrerenderContents::CreateWebContents( | |
382 session_storage_namespace); | |
383 // Create a ready title watcher. (May or may not be used.) | |
384 base::string16 ready_title = base::ASCIIToUTF16(kReadyTitle); | |
385 ready_title_watcher_.reset(new content::TitleWatcher( | |
386 web_contents, ready_title)); | |
387 return web_contents; | |
388 } | |
389 | |
390 void WaitForPrerenderToHaveReadyTitle() { | |
391 base::string16 ready_title = base::ASCIIToUTF16(kReadyTitle); | |
392 ASSERT_EQ(ready_title, ready_title_watcher_->WaitAndGetTitle()); | |
393 } | |
394 | |
395 // Waits until the prerender has |expected_pending_prerenders| pending | 390 // Waits until the prerender has |expected_pending_prerenders| pending |
396 // prerenders. | 391 // prerenders. |
397 void WaitForPendingPrerenders(size_t expected_pending_prerenders) { | 392 void WaitForPendingPrerenders(size_t expected_pending_prerenders) { |
398 if (pending_prerender_count() < expected_pending_prerenders) { | 393 if (pending_prerender_count() < expected_pending_prerenders) { |
399 expected_pending_prerenders_ = expected_pending_prerenders; | 394 expected_pending_prerenders_ = expected_pending_prerenders; |
400 content::RunMessageLoop(); | 395 content::RunMessageLoop(); |
401 expected_pending_prerenders_ = 0; | 396 expected_pending_prerenders_ = 0; |
402 } | 397 } |
403 | 398 |
404 EXPECT_EQ(expected_pending_prerenders, pending_prerender_count()); | 399 EXPECT_EQ(expected_pending_prerenders, pending_prerender_count()); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
457 // Set to true when the prerendering RenderWidget is shown, after having been | 452 // Set to true when the prerendering RenderWidget is shown, after having been |
458 // hidden. | 453 // hidden. |
459 bool was_shown_; | 454 bool was_shown_; |
460 // Expected final value of was_shown_. Defaults to true for | 455 // Expected final value of was_shown_. Defaults to true for |
461 // FINAL_STATUS_USED, and false otherwise. | 456 // FINAL_STATUS_USED, and false otherwise. |
462 bool should_be_shown_; | 457 bool should_be_shown_; |
463 | 458 |
464 // Total number of pending prerenders we're currently waiting for. Zero | 459 // Total number of pending prerenders we're currently waiting for. Zero |
465 // indicates we currently aren't waiting for any. | 460 // indicates we currently aren't waiting for any. |
466 size_t expected_pending_prerenders_; | 461 size_t expected_pending_prerenders_; |
467 | |
468 // Will wait for the title of the prerendered page to turn to "READY". | |
469 scoped_ptr<content::TitleWatcher> ready_title_watcher_; | |
470 }; | 462 }; |
471 | 463 |
472 // A handle to a TestPrerenderContents whose lifetime is under the caller's | 464 // A handle to a TestPrerenderContents whose lifetime is under the caller's |
473 // control. A PrerenderContents may be destroyed at any point. This allows | 465 // control. A PrerenderContents may be destroyed at any point. This allows |
474 // tracking the final status, etc. | 466 // tracking the final status, etc. |
475 class TestPrerender : public PrerenderContents::Observer, | 467 class TestPrerender : public PrerenderContents::Observer, |
476 public base::SupportsWeakPtr<TestPrerender> { | 468 public base::SupportsWeakPtr<TestPrerender> { |
477 public: | 469 public: |
478 TestPrerender() | 470 TestPrerender() |
479 : contents_(NULL), | 471 : contents_(NULL), |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
873 | 865 |
874 // Many of these tests are flaky. See http://crbug.com/249179 | 866 // Many of these tests are flaky. See http://crbug.com/249179 |
875 class PrerenderBrowserTest : virtual public InProcessBrowserTest { | 867 class PrerenderBrowserTest : virtual public InProcessBrowserTest { |
876 public: | 868 public: |
877 PrerenderBrowserTest() | 869 PrerenderBrowserTest() |
878 : autostart_test_server_(true), | 870 : autostart_test_server_(true), |
879 prerender_contents_factory_(NULL), | 871 prerender_contents_factory_(NULL), |
880 #if defined(FULL_SAFE_BROWSING) | 872 #if defined(FULL_SAFE_BROWSING) |
881 safe_browsing_factory_(new TestSafeBrowsingServiceFactory()), | 873 safe_browsing_factory_(new TestSafeBrowsingServiceFactory()), |
882 #endif | 874 #endif |
883 use_https_src_server_(false), | |
884 call_javascript_(true), | 875 call_javascript_(true), |
885 check_load_events_(true), | 876 check_load_events_(true), |
886 loader_path_("files/prerender/prerender_loader.html"), | 877 loader_path_("files/prerender/prerender_loader.html"), |
887 explicitly_set_browser_(NULL) {} | 878 explicitly_set_browser_(NULL) {} |
888 | 879 |
889 virtual ~PrerenderBrowserTest() {} | 880 virtual ~PrerenderBrowserTest() {} |
890 | 881 |
891 content::SessionStorageNamespace* GetSessionStorageNamespace() const { | 882 content::SessionStorageNamespace* GetSessionStorageNamespace() const { |
892 WebContents* web_contents = | 883 WebContents* web_contents = GetActiveWebContents(); |
893 current_browser()->tab_strip_model()->GetActiveWebContents(); | |
894 if (!web_contents) | 884 if (!web_contents) |
895 return NULL; | 885 return NULL; |
896 return web_contents->GetController().GetDefaultSessionStorageNamespace(); | 886 return web_contents->GetController().GetDefaultSessionStorageNamespace(); |
897 } | 887 } |
898 | 888 |
899 virtual void SetUp() OVERRIDE { | 889 virtual void SetUp() OVERRIDE { |
900 // TODO(danakj): The GPU Video Decoder needs real GL bindings. | 890 // TODO(danakj): The GPU Video Decoder needs real GL bindings. |
901 // crbug.com/269087 | 891 // crbug.com/269087 |
902 UseRealGLBindings(); | 892 UseRealGLBindings(); |
903 | 893 |
(...skipping 29 matching lines...) Expand all Loading... | |
933 | 923 |
934 virtual void SetUpOnMainThread() OVERRIDE { | 924 virtual void SetUpOnMainThread() OVERRIDE { |
935 current_browser()->profile()->GetPrefs()->SetBoolean( | 925 current_browser()->profile()->GetPrefs()->SetBoolean( |
936 prefs::kPromptForDownload, false); | 926 prefs::kPromptForDownload, false); |
937 IncreasePrerenderMemory(); | 927 IncreasePrerenderMemory(); |
938 if (autostart_test_server_) | 928 if (autostart_test_server_) |
939 ASSERT_TRUE(test_server()->Start()); | 929 ASSERT_TRUE(test_server()->Start()); |
940 ChromeResourceDispatcherHostDelegate:: | 930 ChromeResourceDispatcherHostDelegate:: |
941 SetExternalProtocolHandlerDelegateForTesting( | 931 SetExternalProtocolHandlerDelegateForTesting( |
942 &external_protocol_handler_delegate_); | 932 &external_protocol_handler_delegate_); |
933 | |
934 PrerenderManager* prerender_manager = GetPrerenderManager(); | |
935 CHECK(prerender_manager); | |
936 prerender_manager->mutable_config().rate_limit_enabled = false; | |
937 CHECK(prerender_contents_factory_ == NULL); | |
938 prerender_contents_factory_ = new TestPrerenderContentsFactory; | |
939 prerender_manager->SetPrerenderContentsFactory(prerender_contents_factory_); | |
940 } | |
941 | |
942 // Convenience function to get the currently active WebContents in | |
943 // current_browser(). | |
944 WebContents* GetActiveWebContents() const { | |
945 return current_browser()->tab_strip_model()->GetActiveWebContents(); | |
943 } | 946 } |
944 | 947 |
945 // Overload for a single expected final status | 948 // Overload for a single expected final status |
946 scoped_ptr<TestPrerender> PrerenderTestURL( | 949 scoped_ptr<TestPrerender> PrerenderTestURL( |
947 const std::string& html_file, | 950 const std::string& html_file, |
948 FinalStatus expected_final_status, | 951 FinalStatus expected_final_status, |
949 int expected_number_of_loads) { | 952 int expected_number_of_loads) { |
950 return PrerenderTestURL(html_file, | 953 GURL url = test_server()->GetURL(html_file); |
954 return PrerenderTestURL(url, | |
951 expected_final_status, | 955 expected_final_status, |
952 expected_number_of_loads, | 956 expected_number_of_loads); |
953 false); | |
954 } | |
955 | |
956 scoped_ptr<TestPrerender> PrerenderTestURL( | |
957 const std::string& html_file, | |
958 FinalStatus expected_final_status, | |
959 int expected_number_of_loads, | |
960 bool prerender_should_wait_for_ready_title) { | |
961 std::vector<FinalStatus> expected_final_status_queue( | |
962 1, expected_final_status); | |
963 std::vector<TestPrerender*> prerenders; | |
964 PrerenderTestURL( | |
965 html_file, | |
966 expected_final_status_queue, | |
967 expected_number_of_loads, | |
968 prerender_should_wait_for_ready_title).release(&prerenders); | |
969 CHECK_EQ(1u, prerenders.size()); | |
970 return scoped_ptr<TestPrerender>(prerenders[0]); | |
971 } | |
972 | |
973 ScopedVector<TestPrerender> PrerenderTestURL( | |
974 const std::string& html_file, | |
975 const std::vector<FinalStatus>& expected_final_status_queue, | |
976 int expected_number_of_loads, | |
977 bool prerender_should_wait_for_ready_title) { | |
978 GURL url = test_server()->GetURL(html_file); | |
979 return PrerenderTestURLImpl(url, url, | |
980 expected_final_status_queue, | |
981 expected_number_of_loads, | |
982 prerender_should_wait_for_ready_title); | |
983 } | 957 } |
984 | 958 |
985 ScopedVector<TestPrerender> PrerenderTestURL( | 959 ScopedVector<TestPrerender> PrerenderTestURL( |
986 const std::string& html_file, | 960 const std::string& html_file, |
987 const std::vector<FinalStatus>& expected_final_status_queue, | 961 const std::vector<FinalStatus>& expected_final_status_queue, |
988 int expected_number_of_loads) { | 962 int expected_number_of_loads) { |
989 return PrerenderTestURL(html_file, expected_final_status_queue, | 963 GURL url = test_server()->GetURL(html_file); |
990 expected_number_of_loads, false); | 964 return PrerenderTestURLImpl(url, |
965 expected_final_status_queue, | |
966 expected_number_of_loads); | |
991 } | 967 } |
992 | 968 |
993 scoped_ptr<TestPrerender> PrerenderTestURL( | 969 scoped_ptr<TestPrerender> PrerenderTestURL( |
994 const GURL& url, | 970 const GURL& url, |
995 FinalStatus expected_final_status, | 971 FinalStatus expected_final_status, |
996 int expected_number_of_loads) { | 972 int expected_number_of_loads) { |
997 std::vector<FinalStatus> expected_final_status_queue( | 973 std::vector<FinalStatus> expected_final_status_queue( |
998 1, expected_final_status); | 974 1, expected_final_status); |
999 std::vector<TestPrerender*> prerenders; | 975 std::vector<TestPrerender*> prerenders; |
1000 PrerenderTestURLImpl(url, url, | 976 PrerenderTestURLImpl(url, |
1001 expected_final_status_queue, | 977 expected_final_status_queue, |
1002 expected_number_of_loads, | 978 expected_number_of_loads).release(&prerenders); |
1003 false).release(&prerenders); | |
1004 CHECK_EQ(1u, prerenders.size()); | 979 CHECK_EQ(1u, prerenders.size()); |
1005 return scoped_ptr<TestPrerender>(prerenders[0]); | 980 return scoped_ptr<TestPrerender>(prerenders[0]); |
1006 } | 981 } |
1007 | |
1008 scoped_ptr<TestPrerender> PrerenderTestURL( | |
1009 const GURL& prerender_url, | |
1010 const GURL& destination_url, | |
1011 FinalStatus expected_final_status, | |
1012 int expected_number_of_loads) { | |
1013 std::vector<FinalStatus> expected_final_status_queue( | |
1014 1, expected_final_status); | |
1015 std::vector<TestPrerender*> prerenders; | |
1016 PrerenderTestURLImpl(prerender_url, destination_url, | |
1017 expected_final_status_queue, | |
1018 expected_number_of_loads, | |
1019 false).release(&prerenders); | |
1020 CHECK_EQ(1u, prerenders.size()); | |
1021 return scoped_ptr<TestPrerender>(prerenders[0]); | |
1022 } | |
1023 | 982 |
1024 void NavigateToDestURL() const { | 983 void NavigateToDestURL() const { |
1025 NavigateToDestURLWithDisposition(CURRENT_TAB, true); | 984 NavigateToDestURLWithDisposition(CURRENT_TAB, true); |
1026 } | 985 } |
1027 | 986 |
1028 // Opens the url in a new tab, with no opener. | 987 // Opens the url in a new tab, with no opener. |
1029 void NavigateToDestURLWithDisposition( | 988 void NavigateToDestURLWithDisposition( |
1030 WindowOpenDisposition disposition, | 989 WindowOpenDisposition disposition, |
1031 bool expect_swap_to_succeed) const { | 990 bool expect_swap_to_succeed) const { |
1032 NavigateToURLWithParams( | 991 NavigateToURLWithParams( |
1033 content::OpenURLParams(dest_url_, Referrer(), disposition, | 992 content::OpenURLParams(dest_url_, Referrer(), disposition, |
1034 content::PAGE_TRANSITION_TYPED, false), | 993 content::PAGE_TRANSITION_TYPED, false), |
1035 expect_swap_to_succeed); | 994 expect_swap_to_succeed); |
1036 } | 995 } |
1037 | 996 |
1038 void NavigateToDestUrlAndWaitForPassTitle() { | |
1039 base::string16 expected_title = base::ASCIIToUTF16(kPassTitle); | |
1040 content::TitleWatcher title_watcher( | |
1041 GetPrerenderContents()->prerender_contents(), | |
1042 expected_title); | |
1043 NavigateToDestURL(); | |
1044 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | |
1045 } | |
1046 | |
1047 void NavigateToURL(const std::string& dest_html_file) const { | 997 void NavigateToURL(const std::string& dest_html_file) const { |
1048 NavigateToURLWithDisposition(dest_html_file, CURRENT_TAB, true); | 998 NavigateToURLWithDisposition(dest_html_file, CURRENT_TAB, true); |
1049 } | 999 } |
1050 | 1000 |
1051 void NavigateToURLWithDisposition(const std::string& dest_html_file, | 1001 void NavigateToURLWithDisposition(const std::string& dest_html_file, |
1052 WindowOpenDisposition disposition, | 1002 WindowOpenDisposition disposition, |
1053 bool expect_swap_to_succeed) const { | 1003 bool expect_swap_to_succeed) const { |
1054 GURL dest_url = test_server()->GetURL(dest_html_file); | 1004 GURL dest_url = test_server()->GetURL(dest_html_file); |
1055 NavigateToURLWithDisposition(dest_url, disposition, expect_swap_to_succeed); | 1005 NavigateToURLWithDisposition(dest_url, disposition, expect_swap_to_succeed); |
1056 } | 1006 } |
1057 | 1007 |
1058 void NavigateToURLWithDisposition(const GURL& dest_url, | 1008 void NavigateToURLWithDisposition(const GURL& dest_url, |
1059 WindowOpenDisposition disposition, | 1009 WindowOpenDisposition disposition, |
1060 bool expect_swap_to_succeed) const { | 1010 bool expect_swap_to_succeed) const { |
1061 NavigateToURLWithParams( | 1011 NavigateToURLWithParams( |
1062 content::OpenURLParams(dest_url, Referrer(), disposition, | 1012 content::OpenURLParams(dest_url, Referrer(), disposition, |
1063 content::PAGE_TRANSITION_TYPED, false), | 1013 content::PAGE_TRANSITION_TYPED, false), |
1064 expect_swap_to_succeed); | 1014 expect_swap_to_succeed); |
1065 } | 1015 } |
1066 | 1016 |
1067 void NavigateToURLWithParams(const content::OpenURLParams& params, | 1017 void NavigateToURLWithParams(const content::OpenURLParams& params, |
1068 bool expect_swap_to_succeed) const { | 1018 bool expect_swap_to_succeed) const { |
1069 NavigateToURLImpl(params, expect_swap_to_succeed); | 1019 NavigateToURLImpl(params, expect_swap_to_succeed); |
1070 } | 1020 } |
1071 | 1021 |
1072 void OpenDestURLViaClick() const { | 1022 void OpenDestURLViaClick() const { |
1073 OpenDestURLWithJSImpl("Click()", false); | 1023 OpenURLViaClick(dest_url_); |
1024 } | |
mmenke
2014/01/17 22:00:38
nit: +line break?
davidben
2014/01/17 22:32:04
Done.
| |
1025 void OpenURLViaClick(const GURL& url) const { | |
1026 OpenURLWithJSImpl("Click", url, false); | |
1074 } | 1027 } |
1075 | 1028 |
1076 void OpenDestURLViaClickTarget() const { | 1029 void OpenDestURLViaClickTarget() const { |
1077 OpenDestURLWithJSImpl("ClickTarget()", true); | 1030 OpenURLWithJSImpl("ClickTarget", dest_url_, true); |
1078 } | 1031 } |
1079 | 1032 |
1080 void OpenDestURLViaClickNewWindow() const { | 1033 void OpenDestURLViaClickNewWindow() const { |
1081 OpenDestURLWithJSImpl("ShiftClick()", true); | 1034 OpenURLWithJSImpl("ShiftClick", dest_url_, true); |
1082 } | 1035 } |
1083 | 1036 |
1084 void OpenDestURLViaClickNewForegroundTab() const { | 1037 void OpenDestURLViaClickNewForegroundTab() const { |
1085 #if defined(OS_MACOSX) | 1038 #if defined(OS_MACOSX) |
1086 OpenDestURLWithJSImpl("MetaShiftClick()", true); | 1039 OpenURLWithJSImpl("MetaShiftClick", dest_url_, true); |
1087 #else | 1040 #else |
1088 OpenDestURLWithJSImpl("CtrlShiftClick()", true); | 1041 OpenURLWithJSImpl("CtrlShiftClick", dest_url_, true); |
1089 #endif | 1042 #endif |
1090 } | 1043 } |
1091 | 1044 |
1092 void OpenDestURLViaClickNewBackgroundTab() const { | 1045 void OpenDestURLViaClickNewBackgroundTab() const { |
1093 TestPrerenderContents* prerender_contents = GetPrerenderContents(); | |
1094 ASSERT_TRUE(prerender_contents != NULL); | |
1095 prerender_contents->set_should_be_shown(false); | |
1096 #if defined(OS_MACOSX) | 1046 #if defined(OS_MACOSX) |
1097 OpenDestURLWithJSImpl("MetaClick()", true); | 1047 OpenURLWithJSImpl("MetaClick", dest_url_, true); |
1098 #else | 1048 #else |
1099 OpenDestURLWithJSImpl("CtrlClick()", true); | 1049 OpenURLWithJSImpl("CtrlClick", dest_url_, true); |
1100 #endif | 1050 #endif |
1101 } | 1051 } |
1102 | 1052 |
1103 void OpenDestURLViaWindowOpen() const { | 1053 void OpenDestURLViaWindowOpen() const { |
1104 OpenDestURLWithJSImpl("WindowOpen()", true); | 1054 OpenURLWithJSImpl("WindowOpen", dest_url_, true); |
1105 } | 1055 } |
1106 | 1056 |
1107 void RemoveLinkElement(int i) const { | 1057 void RemoveLinkElement(int i) const { |
1108 current_browser()->tab_strip_model()->GetActiveWebContents()-> | 1058 GetActiveWebContents()->GetRenderViewHost()->ExecuteJavascriptInWebFrame( |
1109 GetRenderViewHost()->ExecuteJavascriptInWebFrame( | |
1110 base::string16(), | 1059 base::string16(), |
1111 base::ASCIIToUTF16(base::StringPrintf("RemoveLinkElement(%d)", i))); | 1060 base::ASCIIToUTF16(base::StringPrintf("RemoveLinkElement(%d)", i))); |
1112 } | 1061 } |
1113 | 1062 |
1114 void ClickToNextPageAfterPrerender() { | 1063 void ClickToNextPageAfterPrerender() { |
1115 content::WindowedNotificationObserver new_page_observer( | 1064 content::WindowedNotificationObserver new_page_observer( |
1116 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 1065 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
1117 content::NotificationService::AllSources()); | 1066 content::NotificationService::AllSources()); |
1118 RenderViewHost* render_view_host = current_browser()->tab_strip_model()-> | 1067 RenderViewHost* render_view_host = |
1119 GetActiveWebContents()->GetRenderViewHost(); | 1068 GetActiveWebContents()->GetRenderViewHost(); |
1120 render_view_host->ExecuteJavascriptInWebFrame( | 1069 render_view_host->ExecuteJavascriptInWebFrame( |
1121 base::string16(), | 1070 base::string16(), |
1122 base::ASCIIToUTF16("ClickOpenLink()")); | 1071 base::ASCIIToUTF16("ClickOpenLink()")); |
1123 new_page_observer.Wait(); | 1072 new_page_observer.Wait(); |
1124 } | 1073 } |
1125 | 1074 |
1126 void NavigateToNextPageAfterPrerender() const { | 1075 void NavigateToNextPageAfterPrerender() const { |
1127 ui_test_utils::NavigateToURL( | 1076 ui_test_utils::NavigateToURL( |
1128 current_browser(), | 1077 current_browser(), |
1129 test_server()->GetURL("files/prerender/prerender_page.html")); | 1078 test_server()->GetURL("files/prerender/prerender_page.html")); |
1130 } | 1079 } |
1131 | 1080 |
1132 // Called after the prerendered page has been navigated to and then away from. | 1081 // Called after the prerendered page has been navigated to and then away from. |
1133 // Navigates back through the history to the prerendered page. | 1082 // Navigates back through the history to the prerendered page. |
1134 void GoBackToPrerender() { | 1083 void GoBackToPrerender() { |
1135 content::WindowedNotificationObserver back_nav_observer( | 1084 content::WindowedNotificationObserver back_nav_observer( |
1136 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 1085 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
1137 content::NotificationService::AllSources()); | 1086 content::NotificationService::AllSources()); |
1138 chrome::GoBack(current_browser(), CURRENT_TAB); | 1087 chrome::GoBack(current_browser(), CURRENT_TAB); |
1139 back_nav_observer.Wait(); | 1088 back_nav_observer.Wait(); |
1140 bool original_prerender_page = false; | 1089 bool original_prerender_page = false; |
1141 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 1090 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
1142 current_browser()->tab_strip_model()->GetActiveWebContents(), | 1091 GetActiveWebContents(), |
1143 "window.domAutomationController.send(IsOriginalPrerenderPage())", | 1092 "window.domAutomationController.send(IsOriginalPrerenderPage())", |
1144 &original_prerender_page)); | 1093 &original_prerender_page)); |
1145 EXPECT_TRUE(original_prerender_page); | 1094 EXPECT_TRUE(original_prerender_page); |
1146 } | 1095 } |
1147 | 1096 |
1148 // Goes back to the page that was active before the prerender was swapped | 1097 // Goes back to the page that was active before the prerender was swapped |
1149 // in. This must be called when the prerendered page is the current page | 1098 // in. This must be called when the prerendered page is the current page |
1150 // in the active tab. | 1099 // in the active tab. |
1151 void GoBackToPageBeforePrerender() { | 1100 void GoBackToPageBeforePrerender() { |
1152 WebContents* tab = | 1101 WebContents* tab = GetActiveWebContents(); |
1153 current_browser()->tab_strip_model()->GetActiveWebContents(); | |
1154 ASSERT_TRUE(tab); | 1102 ASSERT_TRUE(tab); |
1155 EXPECT_FALSE(tab->IsLoading()); | 1103 EXPECT_FALSE(tab->IsLoading()); |
1156 TestNavigationObserver back_nav_observer(tab); | 1104 TestNavigationObserver back_nav_observer(tab); |
1157 chrome::GoBack(current_browser(), CURRENT_TAB); | 1105 chrome::GoBack(current_browser(), CURRENT_TAB); |
1158 back_nav_observer.Wait(); | 1106 back_nav_observer.Wait(); |
1159 bool js_result; | 1107 bool js_result; |
1160 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 1108 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
1161 tab, | 1109 tab, |
1162 "window.domAutomationController.send(DidBackToOriginalPagePass())", | 1110 "window.domAutomationController.send(DidBackToOriginalPagePass())", |
1163 &js_result)); | 1111 &js_result)); |
1164 EXPECT_TRUE(js_result); | 1112 EXPECT_TRUE(js_result); |
1165 } | 1113 } |
1166 | 1114 |
1167 bool UrlIsInPrerenderManager(const std::string& html_file) const { | 1115 bool UrlIsInPrerenderManager(const std::string& html_file) const { |
1168 return UrlIsInPrerenderManager(test_server()->GetURL(html_file)); | 1116 return UrlIsInPrerenderManager(test_server()->GetURL(html_file)); |
1169 } | 1117 } |
1170 | 1118 |
1171 bool UrlIsInPrerenderManager(const GURL& url) const { | 1119 bool UrlIsInPrerenderManager(const GURL& url) const { |
1172 return GetPrerenderManager()->FindPrerenderData( | 1120 return GetPrerenderManager()->FindPrerenderData( |
1173 url, GetSessionStorageNamespace()) != NULL; | 1121 url, GetSessionStorageNamespace()) != NULL; |
1174 } | 1122 } |
1175 | 1123 |
1176 void set_use_https_src(bool use_https_src_server) { | 1124 void UseHttpsSrcServer() { |
1177 use_https_src_server_ = use_https_src_server; | 1125 if (https_src_server_) |
1126 return; | |
1127 https_src_server_.reset( | |
1128 new net::SpawnedTestServer( | |
1129 net::SpawnedTestServer::TYPE_HTTPS, | |
1130 net::SpawnedTestServer::kLocalhost, | |
1131 base::FilePath(FILE_PATH_LITERAL("chrome/test/data")))); | |
1132 CHECK(https_src_server_->Start()); | |
1178 } | 1133 } |
1179 | 1134 |
1180 void DisableJavascriptCalls() { | 1135 void DisableJavascriptCalls() { |
1181 call_javascript_ = false; | 1136 call_javascript_ = false; |
1182 } | 1137 } |
1183 | 1138 |
1184 void DisableLoadEventCheck() { | 1139 void DisableLoadEventCheck() { |
1185 check_load_events_ = false; | 1140 check_load_events_ = false; |
1186 } | 1141 } |
1187 | 1142 |
(...skipping 14 matching lines...) Expand all Loading... | |
1202 return prerender_link_manager; | 1157 return prerender_link_manager; |
1203 } | 1158 } |
1204 | 1159 |
1205 bool DidReceivePrerenderStartEventForLinkNumber(int index) const { | 1160 bool DidReceivePrerenderStartEventForLinkNumber(int index) const { |
1206 bool received_prerender_started; | 1161 bool received_prerender_started; |
1207 std::string expression = base::StringPrintf( | 1162 std::string expression = base::StringPrintf( |
1208 "window.domAutomationController.send(Boolean(" | 1163 "window.domAutomationController.send(Boolean(" |
1209 "receivedPrerenderStartEvents[%d]))", index); | 1164 "receivedPrerenderStartEvents[%d]))", index); |
1210 | 1165 |
1211 CHECK(content::ExecuteScriptAndExtractBool( | 1166 CHECK(content::ExecuteScriptAndExtractBool( |
1212 current_browser()->tab_strip_model()->GetActiveWebContents(), | 1167 GetActiveWebContents(), |
1213 expression, | 1168 expression, |
1214 &received_prerender_started)); | 1169 &received_prerender_started)); |
1215 return received_prerender_started; | 1170 return received_prerender_started; |
1216 } | 1171 } |
1217 | 1172 |
1218 int GetPrerenderLoadEventCountForLinkNumber(int index) const { | 1173 int GetPrerenderLoadEventCountForLinkNumber(int index) const { |
1219 int load_event_count; | 1174 int load_event_count; |
1220 std::string expression = base::StringPrintf( | 1175 std::string expression = base::StringPrintf( |
1221 "window.domAutomationController.send(" | 1176 "window.domAutomationController.send(" |
1222 "receivedPrerenderLoadEvents[%d] || 0)", index); | 1177 "receivedPrerenderLoadEvents[%d] || 0)", index); |
1223 | 1178 |
1224 CHECK(content::ExecuteScriptAndExtractInt( | 1179 CHECK(content::ExecuteScriptAndExtractInt( |
1225 current_browser()->tab_strip_model()->GetActiveWebContents(), | 1180 GetActiveWebContents(), |
1226 expression, | 1181 expression, |
1227 &load_event_count)); | 1182 &load_event_count)); |
1228 return load_event_count; | 1183 return load_event_count; |
1229 } | 1184 } |
1230 | 1185 |
1231 bool DidReceivePrerenderStopEventForLinkNumber(int index) const { | 1186 bool DidReceivePrerenderStopEventForLinkNumber(int index) const { |
1232 bool received_prerender_stopped; | 1187 bool received_prerender_stopped; |
1233 std::string expression = base::StringPrintf( | 1188 std::string expression = base::StringPrintf( |
1234 "window.domAutomationController.send(Boolean(" | 1189 "window.domAutomationController.send(Boolean(" |
1235 "receivedPrerenderStopEvents[%d]))", index); | 1190 "receivedPrerenderStopEvents[%d]))", index); |
1236 | 1191 |
1237 CHECK(content::ExecuteScriptAndExtractBool( | 1192 CHECK(content::ExecuteScriptAndExtractBool( |
1238 current_browser()->tab_strip_model()->GetActiveWebContents(), | 1193 GetActiveWebContents(), |
1239 expression, | 1194 expression, |
1240 &received_prerender_stopped)); | 1195 &received_prerender_stopped)); |
1241 return received_prerender_stopped; | 1196 return received_prerender_stopped; |
1242 } | 1197 } |
1243 | 1198 |
1244 bool HadPrerenderEventErrors() const { | 1199 bool HadPrerenderEventErrors() const { |
1245 bool had_prerender_event_errors; | 1200 bool had_prerender_event_errors; |
1246 CHECK(content::ExecuteScriptAndExtractBool( | 1201 CHECK(content::ExecuteScriptAndExtractBool( |
1247 current_browser()->tab_strip_model()->GetActiveWebContents(), | 1202 GetActiveWebContents(), |
1248 "window.domAutomationController.send(Boolean(" | 1203 "window.domAutomationController.send(Boolean(" |
1249 " hadPrerenderEventErrors))", | 1204 " hadPrerenderEventErrors))", |
1250 &had_prerender_event_errors)); | 1205 &had_prerender_event_errors)); |
1251 return had_prerender_event_errors; | 1206 return had_prerender_event_errors; |
1252 } | 1207 } |
1253 | 1208 |
1254 // Asserting on this can result in flaky tests. PrerenderHandles are | 1209 // Asserting on this can result in flaky tests. PrerenderHandles are |
1255 // removed from the PrerenderLinkManager when the prerender is canceled from | 1210 // removed from the PrerenderLinkManager when the prerender is canceled from |
1256 // the browser, when the prerenders are cancelled from the renderer process, | 1211 // the browser, when the prerenders are cancelled from the renderer process, |
1257 // or the channel for the renderer process is closed on the IO thread. In the | 1212 // or the channel for the renderer process is closed on the IO thread. In the |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1351 return false; | 1306 return false; |
1352 return display_test_result; | 1307 return display_test_result; |
1353 } | 1308 } |
1354 | 1309 |
1355 protected: | 1310 protected: |
1356 bool autostart_test_server_; | 1311 bool autostart_test_server_; |
1357 | 1312 |
1358 private: | 1313 private: |
1359 ScopedVector<TestPrerender> PrerenderTestURLImpl( | 1314 ScopedVector<TestPrerender> PrerenderTestURLImpl( |
1360 const GURL& prerender_url, | 1315 const GURL& prerender_url, |
1361 const GURL& destination_url, | |
1362 const std::vector<FinalStatus>& expected_final_status_queue, | 1316 const std::vector<FinalStatus>& expected_final_status_queue, |
1363 int expected_number_of_loads, | 1317 int expected_number_of_loads) { |
1364 bool prerender_should_wait_for_ready_title) { | 1318 dest_url_ = prerender_url; |
mmenke
2014/01/17 22:00:38
Wonder if we should just get rid of this in anothe
davidben
2014/01/17 22:32:04
'this' being the dest_url_ line? Well there's also
mmenke
2014/01/21 17:16:10
Yea, 'this' being get rid of dest_url_ completely.
| |
1365 dest_url_ = destination_url; | |
1366 | 1319 |
1367 std::vector<net::SpawnedTestServer::StringPair> replacement_text; | 1320 std::vector<net::SpawnedTestServer::StringPair> replacement_text; |
1368 replacement_text.push_back( | 1321 replacement_text.push_back( |
1369 make_pair("REPLACE_WITH_PRERENDER_URL", prerender_url.spec())); | 1322 make_pair("REPLACE_WITH_PRERENDER_URL", prerender_url.spec())); |
1370 replacement_text.push_back( | |
1371 make_pair("REPLACE_WITH_DESTINATION_URL", destination_url.spec())); | |
1372 std::string replacement_path; | 1323 std::string replacement_path; |
1373 CHECK(net::SpawnedTestServer::GetFilePathWithReplacements( | 1324 CHECK(net::SpawnedTestServer::GetFilePathWithReplacements( |
1374 loader_path_, | 1325 loader_path_, |
1375 replacement_text, | 1326 replacement_text, |
1376 &replacement_path)); | 1327 &replacement_path)); |
1377 | 1328 |
1378 const net::SpawnedTestServer* src_server = test_server(); | 1329 const net::SpawnedTestServer* src_server = test_server(); |
1379 scoped_ptr<net::SpawnedTestServer> https_src_server; | 1330 if (https_src_server_) |
1380 if (use_https_src_server_) { | 1331 src_server = https_src_server_.get(); |
mmenke
2014/01/17 22:00:38
Good idea...scoping here does seem like it was a w
| |
1381 https_src_server.reset( | |
1382 new net::SpawnedTestServer( | |
1383 net::SpawnedTestServer::TYPE_HTTPS, | |
1384 net::SpawnedTestServer::kLocalhost, | |
1385 base::FilePath(FILE_PATH_LITERAL("chrome/test/data")))); | |
1386 CHECK(https_src_server->Start()); | |
1387 src_server = https_src_server.get(); | |
1388 } | |
1389 GURL loader_url = src_server->GetURL(replacement_path + | 1332 GURL loader_url = src_server->GetURL(replacement_path + |
1390 loader_query_and_fragment_); | 1333 loader_query_and_fragment_); |
1391 | 1334 |
1392 PrerenderManager* prerender_manager = GetPrerenderManager(); | |
1393 CHECK(prerender_manager); | |
1394 prerender_manager->mutable_config().rate_limit_enabled = false; | |
1395 CHECK(prerender_contents_factory_ == NULL); | |
1396 prerender_contents_factory_ = new TestPrerenderContentsFactory; | |
1397 prerender_manager->SetPrerenderContentsFactory(prerender_contents_factory_); | |
1398 | |
1399 VLOG(1) << "Running test with queue length " << | 1335 VLOG(1) << "Running test with queue length " << |
1400 expected_final_status_queue.size(); | 1336 expected_final_status_queue.size(); |
1401 CHECK(!expected_final_status_queue.empty()); | 1337 CHECK(!expected_final_status_queue.empty()); |
1402 ScopedVector<TestPrerender> prerenders; | 1338 ScopedVector<TestPrerender> prerenders; |
1403 for (size_t i = 0; i < expected_final_status_queue.size(); i++) { | 1339 for (size_t i = 0; i < expected_final_status_queue.size(); i++) { |
1404 prerenders.push_back( | 1340 prerenders.push_back( |
1405 prerender_contents_factory_->ExpectPrerenderContents( | 1341 prerender_contents_factory_->ExpectPrerenderContents( |
1406 expected_final_status_queue[i]).release()); | 1342 expected_final_status_queue[i]).release()); |
1407 } | 1343 } |
1408 | 1344 |
(...skipping 12 matching lines...) Expand all Loading... | |
1421 EXPECT_TRUE(DidReceivePrerenderStopEventForLinkNumber(0)); | 1357 EXPECT_TRUE(DidReceivePrerenderStopEventForLinkNumber(0)); |
1422 } else { | 1358 } else { |
1423 // Otherwise, check that it prerendered correctly. | 1359 // Otherwise, check that it prerendered correctly. |
1424 TestPrerenderContents* prerender_contents = prerenders[0]->contents(); | 1360 TestPrerenderContents* prerender_contents = prerenders[0]->contents(); |
1425 | 1361 |
1426 CHECK_NE(static_cast<PrerenderContents*>(NULL), prerender_contents); | 1362 CHECK_NE(static_cast<PrerenderContents*>(NULL), prerender_contents); |
1427 EXPECT_EQ(FINAL_STATUS_MAX, prerender_contents->final_status()); | 1363 EXPECT_EQ(FINAL_STATUS_MAX, prerender_contents->final_status()); |
1428 EXPECT_FALSE(DidReceivePrerenderStopEventForLinkNumber(0)); | 1364 EXPECT_FALSE(DidReceivePrerenderStopEventForLinkNumber(0)); |
1429 | 1365 |
1430 if (call_javascript_) { | 1366 if (call_javascript_) { |
1431 // Wait for the prerendered page to change title to signal it is ready | |
1432 // if required. | |
1433 if (prerender_should_wait_for_ready_title) | |
1434 prerender_contents->WaitForPrerenderToHaveReadyTitle(); | |
1435 | |
1436 // Check if page behaves as expected while in prerendered state. | 1367 // Check if page behaves as expected while in prerendered state. |
1437 EXPECT_TRUE(DidPrerenderPass(prerender_contents->prerender_contents())); | 1368 EXPECT_TRUE(DidPrerenderPass( |
1369 prerenders[0]->contents()->prerender_contents())); | |
mmenke
2014/01/17 22:00:38
prerenders[0]->contents() is just prerender_conten
davidben
2014/01/17 22:32:04
Oh, hrm, I must have just done that blindly withou
| |
1438 } | 1370 } |
1439 } | 1371 } |
1440 | 1372 |
1441 // Test that the referring page received the right start and load events. | 1373 // Test that the referring page received the right start and load events. |
1442 EXPECT_TRUE(DidReceivePrerenderStartEventForLinkNumber(0)); | 1374 EXPECT_TRUE(DidReceivePrerenderStartEventForLinkNumber(0)); |
1443 if (check_load_events_) { | 1375 if (check_load_events_) { |
1444 EXPECT_EQ(expected_number_of_loads, prerenders[0]->number_of_loads()); | 1376 EXPECT_EQ(expected_number_of_loads, prerenders[0]->number_of_loads()); |
1445 EXPECT_EQ(expected_number_of_loads, | 1377 EXPECT_EQ(expected_number_of_loads, |
1446 GetPrerenderLoadEventCountForLinkNumber(0)); | 1378 GetPrerenderLoadEventCountForLinkNumber(0)); |
1447 } | 1379 } |
1448 EXPECT_FALSE(HadPrerenderEventErrors()); | 1380 EXPECT_FALSE(HadPrerenderEventErrors()); |
1449 | 1381 |
1450 return prerenders.Pass(); | 1382 return prerenders.Pass(); |
1451 } | 1383 } |
1452 | 1384 |
1453 void NavigateToURLImpl(const content::OpenURLParams& params, | 1385 void NavigateToURLImpl(const content::OpenURLParams& params, |
1454 bool expect_swap_to_succeed) const { | 1386 bool expect_swap_to_succeed) const { |
1455 ASSERT_NE(static_cast<PrerenderManager*>(NULL), GetPrerenderManager()); | 1387 ASSERT_NE(static_cast<PrerenderManager*>(NULL), GetPrerenderManager()); |
1456 // Make sure in navigating we have a URL to use in the PrerenderManager. | 1388 // Make sure in navigating we have a URL to use in the PrerenderManager. |
1457 ASSERT_NE(static_cast<PrerenderContents*>(NULL), GetPrerenderContents()); | 1389 ASSERT_NE(static_cast<PrerenderContents*>(NULL), GetPrerenderContents()); |
1458 | 1390 |
1459 // If opening the page in a background tab, it won't be shown when swapped | |
1460 // in. | |
1461 if (params.disposition == NEW_BACKGROUND_TAB) | |
1462 GetPrerenderContents()->set_should_be_shown(false); | |
1463 | |
1464 WebContents* web_contents = GetPrerenderContents()->prerender_contents(); | 1391 WebContents* web_contents = GetPrerenderContents()->prerender_contents(); |
1465 | 1392 |
1466 // Navigate and wait for either the load to finish normally or for a swap to | 1393 // Navigate and wait for either the load to finish normally or for a swap to |
1467 // occur. | 1394 // occur. |
1468 // TODO(davidben): The only handles CURRENT_TAB navigations, which is the | 1395 // TODO(davidben): The only handles CURRENT_TAB navigations, which is the |
1469 // only case tested or prerendered right now. | 1396 // only case tested or prerendered right now. |
1470 CHECK_EQ(CURRENT_TAB, params.disposition); | 1397 CHECK_EQ(CURRENT_TAB, params.disposition); |
1471 NavigationOrSwapObserver swap_observer( | 1398 NavigationOrSwapObserver swap_observer(current_browser()->tab_strip_model(), |
1472 current_browser()->tab_strip_model(), | 1399 GetActiveWebContents()); |
1473 current_browser()->tab_strip_model()->GetActiveWebContents()); | |
1474 WebContents* target_web_contents = current_browser()->OpenURL(params); | 1400 WebContents* target_web_contents = current_browser()->OpenURL(params); |
1475 swap_observer.Wait(); | 1401 swap_observer.Wait(); |
1476 | 1402 |
1477 if (web_contents && expect_swap_to_succeed) { | 1403 if (web_contents && expect_swap_to_succeed) { |
1478 EXPECT_EQ(web_contents, target_web_contents); | 1404 EXPECT_EQ(web_contents, target_web_contents); |
1479 if (call_javascript_) | 1405 if (call_javascript_) |
1480 EXPECT_TRUE(DidDisplayPass(web_contents)); | 1406 EXPECT_TRUE(DidDisplayPass(web_contents)); |
1481 } | 1407 } |
1482 } | 1408 } |
1483 | 1409 |
1484 // Opens the prerendered page using javascript functions in the loader | 1410 // Opens the prerendered page using javascript functions in the loader |
1485 // page. |javascript_function_name| should be a 0 argument function which is | 1411 // page. |javascript_function_name| should be a 0 argument function which is |
1486 // invoked. |new_web_contents| is true if the navigation is expected to | 1412 // invoked. |new_web_contents| is true if the navigation is expected to |
1487 // happen in a new WebContents via OpenURL. | 1413 // happen in a new WebContents via OpenURL. |
1488 void OpenDestURLWithJSImpl(const std::string& javascript_function_name, | 1414 void OpenURLWithJSImpl(const std::string& javascript_function_name, |
1489 bool new_web_contents) const { | 1415 const GURL& url, |
1490 TestPrerenderContents* prerender_contents = GetPrerenderContents(); | 1416 bool new_web_contents) const { |
mmenke
2014/01/17 22:00:38
Can we make GetPrerenderContents() private now?
davidben
2014/01/17 22:32:04
Done.
| |
1491 ASSERT_NE(static_cast<PrerenderContents*>(NULL), prerender_contents); | 1417 WebContents* web_contents = GetActiveWebContents(); |
1492 | 1418 RenderViewHost* render_view_host = |
1493 WebContents* web_contents = current_browser()->tab_strip_model()-> | 1419 GetActiveWebContents()->GetRenderViewHost(); |
1494 GetActiveWebContents(); | 1420 std::string javascript = base::StringPrintf( |
1495 RenderViewHost* render_view_host = web_contents->GetRenderViewHost(); | 1421 "%s('%s')", javascript_function_name.c_str(), url.spec().c_str()); |
1496 | 1422 |
1497 if (new_web_contents) { | 1423 if (new_web_contents) { |
1498 NewTabNavigationOrSwapObserver observer; | 1424 NewTabNavigationOrSwapObserver observer; |
1499 render_view_host->ExecuteJavascriptInWebFrame( | 1425 render_view_host->ExecuteJavascriptInWebFrame( |
1500 base::string16(), base::ASCIIToUTF16(javascript_function_name)); | 1426 base::string16(), base::ASCIIToUTF16(javascript)); |
1501 observer.Wait(); | 1427 observer.Wait(); |
1502 } else { | 1428 } else { |
1503 NavigationOrSwapObserver observer(current_browser()->tab_strip_model(), | 1429 NavigationOrSwapObserver observer(current_browser()->tab_strip_model(), |
1504 web_contents); | 1430 web_contents); |
1505 render_view_host->ExecuteJavascriptInWebFrame( | 1431 render_view_host->ExecuteJavascriptInWebFrame( |
1506 base::string16(), base::ASCIIToUTF16(javascript_function_name)); | 1432 base::string16(), base::ASCIIToUTF16(javascript)); |
1507 observer.Wait(); | 1433 observer.Wait(); |
1508 } | 1434 } |
1509 } | 1435 } |
1510 | 1436 |
1511 TestPrerenderContentsFactory* prerender_contents_factory_; | 1437 TestPrerenderContentsFactory* prerender_contents_factory_; |
1512 #if defined(FULL_SAFE_BROWSING) | 1438 #if defined(FULL_SAFE_BROWSING) |
1513 scoped_ptr<TestSafeBrowsingServiceFactory> safe_browsing_factory_; | 1439 scoped_ptr<TestSafeBrowsingServiceFactory> safe_browsing_factory_; |
1514 #endif | 1440 #endif |
1515 NeverRunsExternalProtocolHandlerDelegate external_protocol_handler_delegate_; | 1441 NeverRunsExternalProtocolHandlerDelegate external_protocol_handler_delegate_; |
1516 GURL dest_url_; | 1442 GURL dest_url_; |
1517 bool use_https_src_server_; | 1443 scoped_ptr<net::SpawnedTestServer> https_src_server_; |
1518 bool call_javascript_; | 1444 bool call_javascript_; |
1519 bool check_load_events_; | 1445 bool check_load_events_; |
1520 std::string loader_path_; | 1446 std::string loader_path_; |
1521 std::string loader_query_and_fragment_; | 1447 std::string loader_query_and_fragment_; |
1522 Browser* explicitly_set_browser_; | 1448 Browser* explicitly_set_browser_; |
1523 }; | 1449 }; |
1524 | 1450 |
1525 // Checks that a page is correctly prerendered in the case of a | 1451 // Checks that a page is correctly prerendered in the case of a |
1526 // <link rel=prerender> tag and then loaded into a tab in response to a | 1452 // <link rel=prerender> tag and then loaded into a tab in response to a |
1527 // navigation. | 1453 // navigation. |
1528 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPage) { | 1454 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPage) { |
1529 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); | 1455 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); |
1530 | 1456 |
1531 ChannelDestructionWatcher channel_close_watcher; | 1457 ChannelDestructionWatcher channel_close_watcher; |
1532 channel_close_watcher.WatchChannel(browser()->tab_strip_model()-> | 1458 channel_close_watcher.WatchChannel( |
1533 GetActiveWebContents()->GetRenderProcessHost()); | 1459 GetActiveWebContents()->GetRenderProcessHost()); |
1534 NavigateToDestURL(); | 1460 NavigateToDestURL(); |
1535 channel_close_watcher.WaitForChannelClose(); | 1461 channel_close_watcher.WaitForChannelClose(); |
1536 | 1462 |
1537 ASSERT_TRUE(IsEmptyPrerenderLinkManager()); | 1463 ASSERT_TRUE(IsEmptyPrerenderLinkManager()); |
1538 } | 1464 } |
1539 | 1465 |
1540 // Checks that pending prerenders launch and receive proper event treatment. | 1466 // Checks that pending prerenders launch and receive proper event treatment. |
1541 // Disabled due to http://crbug.com/167792 | 1467 // Disabled due to http://crbug.com/167792 |
1542 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderPagePending) { | 1468 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderPagePending) { |
1543 std::vector<FinalStatus> expected_final_status_queue; | 1469 std::vector<FinalStatus> expected_final_status_queue; |
1544 expected_final_status_queue.push_back(FINAL_STATUS_USED); | 1470 expected_final_status_queue.push_back(FINAL_STATUS_USED); |
1545 expected_final_status_queue.push_back(FINAL_STATUS_USED); | 1471 expected_final_status_queue.push_back(FINAL_STATUS_USED); |
1546 PrerenderTestURL("files/prerender/prerender_page_pending.html", | 1472 PrerenderTestURL("files/prerender/prerender_page_pending.html", |
1547 expected_final_status_queue, 1); | 1473 expected_final_status_queue, 1); |
1548 | 1474 |
1549 ChannelDestructionWatcher first_channel_close_watcher; | 1475 ChannelDestructionWatcher first_channel_close_watcher; |
1550 | 1476 |
1551 first_channel_close_watcher.WatchChannel(browser()->tab_strip_model()-> | 1477 first_channel_close_watcher.WatchChannel( |
1552 GetActiveWebContents()->GetRenderProcessHost()); | 1478 GetActiveWebContents()->GetRenderProcessHost()); |
1553 NavigateToDestURL(); | 1479 NavigateToDestURL(); |
1554 // NavigateToDestURL doesn't run a message loop. Normally that's fine, but in | 1480 // NavigateToDestURL doesn't run a message loop. Normally that's fine, but in |
1555 // this case, we need the pending prerenders to start. | 1481 // this case, we need the pending prerenders to start. |
1556 content::RunMessageLoop(); | 1482 content::RunMessageLoop(); |
1557 first_channel_close_watcher.WaitForChannelClose(); | 1483 first_channel_close_watcher.WaitForChannelClose(); |
1558 | 1484 |
1559 const GURL prerender_page_url = | 1485 const GURL prerender_page_url = |
1560 test_server()->GetURL("files/prerender/prerender_page.html"); | 1486 test_server()->GetURL("files/prerender/prerender_page.html"); |
1561 EXPECT_FALSE(IsEmptyPrerenderLinkManager()); | 1487 EXPECT_FALSE(IsEmptyPrerenderLinkManager()); |
1562 EXPECT_NE(static_cast<TestPrerenderContents*>(NULL), | 1488 EXPECT_NE(static_cast<TestPrerenderContents*>(NULL), |
1563 GetPrerenderContentsFor(prerender_page_url)); | 1489 GetPrerenderContentsFor(prerender_page_url)); |
1564 | 1490 |
1565 // Now navigate to our target page. | 1491 // Now navigate to our target page. |
1566 ChannelDestructionWatcher second_channel_close_watcher; | 1492 ChannelDestructionWatcher second_channel_close_watcher; |
1567 second_channel_close_watcher.WatchChannel(browser()->tab_strip_model()-> | 1493 second_channel_close_watcher.WatchChannel( |
1568 GetActiveWebContents()->GetRenderProcessHost()); | 1494 GetActiveWebContents()->GetRenderProcessHost()); |
1569 ui_test_utils::NavigateToURLWithDisposition( | 1495 ui_test_utils::NavigateToURLWithDisposition( |
1570 current_browser(), prerender_page_url, CURRENT_TAB, | 1496 current_browser(), prerender_page_url, CURRENT_TAB, |
1571 ui_test_utils::BROWSER_TEST_NONE); | 1497 ui_test_utils::BROWSER_TEST_NONE); |
1572 second_channel_close_watcher.WaitForChannelClose(); | 1498 second_channel_close_watcher.WaitForChannelClose(); |
1573 | 1499 |
1574 EXPECT_TRUE(IsEmptyPrerenderLinkManager()); | 1500 EXPECT_TRUE(IsEmptyPrerenderLinkManager()); |
1575 } | 1501 } |
1576 | 1502 |
1577 // Checks that pending prerenders which are canceled before they are launched | 1503 // Checks that pending prerenders which are canceled before they are launched |
1578 // never get started. | 1504 // never get started. |
1579 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPageRemovesPending) { | 1505 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPageRemovesPending) { |
1580 PrerenderTestURL("files/prerender/prerender_page_removes_pending.html", | 1506 PrerenderTestURL("files/prerender/prerender_page_removes_pending.html", |
1581 FINAL_STATUS_USED, 1); | 1507 FINAL_STATUS_USED, 1); |
1582 | 1508 |
1583 ChannelDestructionWatcher channel_close_watcher; | 1509 ChannelDestructionWatcher channel_close_watcher; |
1584 channel_close_watcher.WatchChannel(browser()->tab_strip_model()-> | 1510 channel_close_watcher.WatchChannel( |
1585 GetActiveWebContents()->GetRenderProcessHost()); | 1511 GetActiveWebContents()->GetRenderProcessHost()); |
1586 NavigateToDestURL(); | 1512 NavigateToDestURL(); |
1587 channel_close_watcher.WaitForChannelClose(); | 1513 channel_close_watcher.WaitForChannelClose(); |
1588 | 1514 |
1589 EXPECT_FALSE(DidReceivePrerenderStartEventForLinkNumber(1)); | 1515 EXPECT_FALSE(DidReceivePrerenderStartEventForLinkNumber(1)); |
1590 EXPECT_FALSE(DidReceivePrerenderStopEventForLinkNumber(1)); | 1516 EXPECT_FALSE(DidReceivePrerenderStopEventForLinkNumber(1)); |
1591 EXPECT_FALSE(HadPrerenderEventErrors()); | 1517 EXPECT_FALSE(HadPrerenderEventErrors()); |
1592 // IsEmptyPrerenderLinkManager() is not racy because the earlier DidReceive* | 1518 // IsEmptyPrerenderLinkManager() is not racy because the earlier DidReceive* |
1593 // calls did a thread/process hop to the renderer which insured pending | 1519 // calls did a thread/process hop to the renderer which insured pending |
1594 // renderer events have arrived. | 1520 // renderer events have arrived. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1671 EXPECT_FALSE(DidReceivePrerenderStopEventForLinkNumber(0)); | 1597 EXPECT_FALSE(DidReceivePrerenderStopEventForLinkNumber(0)); |
1672 EXPECT_TRUE(DidReceivePrerenderStartEventForLinkNumber(1)); | 1598 EXPECT_TRUE(DidReceivePrerenderStartEventForLinkNumber(1)); |
1673 EXPECT_FALSE(DidReceivePrerenderStopEventForLinkNumber(1)); | 1599 EXPECT_FALSE(DidReceivePrerenderStopEventForLinkNumber(1)); |
1674 EXPECT_FALSE(HadPrerenderEventErrors()); | 1600 EXPECT_FALSE(HadPrerenderEventErrors()); |
1675 // IsEmptyPrerenderLinkManager() is not racy because the earlier DidReceive* | 1601 // IsEmptyPrerenderLinkManager() is not racy because the earlier DidReceive* |
1676 // calls did a thread/process hop to the renderer which insured pending | 1602 // calls did a thread/process hop to the renderer which insured pending |
1677 // renderer events have arrived. | 1603 // renderer events have arrived. |
1678 EXPECT_FALSE(IsEmptyPrerenderLinkManager()); | 1604 EXPECT_FALSE(IsEmptyPrerenderLinkManager()); |
1679 | 1605 |
1680 ChannelDestructionWatcher channel_close_watcher; | 1606 ChannelDestructionWatcher channel_close_watcher; |
1681 channel_close_watcher.WatchChannel(browser()->tab_strip_model()-> | 1607 channel_close_watcher.WatchChannel( |
1682 GetActiveWebContents()->GetRenderProcessHost()); | 1608 GetActiveWebContents()->GetRenderProcessHost()); |
1683 NavigateToDestURL(); | 1609 NavigateToDestURL(); |
1684 channel_close_watcher.WaitForChannelClose(); | 1610 channel_close_watcher.WaitForChannelClose(); |
1685 | 1611 |
1686 EXPECT_TRUE(IsEmptyPrerenderLinkManager()); | 1612 EXPECT_TRUE(IsEmptyPrerenderLinkManager()); |
1687 } | 1613 } |
1688 | 1614 |
1615 class PrerenderIncognitoBrowserTest : public PrerenderBrowserTest { | |
1616 public: | |
1617 virtual void SetUpOnMainThread() OVERRIDE { | |
1618 Profile* normal_profile = current_browser()->profile(); | |
1619 set_browser(ui_test_utils::OpenURLOffTheRecord( | |
1620 normal_profile, GURL("about:blank"))); | |
1621 PrerenderBrowserTest::SetUpOnMainThread(); | |
1622 } | |
1623 }; | |
1624 | |
1689 // Checks that prerendering works in incognito mode. | 1625 // Checks that prerendering works in incognito mode. |
1690 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderIncognito) { | 1626 IN_PROC_BROWSER_TEST_F(PrerenderIncognitoBrowserTest, PrerenderIncognito) { |
1691 Profile* normal_profile = current_browser()->profile(); | |
1692 set_browser( | |
1693 ui_test_utils::OpenURLOffTheRecord(normal_profile, GURL("about:blank"))); | |
1694 // Increase memory expectations on the incognito PrerenderManager. | |
1695 IncreasePrerenderMemory(); | |
1696 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); | 1627 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); |
1697 NavigateToDestURL(); | 1628 NavigateToDestURL(); |
1698 } | 1629 } |
mmenke
2014/01/17 22:00:38
optional: Suggest moving this test and its fixtur
davidben
2014/01/17 22:32:04
Done.
| |
1699 | 1630 |
1700 // Checks that the visibility API works. | 1631 // Checks that the visibility API works. |
1701 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1632 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
1702 DISABLED_PrerenderVisibility) { | 1633 DISABLED_PrerenderVisibility) { |
1703 PrerenderTestURL("files/prerender/prerender_visibility.html", | 1634 PrerenderTestURL("files/prerender/prerender_visibility.html", |
1704 FINAL_STATUS_USED, | 1635 FINAL_STATUS_USED, |
1705 1); | 1636 1); |
1706 NavigateToDestURL(); | 1637 NavigateToDestURL(); |
1707 } | 1638 } |
1708 | 1639 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1816 NavigateToDestURL(); | 1747 NavigateToDestURL(); |
1817 | 1748 |
1818 | 1749 |
1819 // Run this check again. When we try to load aa ppapi plugin, the | 1750 // Run this check again. When we try to load aa ppapi plugin, the |
1820 // "loadstart" event is asynchronously posted to a message loop. | 1751 // "loadstart" event is asynchronously posted to a message loop. |
1821 // It's possible that earlier call could have been run before the | 1752 // It's possible that earlier call could have been run before the |
1822 // the "loadstart" event was posted. | 1753 // the "loadstart" event was posted. |
1823 // TODO(mmenke): While this should reliably fail on regressions, the | 1754 // TODO(mmenke): While this should reliably fail on regressions, the |
1824 // reliability depends on the specifics of ppapi plugin | 1755 // reliability depends on the specifics of ppapi plugin |
1825 // loading. It would be great if we could avoid that. | 1756 // loading. It would be great if we could avoid that. |
1826 WebContents* web_contents = | 1757 EXPECT_TRUE(DidDisplayPass(GetActiveWebContents())); |
1827 browser()->tab_strip_model()->GetActiveWebContents(); | |
1828 EXPECT_TRUE(DidDisplayPass(web_contents)); | |
1829 } | 1758 } |
1830 | 1759 |
1831 // Checks that plugins in an iframe are not loaded while a page is | 1760 // Checks that plugins in an iframe are not loaded while a page is |
1832 // being preloaded, but are loaded when the page is displayed. | 1761 // being preloaded, but are loaded when the page is displayed. |
1833 #if defined(USE_AURA) && !defined(OS_WIN) | 1762 #if defined(USE_AURA) && !defined(OS_WIN) |
1834 // http://crbug.com/103496 | 1763 // http://crbug.com/103496 |
1835 #define MAYBE_PrerenderIframeDelayLoadPlugin \ | 1764 #define MAYBE_PrerenderIframeDelayLoadPlugin \ |
1836 DISABLED_PrerenderIframeDelayLoadPlugin | 1765 DISABLED_PrerenderIframeDelayLoadPlugin |
1837 #elif defined(OS_MACOSX) | 1766 #elif defined(OS_MACOSX) |
1838 // http://crbug.com/100514 | 1767 // http://crbug.com/100514 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1906 | 1835 |
1907 // Checks that client-issued redirects work with prerendering. | 1836 // Checks that client-issued redirects work with prerendering. |
1908 // This version navigates to the final destination page, rather than the | 1837 // This version navigates to the final destination page, rather than the |
1909 // page which does the redirection via a mouse click. | 1838 // page which does the redirection via a mouse click. |
1910 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1839 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
1911 DISABLED_PrerenderClientRedirectNavigateToSecondViaClick) { | 1840 DISABLED_PrerenderClientRedirectNavigateToSecondViaClick) { |
1912 GURL prerender_url = test_server()->GetURL( | 1841 GURL prerender_url = test_server()->GetURL( |
1913 CreateClientRedirect("files/prerender/prerender_page.html")); | 1842 CreateClientRedirect("files/prerender/prerender_page.html")); |
1914 GURL destination_url = test_server()->GetURL( | 1843 GURL destination_url = test_server()->GetURL( |
1915 "files/prerender/prerender_page.html"); | 1844 "files/prerender/prerender_page.html"); |
1916 PrerenderTestURL(prerender_url, destination_url, FINAL_STATUS_USED, 2); | 1845 PrerenderTestURL(prerender_url, FINAL_STATUS_USED, 2); |
1917 OpenDestURLViaClick(); | 1846 OpenURLViaClick(destination_url); |
1918 } | 1847 } |
1919 | 1848 |
1920 // Checks that a prerender for an https will prevent a prerender from happening. | 1849 // Checks that a prerender for an https will prevent a prerender from happening. |
1921 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHttps) { | 1850 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHttps) { |
1922 net::SpawnedTestServer https_server( | 1851 net::SpawnedTestServer https_server( |
1923 net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost, | 1852 net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost, |
1924 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 1853 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
1925 ASSERT_TRUE(https_server.Start()); | 1854 ASSERT_TRUE(https_server.Start()); |
1926 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); | 1855 GURL https_url = https_server.GetURL("files/prerender/prerender_page.html"); |
1927 PrerenderTestURL(https_url, | 1856 PrerenderTestURL(https_url, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2012 | 1941 |
2013 // Checks that server-issued redirects work with prerendering. | 1942 // Checks that server-issued redirects work with prerendering. |
2014 // This version navigates to the final destination page, rather than the | 1943 // This version navigates to the final destination page, rather than the |
2015 // page which does the redirection via a mouse click. | 1944 // page which does the redirection via a mouse click. |
2016 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1945 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
2017 PrerenderServerRedirectNavigateToSecondViaClick) { | 1946 PrerenderServerRedirectNavigateToSecondViaClick) { |
2018 GURL prerender_url = test_server()->GetURL( | 1947 GURL prerender_url = test_server()->GetURL( |
2019 CreateServerRedirect("files/prerender/prerender_page.html")); | 1948 CreateServerRedirect("files/prerender/prerender_page.html")); |
2020 GURL destination_url = test_server()->GetURL( | 1949 GURL destination_url = test_server()->GetURL( |
2021 "files/prerender/prerender_page.html"); | 1950 "files/prerender/prerender_page.html"); |
2022 PrerenderTestURL(prerender_url, destination_url, FINAL_STATUS_USED, 1); | 1951 PrerenderTestURL(prerender_url, FINAL_STATUS_USED, 1); |
2023 OpenDestURLViaClick(); | 1952 OpenURLViaClick(destination_url); |
2024 } | 1953 } |
2025 | 1954 |
2026 // Checks that server-issued redirects from an http to an https | 1955 // Checks that server-issued redirects from an http to an https |
2027 // location will cancel prerendering. | 1956 // location will cancel prerendering. |
2028 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1957 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
2029 PrerenderServerRedirectToHttps) { | 1958 PrerenderServerRedirectToHttps) { |
2030 net::SpawnedTestServer https_server( | 1959 net::SpawnedTestServer https_server( |
2031 net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost, | 1960 net::SpawnedTestServer::TYPE_HTTPS, net::SpawnedTestServer::kLocalhost, |
2032 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 1961 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
2033 ASSERT_TRUE(https_server.Start()); | 1962 ASSERT_TRUE(https_server.Start()); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2111 PrerenderTestURL("files/prerender/prerender_referrer.html", | 2040 PrerenderTestURL("files/prerender/prerender_referrer.html", |
2112 FINAL_STATUS_USED, | 2041 FINAL_STATUS_USED, |
2113 1); | 2042 1); |
2114 NavigateToDestURL(); | 2043 NavigateToDestURL(); |
2115 } | 2044 } |
2116 | 2045 |
2117 // Checks that the referrer is not set when prerendering and the source page is | 2046 // Checks that the referrer is not set when prerendering and the source page is |
2118 // HTTPS. | 2047 // HTTPS. |
2119 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 2048 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
2120 PrerenderNoSSLReferrer) { | 2049 PrerenderNoSSLReferrer) { |
2121 set_use_https_src(true); | 2050 UseHttpsSrcServer(); |
2122 PrerenderTestURL("files/prerender/prerender_no_referrer.html", | 2051 PrerenderTestURL("files/prerender/prerender_no_referrer.html", |
2123 FINAL_STATUS_USED, | 2052 FINAL_STATUS_USED, |
2124 1); | 2053 1); |
2125 NavigateToDestURL(); | 2054 NavigateToDestURL(); |
2126 } | 2055 } |
2127 | 2056 |
2128 // Checks that the referrer is set when prerendering is cancelled. | 2057 // Checks that the referrer is set when prerendering is cancelled. |
2129 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelReferrer) { | 2058 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelReferrer) { |
2130 scoped_ptr<TestContentBrowserClient> test_content_browser_client( | 2059 scoped_ptr<TestContentBrowserClient> test_content_browser_client( |
2131 new TestContentBrowserClient); | 2060 new TestContentBrowserClient); |
2132 content::ContentBrowserClient* original_browser_client = | 2061 content::ContentBrowserClient* original_browser_client = |
2133 content::SetBrowserClientForTesting(test_content_browser_client.get()); | 2062 content::SetBrowserClientForTesting(test_content_browser_client.get()); |
2134 | 2063 |
2135 PrerenderTestURL("files/prerender/prerender_referrer.html", | 2064 PrerenderTestURL("files/prerender/prerender_referrer.html", |
2136 FINAL_STATUS_CANCELLED, | 2065 FINAL_STATUS_CANCELLED, |
2137 1); | 2066 1); |
2138 OpenDestURLViaClick(); | 2067 OpenDestURLViaClick(); |
2139 | 2068 |
2140 bool display_test_result = false; | 2069 EXPECT_TRUE(DidDisplayPass(GetActiveWebContents())); |
2141 WebContents* web_contents = | |
2142 browser()->tab_strip_model()->GetActiveWebContents(); | |
2143 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | |
2144 web_contents, | |
2145 "window.domAutomationController.send(DidDisplayPass())", | |
2146 &display_test_result)); | |
2147 EXPECT_TRUE(display_test_result); | |
2148 | 2070 |
2149 content::SetBrowserClientForTesting(original_browser_client); | 2071 content::SetBrowserClientForTesting(original_browser_client); |
2150 } | 2072 } |
2151 | 2073 |
2152 // Checks that popups on a prerendered page cause cancellation. | 2074 // Checks that popups on a prerendered page cause cancellation. |
2153 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPopup) { | 2075 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPopup) { |
2154 PrerenderTestURL("files/prerender/prerender_popup.html", | 2076 PrerenderTestURL("files/prerender/prerender_popup.html", |
2155 FINAL_STATUS_CREATE_NEW_WINDOW, | 2077 FINAL_STATUS_CREATE_NEW_WINDOW, |
2156 0); | 2078 0); |
2157 } | 2079 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2189 // TODO(gavinp,sreeram): Fix http://crbug.com/145248 and deflake this test. | 2111 // TODO(gavinp,sreeram): Fix http://crbug.com/145248 and deflake this test. |
2190 // Checks that we don't prerender in an infinite loop. | 2112 // Checks that we don't prerender in an infinite loop. |
2191 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderInfiniteLoop) { | 2113 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderInfiniteLoop) { |
2192 const char* const kHtmlFileA = "files/prerender/prerender_infinite_a.html"; | 2114 const char* const kHtmlFileA = "files/prerender/prerender_infinite_a.html"; |
2193 const char* const kHtmlFileB = "files/prerender/prerender_infinite_b.html"; | 2115 const char* const kHtmlFileB = "files/prerender/prerender_infinite_b.html"; |
2194 | 2116 |
2195 std::vector<FinalStatus> expected_final_status_queue; | 2117 std::vector<FinalStatus> expected_final_status_queue; |
2196 expected_final_status_queue.push_back(FINAL_STATUS_USED); | 2118 expected_final_status_queue.push_back(FINAL_STATUS_USED); |
2197 expected_final_status_queue.push_back(FINAL_STATUS_APP_TERMINATING); | 2119 expected_final_status_queue.push_back(FINAL_STATUS_APP_TERMINATING); |
2198 | 2120 |
2199 PrerenderTestURL(kHtmlFileA, expected_final_status_queue, 1); | 2121 ScopedVector<TestPrerender> prerenders = |
2200 ASSERT_TRUE(GetPrerenderContents()); | 2122 PrerenderTestURL(kHtmlFileA, expected_final_status_queue, 1); |
2201 GetPrerenderContents()->WaitForPendingPrerenders(1u); | 2123 ASSERT_TRUE(prerenders[0]->contents()); |
2124 prerenders[0]->contents()->WaitForPendingPrerenders(1u); | |
2202 | 2125 |
2203 // Next url should be in pending list but not an active entry. | 2126 // Next url should be in pending list but not an active entry. |
2204 EXPECT_FALSE(UrlIsInPrerenderManager(kHtmlFileB)); | 2127 EXPECT_FALSE(UrlIsInPrerenderManager(kHtmlFileB)); |
2205 | 2128 |
2206 NavigateToDestURL(); | 2129 NavigateToDestURL(); |
2207 | 2130 |
2208 // Make sure the PrerenderContents for the next url is now in the manager | 2131 // Make sure the PrerenderContents for the next url is now in the manager |
2209 // and not pending. | 2132 // and not pending. |
2210 EXPECT_TRUE(UrlIsInPrerenderManager(kHtmlFileB)); | 2133 EXPECT_TRUE(UrlIsInPrerenderManager(kHtmlFileB)); |
2211 } | 2134 } |
(...skipping 13 matching lines...) Expand all Loading... | |
2225 // This test is conceptually simplest if concurrency is at two, since we | 2148 // This test is conceptually simplest if concurrency is at two, since we |
2226 // don't have to worry about which of kHtmlFileB or kHtmlFileC gets evicted. | 2149 // don't have to worry about which of kHtmlFileB or kHtmlFileC gets evicted. |
2227 GetPrerenderManager()->mutable_config().max_link_concurrency = 2; | 2150 GetPrerenderManager()->mutable_config().max_link_concurrency = 2; |
2228 GetPrerenderManager()->mutable_config().max_link_concurrency_per_launcher = 2; | 2151 GetPrerenderManager()->mutable_config().max_link_concurrency_per_launcher = 2; |
2229 | 2152 |
2230 std::vector<FinalStatus> expected_final_status_queue; | 2153 std::vector<FinalStatus> expected_final_status_queue; |
2231 expected_final_status_queue.push_back(FINAL_STATUS_USED); | 2154 expected_final_status_queue.push_back(FINAL_STATUS_USED); |
2232 expected_final_status_queue.push_back(FINAL_STATUS_APP_TERMINATING); | 2155 expected_final_status_queue.push_back(FINAL_STATUS_APP_TERMINATING); |
2233 expected_final_status_queue.push_back(FINAL_STATUS_APP_TERMINATING); | 2156 expected_final_status_queue.push_back(FINAL_STATUS_APP_TERMINATING); |
2234 | 2157 |
2235 PrerenderTestURL(kHtmlFileA, expected_final_status_queue, 1); | 2158 ScopedVector<TestPrerender> prerenders = |
2236 ASSERT_TRUE(GetPrerenderContents()); | 2159 PrerenderTestURL(kHtmlFileA, expected_final_status_queue, 1); |
2237 GetPrerenderContents()->WaitForPendingPrerenders(2u); | 2160 ASSERT_TRUE(prerenders[0]->contents()); |
2161 prerenders[0]->contents()->WaitForPendingPrerenders(2u); | |
2238 | 2162 |
2239 // Next url should be in pending list but not an active entry. | 2163 // Next url should be in pending list but not an active entry. |
2240 EXPECT_FALSE(UrlIsInPrerenderManager(kHtmlFileB)); | 2164 EXPECT_FALSE(UrlIsInPrerenderManager(kHtmlFileB)); |
2241 EXPECT_FALSE(UrlIsInPrerenderManager(kHtmlFileC)); | 2165 EXPECT_FALSE(UrlIsInPrerenderManager(kHtmlFileC)); |
2242 | 2166 |
2243 NavigateToDestURL(); | 2167 NavigateToDestURL(); |
2244 | 2168 |
2245 // Make sure the PrerenderContents for the next urls are now in the manager | 2169 // Make sure the PrerenderContents for the next urls are now in the manager |
2246 // and not pending. One and only one of the URLs (the last seen) should be the | 2170 // and not pending. One and only one of the URLs (the last seen) should be the |
2247 // active entry. | 2171 // active entry. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2312 // We may have deleted the prerender tab, but the swapped in tab should be | 2236 // We may have deleted the prerender tab, but the swapped in tab should be |
2313 // active. | 2237 // active. |
2314 EXPECT_GE(num_tabs_with_prerender_page_title, 1); | 2238 EXPECT_GE(num_tabs_with_prerender_page_title, 1); |
2315 EXPECT_LE(num_tabs_with_prerender_page_title, 2); | 2239 EXPECT_LE(num_tabs_with_prerender_page_title, 2); |
2316 } | 2240 } |
2317 | 2241 |
2318 // Checks that audio loads are deferred on prerendering. | 2242 // Checks that audio loads are deferred on prerendering. |
2319 // Times out under AddressSanitizer, see http://crbug.com/108402 | 2243 // Times out under AddressSanitizer, see http://crbug.com/108402 |
2320 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderHTML5Audio) { | 2244 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderHTML5Audio) { |
2321 PrerenderTestURL("files/prerender/prerender_html5_audio.html", | 2245 PrerenderTestURL("files/prerender/prerender_html5_audio.html", |
2322 FINAL_STATUS_USED, | 2246 FINAL_STATUS_USED, |
2323 1); | 2247 1); |
2324 NavigateToDestUrlAndWaitForPassTitle(); | 2248 NavigateToDestURL(); |
2249 WaitForASCIITitle(GetActiveWebContents(), kPassTitle); | |
2325 } | 2250 } |
2326 | 2251 |
2327 // Checks that audio loads are deferred on prerendering and played back when | 2252 // Checks that audio loads are deferred on prerendering and played back when |
2328 // the prerender is swapped in if autoplay is set. | 2253 // the prerender is swapped in if autoplay is set. |
2329 // Periodically fails on chrome-os. See http://crbug.com/145263 | 2254 // Periodically fails on chrome-os. See http://crbug.com/145263 |
2330 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 2255 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
2331 DISABLED_PrerenderHTML5AudioAutoplay) { | 2256 DISABLED_PrerenderHTML5AudioAutoplay) { |
2332 PrerenderTestURL("files/prerender/prerender_html5_audio_autoplay.html", | 2257 PrerenderTestURL("files/prerender/prerender_html5_audio_autoplay.html", |
2333 FINAL_STATUS_USED, | 2258 FINAL_STATUS_USED, |
2334 1); | 2259 1); |
2335 NavigateToDestUrlAndWaitForPassTitle(); | 2260 NavigateToDestURL(); |
2261 WaitForASCIITitle(GetActiveWebContents(), kPassTitle); | |
2336 } | 2262 } |
2337 | 2263 |
2338 // Checks that audio loads are deferred on prerendering and played back when | 2264 // Checks that audio loads are deferred on prerendering and played back when |
2339 // the prerender is swapped in if js starts playing. | 2265 // the prerender is swapped in if js starts playing. |
2340 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 2266 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
2341 DISABLED_PrerenderHTML5AudioJsplay) { | 2267 DISABLED_PrerenderHTML5AudioJsplay) { |
2342 PrerenderTestURL("files/prerender/prerender_html5_audio_jsplay.html", | 2268 PrerenderTestURL("files/prerender/prerender_html5_audio_jsplay.html", |
2343 FINAL_STATUS_USED, | 2269 FINAL_STATUS_USED, |
2344 1); | 2270 1); |
2345 NavigateToDestUrlAndWaitForPassTitle(); | 2271 NavigateToDestURL(); |
2272 WaitForASCIITitle(GetActiveWebContents(), kPassTitle); | |
2346 } | 2273 } |
2347 | 2274 |
2348 // Checks that video loads are deferred on prerendering. | 2275 // Checks that video loads are deferred on prerendering. |
2349 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderHTML5Video) { | 2276 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderHTML5Video) { |
2350 PrerenderTestURL("files/prerender/prerender_html5_video.html", | 2277 PrerenderTestURL("files/prerender/prerender_html5_video.html", |
2351 FINAL_STATUS_USED, | 2278 FINAL_STATUS_USED, |
2352 1); | 2279 1); |
2353 NavigateToDestUrlAndWaitForPassTitle(); | 2280 NavigateToDestURL(); |
2281 WaitForASCIITitle(GetActiveWebContents(), kPassTitle); | |
2354 } | 2282 } |
2355 | 2283 |
2356 // Checks that video tags inserted by javascript are deferred and played | 2284 // Checks that video tags inserted by javascript are deferred and played |
2357 // correctly on swap in. | 2285 // correctly on swap in. |
2358 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 2286 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
2359 DISABLED_PrerenderHTML5VideoJs) { | 2287 DISABLED_PrerenderHTML5VideoJs) { |
2360 PrerenderTestURL("files/prerender/prerender_html5_video_script.html", | 2288 PrerenderTestURL("files/prerender/prerender_html5_video_script.html", |
2361 FINAL_STATUS_USED, | 2289 FINAL_STATUS_USED, |
2362 1); | 2290 1); |
2363 NavigateToDestUrlAndWaitForPassTitle(); | 2291 NavigateToDestURL(); |
2292 WaitForASCIITitle(GetActiveWebContents(), kPassTitle); | |
2364 } | 2293 } |
2365 | 2294 |
2366 // Checks for correct network events by using a busy sleep the javascript. | 2295 // Checks for correct network events by using a busy sleep the javascript. |
2367 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 2296 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
2368 DISABLED_PrerenderHTML5VideoNetwork) { | 2297 DISABLED_PrerenderHTML5VideoNetwork) { |
2369 PrerenderTestURL("files/prerender/prerender_html5_video_network.html", | 2298 DisableJavascriptCalls(); |
2370 FINAL_STATUS_USED, | 2299 scoped_ptr<TestPrerender> prerender = |
2371 1, | 2300 PrerenderTestURL("files/prerender/prerender_html5_video_network.html", |
2372 true); | 2301 FINAL_STATUS_USED, |
2373 NavigateToDestUrlAndWaitForPassTitle(); | 2302 1); |
2303 WaitForASCIITitle(prerender->contents()->prerender_contents(), kReadyTitle); | |
2304 EXPECT_TRUE(DidPrerenderPass(prerender->contents()->prerender_contents())); | |
2305 NavigateToDestURL(); | |
2306 WaitForASCIITitle(GetActiveWebContents(), kPassTitle); | |
2374 } | 2307 } |
2375 | 2308 |
2376 // Checks that scripts can retrieve the correct window size while prerendering. | 2309 // Checks that scripts can retrieve the correct window size while prerendering. |
2377 #if defined(TOOLKIT_VIEWS) | 2310 #if defined(TOOLKIT_VIEWS) |
2378 // TODO(beng): Widget hierarchy split causes this to fail http://crbug.com/82363 | 2311 // TODO(beng): Widget hierarchy split causes this to fail http://crbug.com/82363 |
2379 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderWindowSize) { | 2312 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderWindowSize) { |
2380 #else | 2313 #else |
2381 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderWindowSize) { | 2314 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderWindowSize) { |
2382 #endif | 2315 #endif |
2383 PrerenderTestURL("files/prerender/prerender_size.html", | 2316 PrerenderTestURL("files/prerender/prerender_size.html", |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2861 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderLocalStorageWrite) { | 2794 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderLocalStorageWrite) { |
2862 PrerenderTestURL("files/prerender/prerender_localstorage_write.html", | 2795 PrerenderTestURL("files/prerender/prerender_localstorage_write.html", |
2863 FINAL_STATUS_USED, | 2796 FINAL_STATUS_USED, |
2864 1); | 2797 1); |
2865 NavigateToDestURL(); | 2798 NavigateToDestURL(); |
2866 } | 2799 } |
2867 | 2800 |
2868 // Checks that the favicon is properly loaded on prerender. | 2801 // Checks that the favicon is properly loaded on prerender. |
2869 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 2802 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
2870 DISABLED_PrerenderFavicon) { | 2803 DISABLED_PrerenderFavicon) { |
2871 PrerenderTestURL("files/prerender/prerender_favicon.html", | 2804 scoped_ptr<TestPrerender> prerender = |
2872 FINAL_STATUS_USED, | 2805 PrerenderTestURL("files/prerender/prerender_favicon.html", |
2873 1); | 2806 FINAL_STATUS_USED, |
2874 TestPrerenderContents* prerender_contents = GetPrerenderContents(); | 2807 1); |
2875 ASSERT_TRUE(prerender_contents != NULL); | 2808 ASSERT_TRUE(prerender->contents()); |
2876 content::WindowedNotificationObserver favicon_update_watcher( | 2809 content::WindowedNotificationObserver favicon_update_watcher( |
2877 chrome::NOTIFICATION_FAVICON_UPDATED, | 2810 chrome::NOTIFICATION_FAVICON_UPDATED, |
2878 content::Source<WebContents>(prerender_contents->prerender_contents())); | 2811 content::Source<WebContents>( |
2812 prerender->contents()->prerender_contents())); | |
2879 NavigateToDestURL(); | 2813 NavigateToDestURL(); |
2880 favicon_update_watcher.Wait(); | 2814 favicon_update_watcher.Wait(); |
2881 } | 2815 } |
2882 | 2816 |
2883 // Checks that when a prerendered page is swapped in to a referring page, the | 2817 // Checks that when a prerendered page is swapped in to a referring page, the |
2884 // unload handlers on the referring page are executed. | 2818 // unload handlers on the referring page are executed. |
2885 // Fails about 50% on CrOS, 5-10% on linux, win, mac. http://crbug.com/128986 | 2819 // Fails about 50% on CrOS, 5-10% on linux, win, mac. http://crbug.com/128986 |
2886 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderUnload) { | 2820 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderUnload) { |
2887 set_loader_path("files/prerender/prerender_loader_with_unload.html"); | 2821 set_loader_path("files/prerender/prerender_loader_with_unload.html"); |
2888 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); | 2822 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2933 | 2867 |
2934 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelAll) { | 2868 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelAll) { |
2935 scoped_ptr<TestPrerender> prerender = | 2869 scoped_ptr<TestPrerender> prerender = |
2936 PrerenderTestURL("files/prerender/prerender_page.html", | 2870 PrerenderTestURL("files/prerender/prerender_page.html", |
2937 FINAL_STATUS_CANCELLED, | 2871 FINAL_STATUS_CANCELLED, |
2938 1); | 2872 1); |
2939 | 2873 |
2940 GetPrerenderManager()->CancelAllPrerenders(); | 2874 GetPrerenderManager()->CancelAllPrerenders(); |
2941 prerender->WaitForStop(); | 2875 prerender->WaitForStop(); |
2942 | 2876 |
2943 EXPECT_TRUE(GetPrerenderContents() == NULL); | 2877 EXPECT_FALSE(prerender->contents()); |
2944 } | 2878 } |
2945 | 2879 |
2946 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderEvents) { | 2880 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderEvents) { |
2947 scoped_ptr<TestPrerender> prerender = | 2881 scoped_ptr<TestPrerender> prerender = |
2948 PrerenderTestURL("files/prerender/prerender_page.html", | 2882 PrerenderTestURL("files/prerender/prerender_page.html", |
2949 FINAL_STATUS_CANCELLED, 1); | 2883 FINAL_STATUS_CANCELLED, 1); |
2950 | 2884 |
2951 GetPrerenderManager()->CancelAllPrerenders(); | 2885 GetPrerenderManager()->CancelAllPrerenders(); |
2952 prerender->WaitForStop(); | 2886 prerender->WaitForStop(); |
2953 | 2887 |
2954 EXPECT_TRUE(DidReceivePrerenderStartEventForLinkNumber(0)); | 2888 EXPECT_TRUE(DidReceivePrerenderStartEventForLinkNumber(0)); |
2955 EXPECT_TRUE(DidReceivePrerenderStopEventForLinkNumber(0)); | 2889 EXPECT_TRUE(DidReceivePrerenderStopEventForLinkNumber(0)); |
2956 EXPECT_FALSE(HadPrerenderEventErrors()); | 2890 EXPECT_FALSE(HadPrerenderEventErrors()); |
2957 } | 2891 } |
2958 | 2892 |
2959 // Cancels the prerender of a page with its own prerender. The second prerender | 2893 // Cancels the prerender of a page with its own prerender. The second prerender |
2960 // should never be started. | 2894 // should never be started. |
2961 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 2895 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
2962 PrerenderCancelPrerenderWithPrerender) { | 2896 PrerenderCancelPrerenderWithPrerender) { |
2963 scoped_ptr<TestPrerender> prerender = | 2897 scoped_ptr<TestPrerender> prerender = |
2964 PrerenderTestURL("files/prerender/prerender_infinite_a.html", | 2898 PrerenderTestURL("files/prerender/prerender_infinite_a.html", |
2965 FINAL_STATUS_CANCELLED, | 2899 FINAL_STATUS_CANCELLED, |
2966 1); | 2900 1); |
2967 | 2901 |
2968 GetPrerenderManager()->CancelAllPrerenders(); | 2902 GetPrerenderManager()->CancelAllPrerenders(); |
2969 prerender->WaitForStop(); | 2903 prerender->WaitForStop(); |
2970 | 2904 |
2971 EXPECT_TRUE(GetPrerenderContents() == NULL); | 2905 EXPECT_FALSE(prerender->contents()); |
2972 } | 2906 } |
2973 | 2907 |
2974 // Prerendering and history tests. | 2908 // Prerendering and history tests. |
2975 // The prerendered page is navigated to in several ways [navigate via | 2909 // The prerendered page is navigated to in several ways [navigate via |
2976 // omnibox, click on link, key-modified click to open in background tab, etc], | 2910 // omnibox, click on link, key-modified click to open in background tab, etc], |
2977 // followed by a navigation to another page from the prerendered page, followed | 2911 // followed by a navigation to another page from the prerendered page, followed |
2978 // by a back navigation. | 2912 // by a back navigation. |
2979 | 2913 |
2980 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 2914 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
2981 DISABLED_PrerenderNavigateClickGoBack) { | 2915 DISABLED_PrerenderNavigateClickGoBack) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3030 | 2964 |
3031 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClickNewForegroundTab) { | 2965 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClickNewForegroundTab) { |
3032 PrerenderTestURL("files/prerender/prerender_page_with_link.html", | 2966 PrerenderTestURL("files/prerender/prerender_page_with_link.html", |
3033 FINAL_STATUS_WINDOW_OPENER, | 2967 FINAL_STATUS_WINDOW_OPENER, |
3034 1); | 2968 1); |
3035 OpenDestURLViaClickNewForegroundTab(); | 2969 OpenDestURLViaClickNewForegroundTab(); |
3036 } | 2970 } |
3037 | 2971 |
3038 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 2972 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
3039 DISABLED_PrerenderClickNewBackgroundTab) { | 2973 DISABLED_PrerenderClickNewBackgroundTab) { |
3040 PrerenderTestURL("files/prerender/prerender_page_with_link.html", | 2974 scoped_ptr<TestPrerender> prerender = |
3041 FINAL_STATUS_APP_TERMINATING, | 2975 PrerenderTestURL("files/prerender/prerender_page_with_link.html", |
3042 1); | 2976 FINAL_STATUS_APP_TERMINATING, |
2977 1); | |
2978 ASSERT_TRUE(prerender->contents()); | |
2979 prerender->contents()->set_should_be_shown(false); | |
3043 OpenDestURLViaClickNewBackgroundTab(); | 2980 OpenDestURLViaClickNewBackgroundTab(); |
3044 } | 2981 } |
3045 | 2982 |
3046 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 2983 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
3047 NavigateToPrerenderedPageWhenDevToolsAttached) { | 2984 NavigateToPrerenderedPageWhenDevToolsAttached) { |
3048 DisableJavascriptCalls(); | 2985 DisableJavascriptCalls(); |
3049 WebContents* web_contents = | 2986 WebContents* web_contents = |
3050 current_browser()->tab_strip_model()->GetActiveWebContents(); | 2987 current_browser()->tab_strip_model()->GetActiveWebContents(); |
3051 scoped_refptr<DevToolsAgentHost> agent(DevToolsAgentHost::GetOrCreateFor( | 2988 scoped_refptr<DevToolsAgentHost> agent(DevToolsAgentHost::GetOrCreateFor( |
3052 web_contents->GetRenderViewHost())); | 2989 web_contents->GetRenderViewHost())); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3137 set_loader_path("files/prerender/prerender_loader_with_referrer_policy.html"); | 3074 set_loader_path("files/prerender/prerender_loader_with_referrer_policy.html"); |
3138 PrerenderTestURL("files/prerender/prerender_referrer_policy.html", | 3075 PrerenderTestURL("files/prerender/prerender_referrer_policy.html", |
3139 FINAL_STATUS_USED, | 3076 FINAL_STATUS_USED, |
3140 1); | 3077 1); |
3141 NavigateToDestURL(); | 3078 NavigateToDestURL(); |
3142 } | 3079 } |
3143 | 3080 |
3144 // Checks that the referrer policy is used when prerendering on HTTPS. | 3081 // Checks that the referrer policy is used when prerendering on HTTPS. |
3145 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 3082 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
3146 PrerenderSSLReferrerPolicy) { | 3083 PrerenderSSLReferrerPolicy) { |
3147 set_use_https_src(true); | 3084 UseHttpsSrcServer(); |
3148 set_loader_path("files/prerender/prerender_loader_with_referrer_policy.html"); | 3085 set_loader_path("files/prerender/prerender_loader_with_referrer_policy.html"); |
3149 PrerenderTestURL("files/prerender/prerender_referrer_policy.html", | 3086 PrerenderTestURL("files/prerender/prerender_referrer_policy.html", |
3150 FINAL_STATUS_USED, | 3087 FINAL_STATUS_USED, |
3151 1); | 3088 1); |
3152 NavigateToDestURL(); | 3089 NavigateToDestURL(); |
3153 } | 3090 } |
3154 | 3091 |
3155 // Checks that the referrer policy is used when prerendering is cancelled. | 3092 // Checks that the referrer policy is used when prerendering is cancelled. |
3156 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelReferrerPolicy) { | 3093 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelReferrerPolicy) { |
3157 scoped_ptr<TestContentBrowserClient> test_content_browser_client( | 3094 scoped_ptr<TestContentBrowserClient> test_content_browser_client( |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3353 GURL url = test_server()->GetURL( | 3290 GURL url = test_server()->GetURL( |
3354 CreateServerRedirect("invalidscheme://www.google.com/test.html")); | 3291 CreateServerRedirect("invalidscheme://www.google.com/test.html")); |
3355 PrerenderTestURL(url, FINAL_STATUS_UNSUPPORTED_SCHEME, 0); | 3292 PrerenderTestURL(url, FINAL_STATUS_UNSUPPORTED_SCHEME, 0); |
3356 } | 3293 } |
3357 | 3294 |
3358 // Checks that media source video loads are deferred on prerendering. | 3295 // Checks that media source video loads are deferred on prerendering. |
3359 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHTML5MediaSourceVideo) { | 3296 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHTML5MediaSourceVideo) { |
3360 PrerenderTestURL("files/prerender/prerender_html5_video_media_source.html", | 3297 PrerenderTestURL("files/prerender/prerender_html5_video_media_source.html", |
3361 FINAL_STATUS_USED, | 3298 FINAL_STATUS_USED, |
3362 1); | 3299 1); |
3363 NavigateToDestUrlAndWaitForPassTitle(); | 3300 NavigateToDestURL(); |
3301 WaitForASCIITitle(GetActiveWebContents(), kPassTitle); | |
3364 } | 3302 } |
3365 | 3303 |
3366 // Checks that a prerender that creates an audio stream (via a WebAudioDevice) | 3304 // Checks that a prerender that creates an audio stream (via a WebAudioDevice) |
3367 // is cancelled. | 3305 // is cancelled. |
3368 // http://crbug.com/261489 | 3306 // http://crbug.com/261489 |
3369 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderWebAudioDevice) { | 3307 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderWebAudioDevice) { |
3370 PrerenderTestURL("files/prerender/prerender_web_audio_device.html", | 3308 PrerenderTestURL("files/prerender/prerender_web_audio_device.html", |
3371 FINAL_STATUS_CREATING_AUDIO_STREAM, 1); | 3309 FINAL_STATUS_CREATING_AUDIO_STREAM, 1); |
3372 } | 3310 } |
3373 | 3311 |
3374 // Checks that prerenders do not swap in to WebContents being captured. | 3312 // Checks that prerenders do not swap in to WebContents being captured. |
3375 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCapturedWebContents) { | 3313 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCapturedWebContents) { |
3376 PrerenderTestURL("files/prerender/prerender_page.html", | 3314 PrerenderTestURL("files/prerender/prerender_page.html", |
3377 FINAL_STATUS_PAGE_BEING_CAPTURED, 1); | 3315 FINAL_STATUS_PAGE_BEING_CAPTURED, 1); |
3378 WebContents* web_contents = | 3316 WebContents* web_contents = GetActiveWebContents(); |
3379 current_browser()->tab_strip_model()->GetActiveWebContents(); | |
3380 web_contents->IncrementCapturerCount(); | 3317 web_contents->IncrementCapturerCount(); |
3381 NavigateToDestURLWithDisposition(CURRENT_TAB, false); | 3318 NavigateToDestURLWithDisposition(CURRENT_TAB, false); |
3382 web_contents->DecrementCapturerCount(); | 3319 web_contents->DecrementCapturerCount(); |
3383 } | 3320 } |
3384 | 3321 |
3385 // Checks that prerenders are aborted on cross-process navigation from | 3322 // Checks that prerenders are aborted on cross-process navigation from |
3386 // a server redirect. | 3323 // a server redirect. |
3387 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 3324 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
3388 PrerenderCrossProcessServerRedirect) { | 3325 PrerenderCrossProcessServerRedirect) { |
3389 // Force everything to be a process swap. | 3326 // Force everything to be a process swap. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3434 GetPrerenderManager()->CancelAllPrerenders(); | 3371 GetPrerenderManager()->CancelAllPrerenders(); |
3435 prerenders[1]->WaitForStop(); | 3372 prerenders[1]->WaitForStop(); |
3436 | 3373 |
3437 // Check the referring page only got one copy of the event. | 3374 // Check the referring page only got one copy of the event. |
3438 EXPECT_FALSE(HadPrerenderEventErrors()); | 3375 EXPECT_FALSE(HadPrerenderEventErrors()); |
3439 } | 3376 } |
3440 | 3377 |
3441 // Checks that a deferred redirect to an image is not loaded until the | 3378 // Checks that a deferred redirect to an image is not loaded until the |
3442 // page is visible. | 3379 // page is visible. |
3443 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDeferredImage) { | 3380 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDeferredImage) { |
3444 // We do NOT wait for a load event, as the image will block the | 3381 DisableJavascriptCalls(); |
3445 // load. Instead, wait for the title to change. | 3382 |
3383 // The prerender will not completely load until after the swap, so wait for a | |
3384 // title change before calling DidPrerenderPass. | |
3446 scoped_ptr<TestPrerender> prerender = | 3385 scoped_ptr<TestPrerender> prerender = |
3447 PrerenderTestURL("files/prerender/prerender_deferred_image.html", | 3386 PrerenderTestURL( |
3448 FINAL_STATUS_USED, 0, true); | 3387 "files/prerender/prerender_deferred_image.html", |
3449 | 3388 FINAL_STATUS_USED, 0); |
3450 // The prerender hasn't loaded yet because its image is deferred. | 3389 WaitForASCIITitle(prerender->contents()->prerender_contents(), kReadyTitle); |
3390 EXPECT_TRUE(DidPrerenderPass(prerender->contents()->prerender_contents())); | |
3451 EXPECT_EQ(0, prerender->number_of_loads()); | 3391 EXPECT_EQ(0, prerender->number_of_loads()); |
3452 | 3392 |
3453 // Navigate, waiting for both the swap and an extra load from the prerender. | 3393 // Navigate, waiting for both the swap and an extra load from the prerender. |
3454 // The swap happens before the load, so |prerender->WaitForLoads(1)| doesn't | 3394 // The swap happens before the load, so |prerender->WaitForLoads(1)| doesn't |
3455 // work. | 3395 // work. |
3456 content::WindowedNotificationObserver page_load_observer( | 3396 content::WindowedNotificationObserver page_load_observer( |
3457 content::NOTIFICATION_LOAD_STOP, | 3397 content::NOTIFICATION_LOAD_STOP, |
3458 content::Source<NavigationController>( | 3398 content::Source<NavigationController>( |
3459 &prerender->contents()->prerender_contents()->GetController())); | 3399 &prerender->contents()->prerender_contents()->GetController())); |
3460 NavigationOrSwapObserver swap_observer( | 3400 NavigationOrSwapObserver swap_observer(current_browser()->tab_strip_model(), |
3461 current_browser()->tab_strip_model(), | 3401 GetActiveWebContents()); |
3462 current_browser()->tab_strip_model()->GetActiveWebContents()); | |
3463 ui_test_utils::NavigateToURLWithDisposition( | 3402 ui_test_utils::NavigateToURLWithDisposition( |
3464 current_browser(), dest_url(), CURRENT_TAB, | 3403 current_browser(), dest_url(), CURRENT_TAB, |
3465 ui_test_utils::BROWSER_TEST_NONE); | 3404 ui_test_utils::BROWSER_TEST_NONE); |
3466 swap_observer.Wait(); | 3405 swap_observer.Wait(); |
3467 page_load_observer.Wait(); | 3406 page_load_observer.Wait(); |
3468 | 3407 |
3469 // The prerender never observed the final load. | 3408 // The prerender never observed the final load. |
3470 EXPECT_EQ(0, prerender->number_of_loads()); | 3409 EXPECT_EQ(0, prerender->number_of_loads()); |
3471 | 3410 |
3472 // Now check DidDisplayPass. | 3411 // Now check DidDisplayPass. |
3473 EXPECT_TRUE(DidDisplayPass( | 3412 EXPECT_TRUE(DidDisplayPass(GetActiveWebContents())); |
3474 current_browser()->tab_strip_model()->GetActiveWebContents())); | |
3475 } | 3413 } |
3476 | 3414 |
3477 // Checks that a deferred redirect to an image is not loaded until the | 3415 // Checks that a deferred redirect to an image is not loaded until the |
3478 // page is visible, even after another redirect. | 3416 // page is visible, even after another redirect. |
3479 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 3417 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
3480 PrerenderDeferredImageAfterRedirect) { | 3418 PrerenderDeferredImageAfterRedirect) { |
3481 // We do NOT wait for a load event, as the image will block the | 3419 DisableJavascriptCalls(); |
3482 // load. Instead, wait for the title to change. | 3420 |
3421 // The prerender will not completely load until after the swap, so wait for a | |
3422 // title change before calling DidPrerenderPass. | |
3483 scoped_ptr<TestPrerender> prerender = | 3423 scoped_ptr<TestPrerender> prerender = |
3484 PrerenderTestURL( | 3424 PrerenderTestURL( |
3485 "files/prerender/prerender_deferred_image.html#double_redirect", | 3425 "files/prerender/prerender_deferred_image.html", |
3486 FINAL_STATUS_USED, 0, true); | 3426 FINAL_STATUS_USED, 0); |
3487 | 3427 WaitForASCIITitle(prerender->contents()->prerender_contents(), kReadyTitle); |
3488 // The prerender hasn't loaded yet because its image is deferred. | 3428 EXPECT_TRUE(DidPrerenderPass(prerender->contents()->prerender_contents())); |
3489 EXPECT_EQ(0, prerender->number_of_loads()); | 3429 EXPECT_EQ(0, prerender->number_of_loads()); |
3490 | 3430 |
3491 // Navigate, waiting for both the swap and an extra load from the prerender. | 3431 // Navigate, waiting for both the swap and an extra load from the prerender. |
3492 // The swap happens before the load, so |prerender->WaitForLoads(1)| doesn't | 3432 // The swap happens before the load, so |prerender->WaitForLoads(1)| doesn't |
3493 // work. | 3433 // work. |
3494 content::WindowedNotificationObserver page_load_observer( | 3434 content::WindowedNotificationObserver page_load_observer( |
3495 content::NOTIFICATION_LOAD_STOP, | 3435 content::NOTIFICATION_LOAD_STOP, |
3496 content::Source<NavigationController>( | 3436 content::Source<NavigationController>( |
3497 &prerender->contents()->prerender_contents()->GetController())); | 3437 &prerender->contents()->prerender_contents()->GetController())); |
3498 NavigationOrSwapObserver swap_observer( | 3438 NavigationOrSwapObserver swap_observer(current_browser()->tab_strip_model(), |
3499 current_browser()->tab_strip_model(), | 3439 GetActiveWebContents()); |
3500 current_browser()->tab_strip_model()->GetActiveWebContents()); | |
3501 ui_test_utils::NavigateToURLWithDisposition( | 3440 ui_test_utils::NavigateToURLWithDisposition( |
3502 current_browser(), dest_url(), CURRENT_TAB, | 3441 current_browser(), dest_url(), CURRENT_TAB, |
3503 ui_test_utils::BROWSER_TEST_NONE); | 3442 ui_test_utils::BROWSER_TEST_NONE); |
3504 swap_observer.Wait(); | 3443 swap_observer.Wait(); |
3505 page_load_observer.Wait(); | 3444 page_load_observer.Wait(); |
3506 | 3445 |
3507 // The prerender never observed the final load. | 3446 // The prerender never observed the final load. |
3508 EXPECT_EQ(0, prerender->number_of_loads()); | 3447 EXPECT_EQ(0, prerender->number_of_loads()); |
3509 | 3448 |
3510 // Now check DidDisplayPass. | 3449 // Now check DidDisplayPass. |
3511 EXPECT_TRUE(DidDisplayPass( | 3450 EXPECT_TRUE(DidDisplayPass(GetActiveWebContents())); |
3512 current_browser()->tab_strip_model()->GetActiveWebContents())); | |
3513 } | 3451 } |
3514 | 3452 |
3515 // Checks that deferred redirects in the main frame are followed. | 3453 // Checks that deferred redirects in the main frame are followed. |
3516 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDeferredMainFrame) { | 3454 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDeferredMainFrame) { |
3517 DisableJavascriptCalls(); | 3455 DisableJavascriptCalls(); |
3518 PrerenderTestURL( | 3456 PrerenderTestURL( |
3519 "files/prerender/image-deferred.png", | 3457 "files/prerender/image-deferred.png", |
3520 FINAL_STATUS_USED, 1); | 3458 FINAL_STATUS_USED, 1); |
3521 NavigateToDestURL(); | 3459 NavigateToDestURL(); |
3522 } | 3460 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3590 | 3528 |
3591 // Now navigate in the new tab. Set expect_swap_to_succeed to false because | 3529 // Now navigate in the new tab. Set expect_swap_to_succeed to false because |
3592 // the swap does not occur synchronously. | 3530 // the swap does not occur synchronously. |
3593 // | 3531 // |
3594 // TODO(davidben): When all swaps become asynchronous, remove the OpenURL | 3532 // TODO(davidben): When all swaps become asynchronous, remove the OpenURL |
3595 // return value assertion and let this go through the usual successful-swap | 3533 // return value assertion and let this go through the usual successful-swap |
3596 // codepath. | 3534 // codepath. |
3597 NavigateToDestURLWithDisposition(CURRENT_TAB, false); | 3535 NavigateToDestURLWithDisposition(CURRENT_TAB, false); |
3598 | 3536 |
3599 // Verify DidDisplayPass manually since the previous call skipped it. | 3537 // Verify DidDisplayPass manually since the previous call skipped it. |
3600 EXPECT_TRUE(DidDisplayPass( | 3538 EXPECT_TRUE(DidDisplayPass(GetActiveWebContents())); |
3601 current_browser()->tab_strip_model()->GetActiveWebContents())); | |
3602 } | 3539 } |
3603 | 3540 |
3604 // Verify that session storage conflicts don't merge. | 3541 // Verify that session storage conflicts don't merge. |
3605 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSessionStorageConflict) { | 3542 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSessionStorageConflict) { |
3606 PrerenderTestURL("files/prerender/prerender_session_storage_conflict.html", | 3543 PrerenderTestURL("files/prerender/prerender_session_storage_conflict.html", |
3607 FINAL_STATUS_APP_TERMINATING, 1); | 3544 FINAL_STATUS_APP_TERMINATING, 1); |
3608 | 3545 |
3609 // Open a new tab to navigate in. | 3546 // Open a new tab to navigate in. |
3610 ui_test_utils::NavigateToURLWithDisposition( | 3547 ui_test_utils::NavigateToURLWithDisposition( |
3611 current_browser(), | 3548 current_browser(), |
3612 test_server()->GetURL("files/prerender/init_session_storage.html"), | 3549 test_server()->GetURL("files/prerender/init_session_storage.html"), |
3613 NEW_FOREGROUND_TAB, | 3550 NEW_FOREGROUND_TAB, |
3614 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 3551 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
3615 | 3552 |
3616 // Now navigate in the new tab. | 3553 // Now navigate in the new tab. |
3617 NavigateToDestURLWithDisposition(CURRENT_TAB, false); | 3554 NavigateToDestURLWithDisposition(CURRENT_TAB, false); |
3618 | 3555 |
3619 // Verify DidDisplayPass in the new tab. | 3556 // Verify DidDisplayPass in the new tab. |
3620 EXPECT_TRUE(DidDisplayPass( | 3557 EXPECT_TRUE(DidDisplayPass(GetActiveWebContents())); |
3621 current_browser()->tab_strip_model()->GetActiveWebContents())); | |
3622 } | 3558 } |
3623 | 3559 |
3624 // Checks that prerenders honor |should_replace_current_entry|. | 3560 // Checks that prerenders honor |should_replace_current_entry|. |
3625 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderReplaceCurrentEntry) { | 3561 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderReplaceCurrentEntry) { |
3626 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); | 3562 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); |
3627 | 3563 |
3628 content::OpenURLParams params(dest_url(), Referrer(), CURRENT_TAB, | 3564 content::OpenURLParams params(dest_url(), Referrer(), CURRENT_TAB, |
3629 content::PAGE_TRANSITION_TYPED, false); | 3565 content::PAGE_TRANSITION_TYPED, false); |
3630 params.should_replace_current_entry = true; | 3566 params.should_replace_current_entry = true; |
3631 NavigateToURLWithParams(params, false); | 3567 NavigateToURLWithParams(params, false); |
3632 | 3568 |
3633 WebContents* web_contents = | 3569 const NavigationController& controller = |
3634 current_browser()->tab_strip_model()->GetActiveWebContents(); | 3570 GetActiveWebContents()->GetController(); |
3635 const NavigationController& controller = web_contents->GetController(); | |
3636 // First entry is about:blank, second is prerender_page.html. | 3571 // First entry is about:blank, second is prerender_page.html. |
3637 EXPECT_TRUE(controller.GetPendingEntry() == NULL); | 3572 EXPECT_TRUE(controller.GetPendingEntry() == NULL); |
3638 EXPECT_EQ(2, controller.GetEntryCount()); | 3573 EXPECT_EQ(2, controller.GetEntryCount()); |
3639 EXPECT_EQ(GURL(content::kAboutBlankURL), | 3574 EXPECT_EQ(GURL(content::kAboutBlankURL), |
3640 controller.GetEntryAtIndex(0)->GetURL()); | 3575 controller.GetEntryAtIndex(0)->GetURL()); |
3641 EXPECT_EQ(dest_url(), controller.GetEntryAtIndex(1)->GetURL()); | 3576 EXPECT_EQ(dest_url(), controller.GetEntryAtIndex(1)->GetURL()); |
3642 } | 3577 } |
3643 | 3578 |
3644 } // namespace prerender | 3579 } // namespace prerender |
OLD | NEW |