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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
7 #include "chrome/browser/ui/browser_commands.h" | 7 #include "chrome/browser/ui/browser_commands.h" |
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // Ensure that chrome-internal: still loads the NTP. | 29 // Ensure that chrome-internal: still loads the NTP. |
30 // See http://crbug.com/6564. | 30 // See http://crbug.com/6564. |
31 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ChromeInternalLoadsNTP) { | 31 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ChromeInternalLoadsNTP) { |
32 // Go to the "new tab page" using its old url, rather than chrome://newtab. | 32 // Go to the "new tab page" using its old url, rather than chrome://newtab. |
33 // Ensure that we get there by checking for non-empty page content. | 33 // Ensure that we get there by checking for non-empty page content. |
34 ui_test_utils::NavigateToURL(browser(), GURL("chrome-internal:")); | 34 ui_test_utils::NavigateToURL(browser(), GURL("chrome-internal:")); |
35 bool empty_inner_html = false; | 35 bool empty_inner_html = false; |
36 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( | 36 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
37 browser()->tab_strip_model()->GetWebContentsAt(0)->GetRenderViewHost(), | 37 browser()->tab_strip_model()->GetWebContentsAt(0)->GetRenderViewHost(), |
38 L"", | 38 "", |
39 L"window.domAutomationController.send(document.body.innerHTML == '')", | 39 "window.domAutomationController.send(document.body.innerHTML == '')", |
40 &empty_inner_html)); | 40 &empty_inner_html)); |
41 ASSERT_FALSE(empty_inner_html); | 41 ASSERT_FALSE(empty_inner_html); |
42 } | 42 } |
43 | 43 |
44 // Ensure loading a NTP with an existing SiteInstance in a reused process | 44 // Ensure loading a NTP with an existing SiteInstance in a reused process |
45 // doesn't cause us to kill the process. See http://crbug.com/104258. | 45 // doesn't cause us to kill the process. See http://crbug.com/104258. |
46 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, LoadNTPInExistingProcess) { | 46 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, LoadNTPInExistingProcess) { |
47 // Set max renderers to 1 to force running out of processes. | 47 // Set max renderers to 1 to force running out of processes. |
48 content::RenderProcessHost::SetMaxRendererProcessCount(1); | 48 content::RenderProcessHost::SetMaxRendererProcessCount(1); |
49 | 49 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits | 152 // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits |
153 // for current loading to stop. | 153 // for current loading to stop. |
154 content::TestNavigationObserver observer( | 154 content::TestNavigationObserver observer( |
155 content::NotificationService::AllSources()); | 155 content::NotificationService::AllSources()); |
156 browser()->OpenURL(OpenURLParams( | 156 browser()->OpenURL(OpenURLParams( |
157 GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB, | 157 GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB, |
158 content::PAGE_TRANSITION_TYPED, false)); | 158 content::PAGE_TRANSITION_TYPED, false)); |
159 observer.Wait(); | 159 observer.Wait(); |
160 } | 160 } |
OLD | NEW |