| 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/public/browser/notification_service.h" | 9 #include "content/public/browser/notification_service.h" |
| 10 #include "content/public/browser/notification_types.h" | 10 #include "content/public/browser/notification_types.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 browser()->GetWebContentsAt(0)->GetRenderViewHost(), L"", | 33 browser()->GetWebContentsAt(0)->GetRenderViewHost(), L"", |
| 34 L"window.domAutomationController.send(document.body.innerHTML == '')", | 34 L"window.domAutomationController.send(document.body.innerHTML == '')", |
| 35 &empty_inner_html)); | 35 &empty_inner_html)); |
| 36 ASSERT_FALSE(empty_inner_html); | 36 ASSERT_FALSE(empty_inner_html); |
| 37 } | 37 } |
| 38 | 38 |
| 39 // Ensure loading a NTP with an existing SiteInstance in a reused process | 39 // Ensure loading a NTP with an existing SiteInstance in a reused process |
| 40 // doesn't cause us to kill the process. See http://crbug.com/104258. | 40 // doesn't cause us to kill the process. See http://crbug.com/104258. |
| 41 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, LoadNTPInExistingProcess) { | 41 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, LoadNTPInExistingProcess) { |
| 42 // Set max renderers to 1 to force running out of processes. | 42 // Set max renderers to 1 to force running out of processes. |
| 43 content::RenderProcessHost::SetMaxRendererProcessCountForTest(1); | 43 content::RenderProcessHost::SetMaxRendererProcessCount(1); |
| 44 | 44 |
| 45 // Start server for simple page. | 45 // Start server for simple page. |
| 46 ASSERT_TRUE(test_server()->Start()); | 46 ASSERT_TRUE(test_server()->Start()); |
| 47 | 47 |
| 48 // Load a NTP in a new tab. | 48 // Load a NTP in a new tab. |
| 49 ui_test_utils::NavigateToURLWithDisposition( | 49 ui_test_utils::NavigateToURLWithDisposition( |
| 50 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, | 50 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, |
| 51 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 51 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 52 EXPECT_EQ(1, browser()->GetWebContentsAt(1)->GetMaxPageID()); | 52 EXPECT_EQ(1, browser()->GetWebContentsAt(1)->GetMaxPageID()); |
| 53 | 53 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, | 85 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, |
| 86 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 86 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 87 EXPECT_EQ(1, browser()->GetWebContentsAt(3)->GetMaxPageID()); | 87 EXPECT_EQ(1, browser()->GetWebContentsAt(3)->GetMaxPageID()); |
| 88 | 88 |
| 89 // Only navigating to the NTP in the original tab should have a higher | 89 // Only navigating to the NTP in the original tab should have a higher |
| 90 // page ID. | 90 // page ID. |
| 91 browser()->ActivateTabAt(1, true); | 91 browser()->ActivateTabAt(1, true); |
| 92 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); | 92 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); |
| 93 EXPECT_EQ(2, browser()->GetWebContentsAt(1)->GetMaxPageID()); | 93 EXPECT_EQ(2, browser()->GetWebContentsAt(1)->GetMaxPageID()); |
| 94 } | 94 } |
| OLD | NEW |