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 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
11 #include "base/test/test_timeouts.h" | 11 #include "base/test/test_timeouts.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/browser/browsing_data_helper.h" | 14 #include "chrome/browser/browsing_data_helper.h" |
15 #include "chrome/browser/browsing_data_remover.h" | 15 #include "chrome/browser/browsing_data_remover.h" |
16 #include "chrome/browser/content_settings/host_content_settings_map.h" | 16 #include "chrome/browser/content_settings/host_content_settings_map.h" |
17 #include "chrome/browser/favicon/favicon_tab_helper.h" | 17 #include "chrome/browser/favicon/favicon_tab_helper.h" |
18 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
19 #include "chrome/browser/prerender/prerender_contents.h" | 19 #include "chrome/browser/prerender/prerender_contents.h" |
| 20 #include "chrome/browser/prerender/prerender_handle.h" |
20 #include "chrome/browser/prerender/prerender_link_manager.h" | 21 #include "chrome/browser/prerender/prerender_link_manager.h" |
21 #include "chrome/browser/prerender/prerender_link_manager_factory.h" | 22 #include "chrome/browser/prerender/prerender_link_manager_factory.h" |
22 #include "chrome/browser/prerender/prerender_manager.h" | 23 #include "chrome/browser/prerender/prerender_manager.h" |
23 #include "chrome/browser/prerender/prerender_manager_factory.h" | 24 #include "chrome/browser/prerender/prerender_manager_factory.h" |
24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 26 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
26 #include "chrome/browser/task_manager/task_manager.h" | 27 #include "chrome/browser/task_manager/task_manager.h" |
27 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" | 28 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" |
28 #include "chrome/browser/ui/browser.h" | 29 #include "chrome/browser/ui/browser.h" |
29 #include "chrome/browser/ui/browser_commands.h" | 30 #include "chrome/browser/ui/browser_commands.h" |
30 #include "chrome/browser/ui/browser_finder.h" | 31 #include "chrome/browser/ui/browser_finder.h" |
31 #include "chrome/browser/ui/browser_tabstrip.h" | 32 #include "chrome/browser/ui/browser_tabstrip.h" |
32 #include "chrome/browser/ui/browser_window.h" | 33 #include "chrome/browser/ui/browser_window.h" |
| 34 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
33 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 35 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
34 #include "chrome/common/chrome_notification_types.h" | 36 #include "chrome/common/chrome_notification_types.h" |
35 #include "chrome/common/chrome_paths.h" | 37 #include "chrome/common/chrome_paths.h" |
36 #include "chrome/common/chrome_switches.h" | 38 #include "chrome/common/chrome_switches.h" |
37 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
38 #include "chrome/test/base/in_process_browser_test.h" | 40 #include "chrome/test/base/in_process_browser_test.h" |
39 #include "chrome/test/base/ui_test_utils.h" | 41 #include "chrome/test/base/ui_test_utils.h" |
40 #include "content/public/browser/devtools_agent_host_registry.h" | 42 #include "content/public/browser/devtools_agent_host_registry.h" |
41 #include "content/public/browser/devtools_client_host.h" | 43 #include "content/public/browser/devtools_client_host.h" |
42 #include "content/public/browser/devtools_manager.h" | 44 #include "content/public/browser/devtools_manager.h" |
43 #include "content/public/browser/notification_service.h" | 45 #include "content/public/browser/notification_service.h" |
44 #include "content/public/browser/render_view_host.h" | 46 #include "content/public/browser/render_view_host.h" |
45 #include "content/public/browser/web_contents.h" | 47 #include "content/public/browser/web_contents.h" |
46 #include "content/public/common/url_constants.h" | 48 #include "content/public/common/url_constants.h" |
| 49 #include "content/public/test/test_navigation_observer.h" |
47 #include "grit/generated_resources.h" | 50 #include "grit/generated_resources.h" |
48 #include "net/base/mock_host_resolver.h" | 51 #include "net/base/mock_host_resolver.h" |
49 #include "net/url_request/url_request_context.h" | 52 #include "net/url_request/url_request_context.h" |
50 #include "net/url_request/url_request_context_getter.h" | 53 #include "net/url_request/url_request_context_getter.h" |
51 #include "ui/base/l10n/l10n_util.h" | 54 #include "ui/base/l10n/l10n_util.h" |
52 | 55 |
53 using content::BrowserThread; | 56 using content::BrowserThread; |
54 using content::DevToolsAgentHost; | 57 using content::DevToolsAgentHost; |
55 using content::DevToolsAgentHostRegistry; | 58 using content::DevToolsAgentHostRegistry; |
56 using content::DevToolsClientHost; | 59 using content::DevToolsClientHost; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 prerender_manager->CancelAllPrerenders(); | 107 prerender_manager->CancelAllPrerenders(); |
105 } | 108 } |
106 | 109 |
107 // Returns true if and only if the final status is one in which the prerendered | 110 // Returns true if and only if the final status is one in which the prerendered |
108 // page should prerender correctly. The page still may not be used. | 111 // page should prerender correctly. The page still may not be used. |
109 bool ShouldRenderPrerenderedPageCorrectly(FinalStatus status) { | 112 bool ShouldRenderPrerenderedPageCorrectly(FinalStatus status) { |
110 switch (status) { | 113 switch (status) { |
111 case FINAL_STATUS_USED: | 114 case FINAL_STATUS_USED: |
112 case FINAL_STATUS_WINDOW_OPENER: | 115 case FINAL_STATUS_WINDOW_OPENER: |
113 case FINAL_STATUS_APP_TERMINATING: | 116 case FINAL_STATUS_APP_TERMINATING: |
114 case FINAL_STATUS_FRAGMENT_MISMATCH: | |
115 case FINAL_STATUS_CACHE_OR_HISTORY_CLEARED: | 117 case FINAL_STATUS_CACHE_OR_HISTORY_CLEARED: |
116 // We'll crash the renderer after it's loaded. | 118 // We'll crash the renderer after it's loaded. |
117 case FINAL_STATUS_RENDERER_CRASHED: | 119 case FINAL_STATUS_RENDERER_CRASHED: |
118 case FINAL_STATUS_CANCELLED: | 120 case FINAL_STATUS_CANCELLED: |
119 case FINAL_STATUS_DEVTOOLS_ATTACHED: | 121 case FINAL_STATUS_DEVTOOLS_ATTACHED: |
120 case FINAL_STATUS_SESSION_STORAGE_NAMESPACE_MISMATCH: | |
121 return true; | 122 return true; |
122 default: | 123 default: |
123 return false; | 124 return false; |
124 } | 125 } |
125 } | 126 } |
126 | 127 |
127 // PrerenderContents that stops the UI message loop on DidStopLoading(). | 128 // PrerenderContents that stops the UI message loop on DidStopLoading(). |
128 class TestPrerenderContents : public PrerenderContents { | 129 class TestPrerenderContents : public PrerenderContents { |
129 public: | 130 public: |
130 TestPrerenderContents( | 131 TestPrerenderContents( |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 221 |
221 virtual void DidStopLoading() OVERRIDE { | 222 virtual void DidStopLoading() OVERRIDE { |
222 PrerenderContents::DidStopLoading(); | 223 PrerenderContents::DidStopLoading(); |
223 ++number_of_loads_; | 224 ++number_of_loads_; |
224 if (ShouldRenderPrerenderedPageCorrectly(expected_final_status_) && | 225 if (ShouldRenderPrerenderedPageCorrectly(expected_final_status_) && |
225 number_of_loads_ == expected_number_of_loads_) { | 226 number_of_loads_ == expected_number_of_loads_) { |
226 MessageLoopForUI::current()->Quit(); | 227 MessageLoopForUI::current()->Quit(); |
227 } | 228 } |
228 } | 229 } |
229 | 230 |
230 virtual void AddPendingPrerender(const GURL& url, | 231 virtual void AddPendingPrerender( |
231 const content::Referrer& referrer, | 232 base::WeakPtr<PrerenderHandle> weak_prerender_handle, |
232 const gfx::Size& size) OVERRIDE { | 233 const GURL& url, |
233 PrerenderContents::AddPendingPrerender(url, referrer, size); | 234 const content::Referrer& referrer, |
| 235 const gfx::Size& size) OVERRIDE { |
| 236 PrerenderContents::AddPendingPrerender( |
| 237 weak_prerender_handle, url, referrer, size); |
234 if (expected_pending_prerenders_ > 0 && | 238 if (expected_pending_prerenders_ > 0 && |
235 pending_prerender_list()->size() == expected_pending_prerenders_) { | 239 pending_prerenders()->size() == expected_pending_prerenders_) { |
236 MessageLoop::current()->Quit(); | 240 MessageLoop::current()->Quit(); |
237 } | 241 } |
238 } | 242 } |
239 | 243 |
240 virtual WebContents* CreateWebContents( | 244 virtual WebContents* CreateWebContents( |
241 content::SessionStorageNamespace* session_storage_namespace) OVERRIDE { | 245 content::SessionStorageNamespace* session_storage_namespace) OVERRIDE { |
242 WebContents* web_contents = PrerenderContents::CreateWebContents( | 246 WebContents* web_contents = PrerenderContents::CreateWebContents( |
243 session_storage_namespace); | 247 session_storage_namespace); |
244 string16 ready_title = ASCIIToUTF16(kReadyTitle); | 248 string16 ready_title = ASCIIToUTF16(kReadyTitle); |
245 if (prerender_should_wait_for_ready_title_) | 249 if (prerender_should_wait_for_ready_title_) |
246 ready_title_watcher_.reset(new ui_test_utils::TitleWatcher( | 250 ready_title_watcher_.reset(new ui_test_utils::TitleWatcher( |
247 web_contents, ready_title)); | 251 web_contents, ready_title)); |
248 return web_contents; | 252 return web_contents; |
249 } | 253 } |
250 | 254 |
251 void WaitForPrerenderToHaveReadyTitleIfRequired() { | 255 void WaitForPrerenderToHaveReadyTitleIfRequired() { |
252 if (ready_title_watcher_.get()) { | 256 if (ready_title_watcher_.get()) { |
253 string16 ready_title = ASCIIToUTF16(kReadyTitle); | 257 string16 ready_title = ASCIIToUTF16(kReadyTitle); |
254 ASSERT_EQ(ready_title, ready_title_watcher_->WaitAndGetTitle()); | 258 ASSERT_EQ(ready_title, ready_title_watcher_->WaitAndGetTitle()); |
255 } | 259 } |
256 } | 260 } |
257 | 261 |
258 // Waits until the prerender has |expected_pending_prerenders| pending | 262 // Waits until the prerender has |expected_pending_prerenders| pending |
259 // prerenders. | 263 // prerenders. |
260 void WaitForPendingPrerenders(size_t expected_pending_prerenders) { | 264 void WaitForPendingPrerenders(size_t expected_pending_prerenders) { |
261 if (pending_prerender_list()->size() < expected_pending_prerenders) { | 265 if (pending_prerenders()->size() < expected_pending_prerenders) { |
262 expected_pending_prerenders_ = expected_pending_prerenders; | 266 expected_pending_prerenders_ = expected_pending_prerenders; |
263 ui_test_utils::RunMessageLoop(); | 267 ui_test_utils::RunMessageLoop(); |
264 expected_pending_prerenders_ = 0; | 268 expected_pending_prerenders_ = 0; |
265 } | 269 } |
266 | 270 |
267 EXPECT_EQ(expected_pending_prerenders, pending_prerender_list()->size()); | 271 EXPECT_EQ(expected_pending_prerenders, pending_prerenders()->size()); |
| 272 } |
| 273 |
| 274 bool UrlIsPending(const GURL& url) const { |
| 275 for (std::vector<PendingPrerenderInfo>::const_iterator |
| 276 it = pending_prerenders()->begin(), |
| 277 end = pending_prerenders()->end(); |
| 278 it != end; |
| 279 ++it) { |
| 280 if (it->url == url && it->weak_prerender_handle) { |
| 281 EXPECT_TRUE(IsPendingEntry(*it->weak_prerender_handle)); |
| 282 EXPECT_TRUE(it->weak_prerender_handle->IsPending()); |
| 283 return true; |
| 284 } |
| 285 } |
| 286 return false; |
268 } | 287 } |
269 | 288 |
270 // For tests that open the prerender in a new background tab, the RenderView | 289 // For tests that open the prerender in a new background tab, the RenderView |
271 // will not have been made visible when the PrerenderContents is destroyed | 290 // will not have been made visible when the PrerenderContents is destroyed |
272 // even though it is used. | 291 // even though it is used. |
273 void set_should_be_shown(bool value) { should_be_shown_ = value; } | 292 void set_should_be_shown(bool value) { should_be_shown_ = value; } |
274 | 293 |
275 int number_of_loads() const { return number_of_loads_; } | 294 int number_of_loads() const { return number_of_loads_; } |
276 | 295 |
| 296 FinalStatus expected_final_status() const { return expected_final_status_; } |
| 297 |
277 private: | 298 private: |
278 virtual void OnRenderViewHostCreated( | 299 virtual void OnRenderViewHostCreated( |
279 RenderViewHost* new_render_view_host) OVERRIDE { | 300 RenderViewHost* new_render_view_host) OVERRIDE { |
280 // Used to make sure the RenderViewHost is hidden and, if used, | 301 // Used to make sure the RenderViewHost is hidden and, if used, |
281 // subsequently shown. | 302 // subsequently shown. |
282 notification_registrar().Add( | 303 notification_registrar().Add( |
283 this, | 304 this, |
284 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, | 305 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
285 content::Source<RenderWidgetHost>(new_render_view_host)); | 306 content::Source<RenderWidgetHost>(new_render_view_host)); |
286 | 307 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 #endif | 504 #endif |
484 use_https_src_server_(false), | 505 use_https_src_server_(false), |
485 call_javascript_(true), | 506 call_javascript_(true), |
486 loader_path_("files/prerender/prerender_loader.html"), | 507 loader_path_("files/prerender/prerender_loader.html"), |
487 explicitly_set_browser_(NULL) { | 508 explicitly_set_browser_(NULL) { |
488 EnableDOMAutomation(); | 509 EnableDOMAutomation(); |
489 } | 510 } |
490 | 511 |
491 virtual ~PrerenderBrowserTest() {} | 512 virtual ~PrerenderBrowserTest() {} |
492 | 513 |
| 514 content::SessionStorageNamespace* GetSessionStorageNamespace() const { |
| 515 TabContents* tab_contents = |
| 516 current_browser()->tab_strip_model()->GetActiveTabContents(); |
| 517 if (!tab_contents) |
| 518 return NULL; |
| 519 return tab_contents->web_contents()->GetRenderViewHost()-> |
| 520 GetSessionStorageNamespace(); |
| 521 } |
| 522 |
493 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 523 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
494 #if defined(ENABLE_SAFE_BROWSING) | 524 #if defined(ENABLE_SAFE_BROWSING) |
495 SafeBrowsingService::RegisterFactory(safe_browsing_factory_.get()); | 525 SafeBrowsingService::RegisterFactory(safe_browsing_factory_.get()); |
496 #endif | 526 #endif |
497 } | 527 } |
498 | 528 |
499 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 529 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
500 command_line->AppendSwitchASCII(switches::kPrerenderMode, | 530 command_line->AppendSwitchASCII(switches::kPrerenderMode, |
501 switches::kPrerenderModeSwitchValueEnabled); | 531 switches::kPrerenderModeSwitchValueEnabled); |
502 #if defined(OS_MACOSX) | 532 #if defined(OS_MACOSX) |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 &js_result)); | 726 &js_result)); |
697 EXPECT_TRUE(js_result); | 727 EXPECT_TRUE(js_result); |
698 } | 728 } |
699 | 729 |
700 void NavigateToURL(const std::string& dest_html_file) const { | 730 void NavigateToURL(const std::string& dest_html_file) const { |
701 GURL dest_url = test_server()->GetURL(dest_html_file); | 731 GURL dest_url = test_server()->GetURL(dest_html_file); |
702 NavigateToURLImpl(dest_url, CURRENT_TAB); | 732 NavigateToURLImpl(dest_url, CURRENT_TAB); |
703 } | 733 } |
704 | 734 |
705 bool UrlIsInPrerenderManager(const std::string& html_file) const { | 735 bool UrlIsInPrerenderManager(const std::string& html_file) const { |
706 GURL dest_url = test_server()->GetURL(html_file); | 736 return UrlIsInPrerenderManager(test_server()->GetURL(html_file)); |
707 return (GetPrerenderManager()->FindEntry(dest_url) != NULL); | |
708 } | 737 } |
709 | 738 |
710 bool UrlIsInPrerenderManager(const GURL& url) { | 739 bool UrlIsInPrerenderManager(const GURL& url) const { |
711 return (GetPrerenderManager()->FindEntry(url) != NULL); | 740 return GetPrerenderManager()->FindPrerenderData( |
| 741 url, GetSessionStorageNamespace()) != NULL; |
712 } | 742 } |
713 | 743 |
714 bool UrlIsPendingInPrerenderManager(const std::string& html_file) const { | 744 // This only checks to see if the URL is pending in our TestPrerenderContents. |
| 745 bool UrlIsPending(const std::string& html_file) const { |
| 746 TestPrerenderContents* test_prerender_contents = GetPrerenderContents(); |
| 747 if (!test_prerender_contents) |
| 748 return false; |
715 GURL dest_url = test_server()->GetURL(html_file); | 749 GURL dest_url = test_server()->GetURL(html_file); |
716 return GetPrerenderManager()->IsPendingEntry(dest_url); | 750 return test_prerender_contents->UrlIsPending(dest_url); |
717 } | 751 } |
718 | 752 |
719 void set_use_https_src(bool use_https_src_server) { | 753 void set_use_https_src(bool use_https_src_server) { |
720 use_https_src_server_ = use_https_src_server; | 754 use_https_src_server_ = use_https_src_server; |
721 } | 755 } |
722 | 756 |
723 void DisableJavascriptCalls() { | 757 void DisableJavascriptCalls() { |
724 call_javascript_ = false; | 758 call_javascript_ = false; |
725 } | 759 } |
726 | 760 |
(...skipping 30 matching lines...) Expand all Loading... |
757 return static_cast<int>(history_list->GetSize()); | 791 return static_cast<int>(history_list->GetSize()); |
758 } | 792 } |
759 | 793 |
760 #if defined(ENABLE_SAFE_BROWSING) | 794 #if defined(ENABLE_SAFE_BROWSING) |
761 FakeSafeBrowsingService* GetSafeBrowsingService() { | 795 FakeSafeBrowsingService* GetSafeBrowsingService() { |
762 return safe_browsing_factory_->most_recent_service(); | 796 return safe_browsing_factory_->most_recent_service(); |
763 } | 797 } |
764 #endif | 798 #endif |
765 | 799 |
766 TestPrerenderContents* GetPrerenderContents() const { | 800 TestPrerenderContents* GetPrerenderContents() const { |
| 801 PrerenderManager::PrerenderData* prerender_data = |
| 802 GetPrerenderManager()->FindPrerenderData( |
| 803 dest_url_, GetSessionStorageNamespace()); |
767 return static_cast<TestPrerenderContents*>( | 804 return static_cast<TestPrerenderContents*>( |
768 GetPrerenderManager()->FindEntry(dest_url_)); | 805 prerender_data ? prerender_data->contents : NULL); |
769 } | 806 } |
770 | 807 |
771 void set_loader_path(const std::string& path) { | 808 void set_loader_path(const std::string& path) { |
772 loader_path_ = path; | 809 loader_path_ = path; |
773 } | 810 } |
774 | 811 |
775 void set_loader_query_and_fragment(const std::string& query_and_fragment) { | 812 void set_loader_query_and_fragment(const std::string& query_and_fragment) { |
776 loader_query_and_fragment_ = query_and_fragment; | 813 loader_query_and_fragment_ = query_and_fragment; |
777 } | 814 } |
778 | 815 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 bool prerender_test_result = false; | 912 bool prerender_test_result = false; |
876 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 913 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
877 prerender_contents->GetRenderViewHostMutable(), L"", | 914 prerender_contents->GetRenderViewHostMutable(), L"", |
878 L"window.domAutomationController.send(DidPrerenderPass())", | 915 L"window.domAutomationController.send(DidPrerenderPass())", |
879 &prerender_test_result)); | 916 &prerender_test_result)); |
880 EXPECT_TRUE(prerender_test_result); | 917 EXPECT_TRUE(prerender_test_result); |
881 } | 918 } |
882 } else { | 919 } else { |
883 // In the failure case, we should have removed |dest_url_| from the | 920 // In the failure case, we should have removed |dest_url_| from the |
884 // prerender_manager. We ignore dummy PrerenderContents (as indicated | 921 // prerender_manager. We ignore dummy PrerenderContents (as indicated |
885 // by not having started). | 922 // by not having started), and PrerenderContents that are expected to |
| 923 // be left in the manager until the test finishes. |
886 EXPECT_TRUE(prerender_contents == NULL || | 924 EXPECT_TRUE(prerender_contents == NULL || |
887 !prerender_contents->prerendering_has_started()); | 925 !prerender_contents->prerendering_has_started()); |
888 } | 926 } |
889 } | 927 } |
890 | 928 |
891 void NavigateToURLImpl(const GURL& dest_url, | 929 void NavigateToURLImpl(const GURL& dest_url, |
892 WindowOpenDisposition disposition) const { | 930 WindowOpenDisposition disposition) const { |
893 ASSERT_TRUE(GetPrerenderManager() != NULL); | 931 ASSERT_TRUE(GetPrerenderManager() != NULL); |
894 // Make sure in navigating we have a URL to use in the PrerenderManager. | 932 // Make sure in navigating we have a URL to use in the PrerenderManager. |
895 ASSERT_TRUE(GetPrerenderContents() != NULL); | 933 ASSERT_TRUE(GetPrerenderContents() != NULL); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 // Opens the prerendered page using javascript functions in the | 980 // Opens the prerendered page using javascript functions in the |
943 // loader page. |javascript_function_name| should be a 0 argument function | 981 // loader page. |javascript_function_name| should be a 0 argument function |
944 // which is invoked. | 982 // which is invoked. |
945 void OpenDestURLWithJSImpl(const std::string& javascript_function_name) | 983 void OpenDestURLWithJSImpl(const std::string& javascript_function_name) |
946 const { | 984 const { |
947 TestPrerenderContents* prerender_contents = GetPrerenderContents(); | 985 TestPrerenderContents* prerender_contents = GetPrerenderContents(); |
948 ASSERT_TRUE(prerender_contents != NULL); | 986 ASSERT_TRUE(prerender_contents != NULL); |
949 | 987 |
950 RenderViewHost* render_view_host = | 988 RenderViewHost* render_view_host = |
951 chrome::GetActiveWebContents(current_browser())->GetRenderViewHost(); | 989 chrome::GetActiveWebContents(current_browser())->GetRenderViewHost(); |
952 render_view_host->ExecuteJavascriptInWebFrame( | |
953 string16(), | |
954 ASCIIToUTF16(javascript_function_name)); | |
955 | 990 |
956 // Run message loop until the prerender contents is destroyed. | 991 if (prerender_contents->expected_final_status() != |
957 ui_test_utils::RunMessageLoop(); | 992 FINAL_STATUS_APP_TERMINATING) { |
| 993 render_view_host->ExecuteJavascriptInWebFrame( |
| 994 string16(), ASCIIToUTF16(javascript_function_name)); |
| 995 // Run message loop until the prerender contents is destroyed. |
| 996 ui_test_utils::RunMessageLoop(); |
| 997 } else { |
| 998 // We don't expect to pick up a running prerender, so instead |
| 999 // observe one navigation. |
| 1000 content::TestNavigationObserver observer( |
| 1001 content::NotificationService::AllSources(), NULL, 1); |
| 1002 render_view_host->ExecuteJavascriptInWebFrame( |
| 1003 string16(), ASCIIToUTF16(javascript_function_name)); |
| 1004 base::RunLoop run_loop; |
| 1005 observer.WaitForObservation( |
| 1006 base::Bind(&ui_test_utils::RunThisRunLoop, |
| 1007 base::Unretained(&run_loop)), |
| 1008 ui_test_utils::GetQuitTaskForRunLoop(&run_loop)); |
| 1009 } |
958 } | 1010 } |
959 | 1011 |
960 WaitForLoadPrerenderContentsFactory* prerender_contents_factory_; | 1012 WaitForLoadPrerenderContentsFactory* prerender_contents_factory_; |
961 #if defined(ENABLE_SAFE_BROWSING) | 1013 #if defined(ENABLE_SAFE_BROWSING) |
962 scoped_ptr<TestSafeBrowsingServiceFactory> safe_browsing_factory_; | 1014 scoped_ptr<TestSafeBrowsingServiceFactory> safe_browsing_factory_; |
963 #endif | 1015 #endif |
964 GURL dest_url_; | 1016 GURL dest_url_; |
965 bool use_https_src_server_; | 1017 bool use_https_src_server_; |
966 bool call_javascript_; | 1018 bool call_javascript_; |
967 std::string loader_path_; | 1019 std::string loader_path_; |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1430 std::deque<FinalStatus> expected_final_status_queue; | 1482 std::deque<FinalStatus> expected_final_status_queue; |
1431 expected_final_status_queue.push_back(FINAL_STATUS_USED); | 1483 expected_final_status_queue.push_back(FINAL_STATUS_USED); |
1432 expected_final_status_queue.push_back(FINAL_STATUS_APP_TERMINATING); | 1484 expected_final_status_queue.push_back(FINAL_STATUS_APP_TERMINATING); |
1433 | 1485 |
1434 PrerenderTestURL(kHtmlFileA, expected_final_status_queue, 1); | 1486 PrerenderTestURL(kHtmlFileA, expected_final_status_queue, 1); |
1435 ASSERT_TRUE(GetPrerenderContents()); | 1487 ASSERT_TRUE(GetPrerenderContents()); |
1436 GetPrerenderContents()->WaitForPendingPrerenders(1u); | 1488 GetPrerenderContents()->WaitForPendingPrerenders(1u); |
1437 | 1489 |
1438 // Next url should be in pending list but not an active entry. | 1490 // Next url should be in pending list but not an active entry. |
1439 EXPECT_FALSE(UrlIsInPrerenderManager(kHtmlFileB)); | 1491 EXPECT_FALSE(UrlIsInPrerenderManager(kHtmlFileB)); |
1440 EXPECT_TRUE(UrlIsPendingInPrerenderManager(kHtmlFileB)); | 1492 EXPECT_TRUE(UrlIsPending(kHtmlFileB)); |
1441 | 1493 |
1442 NavigateToDestURL(); | 1494 NavigateToDestURL(); |
1443 | 1495 |
1444 // Make sure the PrerenderContents for the next url is now in the manager | 1496 // Make sure the PrerenderContents for the next url is now in the manager |
1445 // and not pending. | 1497 // and not pending. |
1446 EXPECT_TRUE(UrlIsInPrerenderManager(kHtmlFileB)); | 1498 EXPECT_TRUE(UrlIsInPrerenderManager(kHtmlFileB)); |
1447 EXPECT_FALSE(UrlIsPendingInPrerenderManager(kHtmlFileB)); | 1499 EXPECT_FALSE(UrlIsPending(kHtmlFileB)); |
1448 } | 1500 } |
1449 | 1501 |
1450 // Checks that we don't prerender in an infinite loop and multiple links are | 1502 // Checks that we don't prerender in an infinite loop and multiple links are |
1451 // handled correctly. | 1503 // handled correctly. |
1452 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderInfiniteLoopMultiple) { | 1504 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderInfiniteLoopMultiple) { |
1453 const char* const kHtmlFileA = | 1505 const char* const kHtmlFileA = |
1454 "files/prerender/prerender_infinite_a_multiple.html"; | 1506 "files/prerender/prerender_infinite_a_multiple.html"; |
1455 const char* const kHtmlFileB = | 1507 const char* const kHtmlFileB = |
1456 "files/prerender/prerender_infinite_b_multiple.html"; | 1508 "files/prerender/prerender_infinite_b_multiple.html"; |
1457 const char* const kHtmlFileC = | 1509 const char* const kHtmlFileC = |
1458 "files/prerender/prerender_infinite_c_multiple.html"; | 1510 "files/prerender/prerender_infinite_c_multiple.html"; |
1459 | 1511 |
1460 // We need to set the final status to expect here before starting any | 1512 // We need to set the final status to expect here before starting any |
1461 // prerenders. We set them on a queue so whichever we see first is expected to | 1513 // prerenders. We set them on a queue so whichever we see first is expected to |
1462 // be evicted, and the second should stick around until we exit. | 1514 // be evicted, and the second should stick around until we exit. |
1463 std::deque<FinalStatus> expected_final_status_queue; | 1515 std::deque<FinalStatus> expected_final_status_queue; |
1464 expected_final_status_queue.push_back(FINAL_STATUS_USED); | 1516 expected_final_status_queue.push_back(FINAL_STATUS_USED); |
1465 expected_final_status_queue.push_back(FINAL_STATUS_EVICTED); | 1517 expected_final_status_queue.push_back(FINAL_STATUS_EVICTED); |
1466 expected_final_status_queue.push_back(FINAL_STATUS_APP_TERMINATING); | 1518 expected_final_status_queue.push_back(FINAL_STATUS_APP_TERMINATING); |
1467 | 1519 |
1468 PrerenderTestURL(kHtmlFileA, expected_final_status_queue, 1); | 1520 PrerenderTestURL(kHtmlFileA, expected_final_status_queue, 1); |
1469 ASSERT_TRUE(GetPrerenderContents()); | 1521 ASSERT_TRUE(GetPrerenderContents()); |
1470 GetPrerenderContents()->WaitForPendingPrerenders(2u); | 1522 GetPrerenderContents()->WaitForPendingPrerenders(2u); |
1471 | 1523 |
1472 // Next url should be in pending list but not an active entry. | 1524 // Next url should be in pending list but not an active entry. |
1473 EXPECT_FALSE(UrlIsInPrerenderManager(kHtmlFileB)); | 1525 EXPECT_FALSE(UrlIsInPrerenderManager(kHtmlFileB)); |
1474 EXPECT_FALSE(UrlIsInPrerenderManager(kHtmlFileC)); | 1526 EXPECT_FALSE(UrlIsInPrerenderManager(kHtmlFileC)); |
1475 EXPECT_TRUE(UrlIsPendingInPrerenderManager(kHtmlFileB)); | 1527 EXPECT_TRUE(UrlIsPending(kHtmlFileB)); |
1476 EXPECT_TRUE(UrlIsPendingInPrerenderManager(kHtmlFileC)); | 1528 EXPECT_TRUE(UrlIsPending(kHtmlFileC)); |
1477 | 1529 |
1478 NavigateToDestURL(); | 1530 NavigateToDestURL(); |
1479 | 1531 |
1480 // Make sure the PrerenderContents for the next urls are now in the manager | 1532 // Make sure the PrerenderContents for the next urls are now in the manager |
1481 // and not pending. One and only one of the URLs (the last seen) should be the | 1533 // and not pending. One and only one of the URLs (the last seen) should be the |
1482 // active entry. | 1534 // active entry. |
1483 bool url_b_is_active_prerender = UrlIsInPrerenderManager(kHtmlFileB); | 1535 bool url_b_is_active_prerender = UrlIsInPrerenderManager(kHtmlFileB); |
1484 bool url_c_is_active_prerender = UrlIsInPrerenderManager(kHtmlFileC); | 1536 bool url_c_is_active_prerender = UrlIsInPrerenderManager(kHtmlFileC); |
1485 EXPECT_TRUE((url_b_is_active_prerender || url_c_is_active_prerender) && | 1537 EXPECT_TRUE((url_b_is_active_prerender || url_c_is_active_prerender) && |
1486 !(url_b_is_active_prerender && url_c_is_active_prerender)); | 1538 !(url_b_is_active_prerender && url_c_is_active_prerender)); |
1487 EXPECT_FALSE(UrlIsPendingInPrerenderManager(kHtmlFileB)); | 1539 EXPECT_FALSE(UrlIsPending(kHtmlFileB)); |
1488 EXPECT_FALSE(UrlIsPendingInPrerenderManager(kHtmlFileC)); | 1540 EXPECT_FALSE(UrlIsPending(kHtmlFileC)); |
1489 } | 1541 } |
1490 | 1542 |
1491 // See crbug.com/131836. | 1543 // See crbug.com/131836. |
1492 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderTaskManager) { | 1544 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderTaskManager) { |
1493 // Show the task manager. This populates the model. | 1545 // Show the task manager. This populates the model. |
1494 current_browser()->window()->ShowTaskManager(); | 1546 current_browser()->window()->ShowTaskManager(); |
1495 // Wait for the model of task manager to start. | 1547 // Wait for the model of task manager to start. |
1496 TaskManagerBrowserTestUtil::WaitForResourceChange(2); | 1548 TaskManagerBrowserTestUtil::WaitForResourceChange(2); |
1497 | 1549 |
1498 // Start with two resources. | 1550 // Start with two resources. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 std::string()); | 1683 std::string()); |
1632 ui_test_utils::RunMessageLoop(); | 1684 ui_test_utils::RunMessageLoop(); |
1633 } | 1685 } |
1634 | 1686 |
1635 // Checks that we correctly use a prerendered page when navigating to a | 1687 // Checks that we correctly use a prerendered page when navigating to a |
1636 // fragment. | 1688 // fragment. |
1637 // DISABLED: http://crbug.com/84154 | 1689 // DISABLED: http://crbug.com/84154 |
1638 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1690 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
1639 DISABLED_PrerenderPageNavigateFragment) { | 1691 DISABLED_PrerenderPageNavigateFragment) { |
1640 PrerenderTestURL("files/prerender/prerender_fragment.html", | 1692 PrerenderTestURL("files/prerender/prerender_fragment.html", |
1641 FINAL_STATUS_FRAGMENT_MISMATCH, | 1693 FINAL_STATUS_APP_TERMINATING, |
1642 1); | 1694 1); |
1643 NavigateToURL("files/prerender/prerender_fragment.html#fragment"); | 1695 NavigateToURL("files/prerender/prerender_fragment.html#fragment"); |
1644 } | 1696 } |
1645 | 1697 |
1646 // Checks that we correctly use a prerendered page when we prerender a fragment | 1698 // Checks that we correctly use a prerendered page when we prerender a fragment |
1647 // but navigate to the main page. | 1699 // but navigate to the main page. |
1648 // http://crbug.com/83901 | 1700 // http://crbug.com/83901 |
1649 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1701 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
1650 DISABLED_PrerenderFragmentNavigatePage) { | 1702 DISABLED_PrerenderFragmentNavigatePage) { |
1651 PrerenderTestURL("files/prerender/prerender_fragment.html#fragment", | 1703 PrerenderTestURL("files/prerender/prerender_fragment.html#fragment", |
1652 FINAL_STATUS_FRAGMENT_MISMATCH, | 1704 FINAL_STATUS_APP_TERMINATING, |
1653 1); | 1705 1); |
1654 NavigateToURL("files/prerender/prerender_fragment.html"); | 1706 NavigateToURL("files/prerender/prerender_fragment.html"); |
1655 } | 1707 } |
1656 | 1708 |
1657 // Checks that we correctly use a prerendered page when we prerender a fragment | 1709 // Checks that we correctly use a prerendered page when we prerender a fragment |
1658 // but navigate to a different fragment on the same page. | 1710 // but navigate to a different fragment on the same page. |
1659 // DISABLED: http://crbug.com/84154 | 1711 // DISABLED: http://crbug.com/84154 |
1660 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1712 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
1661 DISABLED_PrerenderFragmentNavigateFragment) { | 1713 DISABLED_PrerenderFragmentNavigateFragment) { |
1662 PrerenderTestURL("files/prerender/prerender_fragment.html#other_fragment", | 1714 PrerenderTestURL("files/prerender/prerender_fragment.html#other_fragment", |
1663 FINAL_STATUS_FRAGMENT_MISMATCH, | 1715 FINAL_STATUS_APP_TERMINATING, |
1664 1); | 1716 1); |
1665 NavigateToURL("files/prerender/prerender_fragment.html#fragment"); | 1717 NavigateToURL("files/prerender/prerender_fragment.html#fragment"); |
1666 } | 1718 } |
1667 | 1719 |
1668 // Checks that we correctly use a prerendered page when the page uses a client | 1720 // Checks that we correctly use a prerendered page when the page uses a client |
1669 // redirect to refresh from a fragment on the same page. | 1721 // redirect to refresh from a fragment on the same page. |
1670 // http://crbug.com/83901 | 1722 // http://crbug.com/83901 |
1671 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1723 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
1672 DISABLED_PrerenderClientRedirectFromFragment) { | 1724 DISABLED_PrerenderClientRedirectFromFragment) { |
1673 PrerenderTestURL( | 1725 PrerenderTestURL( |
1674 CreateClientRedirect("files/prerender/prerender_fragment.html#fragment"), | 1726 CreateClientRedirect("files/prerender/prerender_fragment.html#fragment"), |
1675 FINAL_STATUS_FRAGMENT_MISMATCH, | 1727 FINAL_STATUS_APP_TERMINATING, |
1676 2); | 1728 2); |
1677 NavigateToURL("files/prerender/prerender_fragment.html"); | 1729 NavigateToURL("files/prerender/prerender_fragment.html"); |
1678 } | 1730 } |
1679 | 1731 |
1680 // Checks that we correctly use a prerendered page when the page uses a client | 1732 // Checks that we correctly use a prerendered page when the page uses a client |
1681 // redirect to refresh to a fragment on the same page. | 1733 // redirect to refresh to a fragment on the same page. |
1682 // DISABLED: http://crbug.com/84154 | 1734 // DISABLED: http://crbug.com/84154 |
1683 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1735 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
1684 DISABLED_PrerenderClientRedirectToFragment) { | 1736 DISABLED_PrerenderClientRedirectToFragment) { |
1685 PrerenderTestURL( | 1737 PrerenderTestURL( |
1686 CreateClientRedirect("files/prerender/prerender_fragment.html"), | 1738 CreateClientRedirect("files/prerender/prerender_fragment.html"), |
1687 FINAL_STATUS_FRAGMENT_MISMATCH, | 1739 FINAL_STATUS_APP_TERMINATING, |
1688 2); | 1740 2); |
1689 NavigateToURL("files/prerender/prerender_fragment.html#fragment"); | 1741 NavigateToURL("files/prerender/prerender_fragment.html#fragment"); |
1690 } | 1742 } |
1691 | 1743 |
1692 // Checks that we correctly use a prerendered page when the page uses JS to set | 1744 // Checks that we correctly use a prerendered page when the page uses JS to set |
1693 // the window.location.hash to a fragment on the same page. | 1745 // the window.location.hash to a fragment on the same page. |
1694 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1746 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
1695 PrerenderPageChangeFragmentLocationHash) { | 1747 PrerenderPageChangeFragmentLocationHash) { |
1696 PrerenderTestURL("files/prerender/prerender_fragment_location_hash.html", | 1748 PrerenderTestURL("files/prerender/prerender_fragment_location_hash.html", |
1697 FINAL_STATUS_USED, | 1749 FINAL_STATUS_USED, |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1839 PrerenderTestURL("files/prerender/prerender_print.html", | 1891 PrerenderTestURL("files/prerender/prerender_print.html", |
1840 FINAL_STATUS_WINDOW_PRINT, | 1892 FINAL_STATUS_WINDOW_PRINT, |
1841 1); | 1893 1); |
1842 } | 1894 } |
1843 | 1895 |
1844 // Checks that if a page is opened in a new window by javascript and both the | 1896 // Checks that if a page is opened in a new window by javascript and both the |
1845 // pages are in the same domain, the prerendered page is not used. | 1897 // pages are in the same domain, the prerendered page is not used. |
1846 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1898 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
1847 PrerenderSameDomainWindowOpenerWindowOpen) { | 1899 PrerenderSameDomainWindowOpenerWindowOpen) { |
1848 PrerenderTestURL("files/prerender/prerender_page.html", | 1900 PrerenderTestURL("files/prerender/prerender_page.html", |
1849 FINAL_STATUS_WINDOW_OPENER, | 1901 FINAL_STATUS_APP_TERMINATING, |
1850 1); | 1902 1); |
1851 OpenDestURLViaWindowOpen(); | 1903 OpenDestURLViaWindowOpen(); |
1852 } | 1904 } |
1853 | 1905 |
1854 // Checks that if a page is opened due to click on a href with target="_blank" | 1906 // Checks that if a page is opened due to click on a href with target="_blank" |
1855 // and both pages are in the same domain the prerendered page is not used. | 1907 // and both pages are in the same domain the prerendered page is not used. |
1856 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1908 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
1857 PrerenderSameDomainWindowOpenerClickTarget) { | 1909 PrerenderSameDomainWindowOpenerClickTarget) { |
1858 PrerenderTestURL("files/prerender/prerender_page.html", | 1910 PrerenderTestURL("files/prerender/prerender_page.html", |
1859 FINAL_STATUS_WINDOW_OPENER, | 1911 FINAL_STATUS_APP_TERMINATING, |
1860 1); | 1912 1); |
1861 OpenDestURLViaClickTarget(); | 1913 OpenDestURLViaClickTarget(); |
1862 } | 1914 } |
1863 | 1915 |
1864 // Checks that a top-level page which would normally request an SSL client | 1916 // Checks that a top-level page which would normally request an SSL client |
1865 // certificate will never be seen since it's an https top-level resource. | 1917 // certificate will never be seen since it's an https top-level resource. |
1866 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLClientCertTopLevel) { | 1918 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLClientCertTopLevel) { |
1867 net::TestServer::HTTPSOptions https_options; | 1919 net::TestServer::HTTPSOptions https_options; |
1868 https_options.request_client_certificate = true; | 1920 https_options.request_client_certificate = true; |
1869 net::TestServer https_server(https_options, | 1921 net::TestServer https_server(https_options, |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2132 PrerenderTestURL("files/prerender/prerender_page_with_link.html", | 2184 PrerenderTestURL("files/prerender/prerender_page_with_link.html", |
2133 FINAL_STATUS_USED, | 2185 FINAL_STATUS_USED, |
2134 1); | 2186 1); |
2135 OpenDestURLViaClick(); | 2187 OpenDestURLViaClick(); |
2136 NavigateToNextPageAfterPrerender(); | 2188 NavigateToNextPageAfterPrerender(); |
2137 GoBackToPrerender(); | 2189 GoBackToPrerender(); |
2138 } | 2190 } |
2139 | 2191 |
2140 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClickNewWindow) { | 2192 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClickNewWindow) { |
2141 PrerenderTestURL("files/prerender/prerender_page_with_link.html", | 2193 PrerenderTestURL("files/prerender/prerender_page_with_link.html", |
2142 FINAL_STATUS_SESSION_STORAGE_NAMESPACE_MISMATCH, | 2194 FINAL_STATUS_APP_TERMINATING, |
2143 1); | 2195 1); |
2144 OpenDestURLViaClickNewWindow(); | 2196 OpenDestURLViaClickNewWindow(); |
2145 } | 2197 } |
2146 | 2198 |
2147 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClickNewForegroundTab) { | 2199 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClickNewForegroundTab) { |
2148 PrerenderTestURL("files/prerender/prerender_page_with_link.html", | 2200 PrerenderTestURL("files/prerender/prerender_page_with_link.html", |
2149 FINAL_STATUS_SESSION_STORAGE_NAMESPACE_MISMATCH, | 2201 FINAL_STATUS_APP_TERMINATING, |
2150 1); | 2202 1); |
2151 OpenDestURLViaClickNewForegroundTab(); | 2203 OpenDestURLViaClickNewForegroundTab(); |
2152 } | 2204 } |
2153 | 2205 |
2154 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClickNewBackgroundTab) { | 2206 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClickNewBackgroundTab) { |
2155 PrerenderTestURL("files/prerender/prerender_page_with_link.html", | 2207 PrerenderTestURL("files/prerender/prerender_page_with_link.html", |
2156 FINAL_STATUS_SESSION_STORAGE_NAMESPACE_MISMATCH, | 2208 FINAL_STATUS_APP_TERMINATING, |
2157 1); | 2209 1); |
2158 OpenDestURLViaClickNewBackgroundTab(); | 2210 OpenDestURLViaClickNewBackgroundTab(); |
2159 } | 2211 } |
2160 | 2212 |
2161 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 2213 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
2162 NavigateToPrerenderedPageWhenDevToolsAttached) { | 2214 NavigateToPrerenderedPageWhenDevToolsAttached) { |
2163 DisableJavascriptCalls(); | 2215 DisableJavascriptCalls(); |
2164 WebContents* web_contents = chrome::GetActiveWebContents(current_browser()); | 2216 WebContents* web_contents = chrome::GetActiveWebContents(current_browser()); |
2165 DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost( | 2217 DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost( |
2166 web_contents->GetRenderViewHost()); | 2218 web_contents->GetRenderViewHost()); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2251 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLReferrerPolicy) { | 2303 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSSLReferrerPolicy) { |
2252 set_use_https_src(true); | 2304 set_use_https_src(true); |
2253 set_loader_path("files/prerender/prerender_loader_with_referrer_policy.html"); | 2305 set_loader_path("files/prerender/prerender_loader_with_referrer_policy.html"); |
2254 PrerenderTestURL("files/prerender/prerender_referrer_policy.html", | 2306 PrerenderTestURL("files/prerender/prerender_referrer_policy.html", |
2255 FINAL_STATUS_USED, | 2307 FINAL_STATUS_USED, |
2256 1); | 2308 1); |
2257 NavigateToDestURL(); | 2309 NavigateToDestURL(); |
2258 } | 2310 } |
2259 | 2311 |
2260 } // namespace prerender | 2312 } // namespace prerender |
OLD | NEW |