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 "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 #include "chrome/common/url_constants.h" | 6 #include "chrome/common/url_constants.h" |
7 #include "chrome/test/base/in_process_browser_test.h" | 7 #include "chrome/test/base/in_process_browser_test.h" |
8 #include "chrome/test/base/ui_test_utils.h" | 8 #include "chrome/test/base/ui_test_utils.h" |
9 #include "content/browser/tab_contents/tab_contents.h" | 9 #include "content/browser/tab_contents/tab_contents.h" |
10 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 browser()->GetTabContentsAt(0)->render_view_host(), L"", | 29 browser()->GetTabContentsAt(0)->render_view_host(), L"", |
30 L"window.domAutomationController.send(document.body.innerHTML == '')", | 30 L"window.domAutomationController.send(document.body.innerHTML == '')", |
31 &empty_inner_html)); | 31 &empty_inner_html)); |
32 ASSERT_FALSE(empty_inner_html); | 32 ASSERT_FALSE(empty_inner_html); |
33 } | 33 } |
34 | 34 |
35 // Ensure loading a NTP with an existing SiteInstance in a reused process | 35 // Ensure loading a NTP with an existing SiteInstance in a reused process |
36 // doesn't cause us to kill the process. See http://crbug.com/104258. | 36 // doesn't cause us to kill the process. See http://crbug.com/104258. |
37 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, LoadNTPInExistingProcess) { | 37 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, LoadNTPInExistingProcess) { |
38 // Set max renderers to 1 to force running out of processes. | 38 // Set max renderers to 1 to force running out of processes. |
39 RenderProcessHost::SetMaxRendererProcessCountForTest(1); | 39 content::RenderProcessHost::SetMaxRendererProcessCountForTest(1); |
40 | 40 |
41 // Start server for simple page. | 41 // Start server for simple page. |
42 ASSERT_TRUE(test_server()->Start()); | 42 ASSERT_TRUE(test_server()->Start()); |
43 | 43 |
44 // Load a NTP in a new tab. | 44 // Load a NTP in a new tab. |
45 ui_test_utils::NavigateToURLWithDisposition( | 45 ui_test_utils::NavigateToURLWithDisposition( |
46 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, | 46 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, |
47 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 47 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
48 EXPECT_EQ(1, | 48 EXPECT_EQ(1, |
49 browser()->GetTabContentsAt(1)->GetSiteInstance()->max_page_id()); | 49 browser()->GetTabContentsAt(1)->GetSiteInstance()->max_page_id()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // At this point, opening another NTP will use the old SiteInstance (with a | 85 // At this point, opening another NTP will use the old SiteInstance (with a |
86 // large max_page_id) in the existing Web UI process (with a small page ID). | 86 // large max_page_id) in the existing Web UI process (with a small page ID). |
87 // Make sure we don't confuse this as an existing navigation to an unknown | 87 // Make sure we don't confuse this as an existing navigation to an unknown |
88 // entry. | 88 // entry. |
89 ui_test_utils::NavigateToURLWithDisposition( | 89 ui_test_utils::NavigateToURLWithDisposition( |
90 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, | 90 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, |
91 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 91 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
92 EXPECT_EQ(4, | 92 EXPECT_EQ(4, |
93 browser()->GetTabContentsAt(3)->GetSiteInstance()->max_page_id()); | 93 browser()->GetTabContentsAt(3)->GetSiteInstance()->max_page_id()); |
94 } | 94 } |
OLD | NEW |