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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // Navigate that tab to another site. This allows the NTP process to exit, | 51 // Navigate that tab to another site. This allows the NTP process to exit, |
52 // but it keeps the NTP SiteInstance (and its max_page_id) alive in history. | 52 // but it keeps the NTP SiteInstance (and its max_page_id) alive in history. |
53 { | 53 { |
54 // Wait not just for the navigation to finish, but for the NTP process to | 54 // Wait not just for the navigation to finish, but for the NTP process to |
55 // exit as well. | 55 // exit as well. |
56 content::RenderProcessHostWatcher process_exited_observer( | 56 content::RenderProcessHostWatcher process_exited_observer( |
57 browser()->tab_strip_model()->GetActiveWebContents(), | 57 browser()->tab_strip_model()->GetActiveWebContents(), |
58 content::RenderProcessHostWatcher::WATCH_FOR_HOST_DESTRUCTION); | 58 content::RenderProcessHostWatcher::WATCH_FOR_HOST_DESTRUCTION); |
59 browser()->OpenURL(OpenURLParams( | 59 browser()->OpenURL(OpenURLParams( |
60 test_server()->GetURL("files/title1.html"), Referrer(), CURRENT_TAB, | 60 test_server()->GetURL("files/title1.html"), Referrer(), CURRENT_TAB, |
61 content::PAGE_TRANSITION_TYPED, false)); | 61 ui::PAGE_TRANSITION_TYPED, false)); |
62 process_exited_observer.Wait(); | 62 process_exited_observer.Wait(); |
63 } | 63 } |
64 | 64 |
65 // Creating a NTP in another tab should not be affected, since page IDs | 65 // Creating a NTP in another tab should not be affected, since page IDs |
66 // are now specific to a tab. | 66 // are now specific to a tab. |
67 ui_test_utils::NavigateToURLWithDisposition( | 67 ui_test_utils::NavigateToURLWithDisposition( |
68 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, | 68 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, |
69 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 69 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
70 EXPECT_EQ(1, | 70 EXPECT_EQ(1, |
71 browser()->tab_strip_model()->GetWebContentsAt(2)->GetMaxPageID()); | 71 browser()->tab_strip_model()->GetWebContentsAt(2)->GetMaxPageID()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 // Navigate to chrome://hang/ to stall the process. | 107 // Navigate to chrome://hang/ to stall the process. |
108 ui_test_utils::NavigateToURLWithDisposition( | 108 ui_test_utils::NavigateToURLWithDisposition( |
109 browser(), GURL(content::kChromeUIHangURL), CURRENT_TAB, 0); | 109 browser(), GURL(content::kChromeUIHangURL), CURRENT_TAB, 0); |
110 | 110 |
111 // Visit chrome://hang/ again in another NTP. Don't bother waiting for the | 111 // Visit chrome://hang/ again in another NTP. Don't bother waiting for the |
112 // NTP to load, because it's hung. | 112 // NTP to load, because it's hung. |
113 chrome::NewTab(browser()); | 113 chrome::NewTab(browser()); |
114 browser()->OpenURL(OpenURLParams( | 114 browser()->OpenURL(OpenURLParams( |
115 GURL(content::kChromeUIHangURL), Referrer(), CURRENT_TAB, | 115 GURL(content::kChromeUIHangURL), Referrer(), CURRENT_TAB, |
116 content::PAGE_TRANSITION_TYPED, false)); | 116 ui::PAGE_TRANSITION_TYPED, false)); |
117 } | 117 } |
118 | 118 |
119 class NewTabUIProcessPerTabTest : public NewTabUIBrowserTest { | 119 class NewTabUIProcessPerTabTest : public NewTabUIBrowserTest { |
120 public: | 120 public: |
121 NewTabUIProcessPerTabTest() {} | 121 NewTabUIProcessPerTabTest() {} |
122 | 122 |
123 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 123 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
124 command_line->AppendSwitch(switches::kProcessPerTab); | 124 command_line->AppendSwitch(switches::kProcessPerTab); |
125 } | 125 } |
126 }; | 126 }; |
(...skipping 13 matching lines...) Expand all Loading... |
140 // Visit a normal URL in another NTP that hasn't committed. | 140 // Visit a normal URL in another NTP that hasn't committed. |
141 ui_test_utils::NavigateToURLWithDisposition( | 141 ui_test_utils::NavigateToURLWithDisposition( |
142 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, 0); | 142 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, 0); |
143 | 143 |
144 // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits | 144 // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits |
145 // for current loading to stop. | 145 // for current loading to stop. |
146 content::TestNavigationObserver observer( | 146 content::TestNavigationObserver observer( |
147 browser()->tab_strip_model()->GetActiveWebContents()); | 147 browser()->tab_strip_model()->GetActiveWebContents()); |
148 browser()->OpenURL(OpenURLParams( | 148 browser()->OpenURL(OpenURLParams( |
149 GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB, | 149 GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB, |
150 content::PAGE_TRANSITION_TYPED, false)); | 150 ui::PAGE_TRANSITION_TYPED, false)); |
151 observer.Wait(); | 151 observer.Wait(); |
152 } | 152 } |
OLD | NEW |