OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <deque> | 5 #include <deque> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/ui/browser_list.h" | 26 #include "chrome/browser/ui/browser_list.h" |
27 #include "chrome/browser/ui/browser_window.h" | 27 #include "chrome/browser/ui/browser_window.h" |
28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
29 #include "chrome/common/chrome_notification_types.h" | 29 #include "chrome/common/chrome_notification_types.h" |
30 #include "chrome/common/chrome_paths.h" | 30 #include "chrome/common/chrome_paths.h" |
31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
33 #include "chrome/test/base/in_process_browser_test.h" | 33 #include "chrome/test/base/in_process_browser_test.h" |
34 #include "chrome/test/base/ui_test_utils.h" | 34 #include "chrome/test/base/ui_test_utils.h" |
35 #include "content/browser/debugger/devtools_client_host.h" | 35 #include "content/browser/debugger/devtools_client_host.h" |
36 #include "content/browser/debugger/devtools_manager.h" | |
37 #include "content/browser/renderer_host/render_view_host.h" | 36 #include "content/browser/renderer_host/render_view_host.h" |
38 #include "content/browser/tab_contents/tab_contents.h" | 37 #include "content/browser/tab_contents/tab_contents.h" |
| 38 #include "content/public/browser/devtools/devtools_agent_host_registry.h" |
| 39 #include "content/public/browser/devtools/devtools_manager.h" |
39 #include "content/public/browser/notification_service.h" | 40 #include "content/public/browser/notification_service.h" |
40 #include "content/public/common/url_constants.h" | 41 #include "content/public/common/url_constants.h" |
41 #include "grit/generated_resources.h" | 42 #include "grit/generated_resources.h" |
42 #include "net/base/mock_host_resolver.h" | 43 #include "net/base/mock_host_resolver.h" |
43 #include "net/url_request/url_request_context.h" | 44 #include "net/url_request/url_request_context.h" |
44 #include "net/url_request/url_request_context_getter.h" | 45 #include "net/url_request/url_request_context_getter.h" |
45 #include "ui/base/l10n/l10n_util.h" | 46 #include "ui/base/l10n/l10n_util.h" |
46 | 47 |
47 using content::BrowserThread; | 48 using content::BrowserThread; |
| 49 using content::DevToolsAgentHostRegistry; |
| 50 using content::DevToolsManager; |
48 | 51 |
49 // Prerender tests work as follows: | 52 // Prerender tests work as follows: |
50 // | 53 // |
51 // A page with a prefetch link to the test page is loaded. Once prerendered, | 54 // A page with a prefetch link to the test page is loaded. Once prerendered, |
52 // its Javascript function DidPrerenderPass() is called, which returns true if | 55 // its Javascript function DidPrerenderPass() is called, which returns true if |
53 // the page behaves as expected when prerendered. | 56 // the page behaves as expected when prerendered. |
54 // | 57 // |
55 // The prerendered page is then displayed on a tab. The Javascript function | 58 // The prerendered page is then displayed on a tab. The Javascript function |
56 // DidDisplayPass() is called, and returns true if the page behaved as it | 59 // DidDisplayPass() is called, and returns true if the page behaved as it |
57 // should while being displayed. | 60 // should while being displayed. |
(...skipping 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 PrerenderTestURL("files/prerender/prerender_page_with_link.html", | 1832 PrerenderTestURL("files/prerender/prerender_page_with_link.html", |
1830 FINAL_STATUS_SESSION_STORAGE_NAMESPACE_MISMATCH, | 1833 FINAL_STATUS_SESSION_STORAGE_NAMESPACE_MISMATCH, |
1831 1); | 1834 1); |
1832 OpenDestURLViaClickNewBackgroundTab(); | 1835 OpenDestURLViaClickNewBackgroundTab(); |
1833 } | 1836 } |
1834 | 1837 |
1835 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, | 1838 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, |
1836 NavigateToPrerenderedPageWhenDevToolsAttached) { | 1839 NavigateToPrerenderedPageWhenDevToolsAttached) { |
1837 DisableJavascriptCalls(); | 1840 DisableJavascriptCalls(); |
1838 TabContents* tab_contents = browser()->GetSelectedTabContents(); | 1841 TabContents* tab_contents = browser()->GetSelectedTabContents(); |
1839 RenderViewHost* inspected_rvh = tab_contents->render_view_host(); | 1842 DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost( |
| 1843 tab_contents->render_view_host()); |
1840 DevToolsManager* manager = DevToolsManager::GetInstance(); | 1844 DevToolsManager* manager = DevToolsManager::GetInstance(); |
1841 FakeDevToolsClientHost client_host; | 1845 FakeDevToolsClientHost client_host; |
1842 manager->RegisterDevToolsClientHostFor(inspected_rvh, &client_host); | 1846 manager->RegisterDevToolsClientHostFor(agent, &client_host); |
1843 const char* url = "files/prerender/prerender_page.html"; | 1847 const char* url = "files/prerender/prerender_page.html"; |
1844 PrerenderTestURL(url, FINAL_STATUS_DEVTOOLS_ATTACHED, 1); | 1848 PrerenderTestURL(url, FINAL_STATUS_DEVTOOLS_ATTACHED, 1); |
1845 NavigateToURL(url); | 1849 NavigateToURL(url); |
1846 } | 1850 } |
1847 | 1851 |
1848 // Validate that the sessionStorage namespace remains the same when swapping | 1852 // Validate that the sessionStorage namespace remains the same when swapping |
1849 // in a prerendered page. | 1853 // in a prerendered page. |
1850 // http://crbug.com/103563 | 1854 // http://crbug.com/103563 |
1851 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderSessionStorage) { | 1855 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderSessionStorage) { |
1852 set_loader_path("files/prerender/prerender_loader_with_session_storage.html"); | 1856 set_loader_path("files/prerender/prerender_loader_with_session_storage.html"); |
1853 PrerenderTestURL(GetCrossDomainTestUrl("files/prerender/prerender_page.html"), | 1857 PrerenderTestURL(GetCrossDomainTestUrl("files/prerender/prerender_page.html"), |
1854 FINAL_STATUS_USED, | 1858 FINAL_STATUS_USED, |
1855 1); | 1859 1); |
1856 NavigateToDestURL(); | 1860 NavigateToDestURL(); |
1857 GoBackToPageBeforePrerender(browser()); | 1861 GoBackToPageBeforePrerender(browser()); |
1858 } | 1862 } |
1859 | 1863 |
1860 } // namespace prerender | 1864 } // namespace prerender |
OLD | NEW |