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 "base/logging.h" | 6 #include "base/logging.h" |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/ui/browser_commands.h" | 8 #include "chrome/browser/ui/browser_commands.h" |
9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // Navigate to incognito NTP. Fails if there are console errors. | 145 // Navigate to incognito NTP. Fails if there are console errors. |
146 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ShowIncognito) { | 146 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ShowIncognito) { |
147 ui_test_utils::NavigateToURL(CreateIncognitoBrowser(), | 147 ui_test_utils::NavigateToURL(CreateIncognitoBrowser(), |
148 GURL(chrome::kChromeUINewTabURL)); | 148 GURL(chrome::kChromeUINewTabURL)); |
149 } | 149 } |
150 | 150 |
151 class NewTabUIProcessPerTabTest : public NewTabUIBrowserTest { | 151 class NewTabUIProcessPerTabTest : public NewTabUIBrowserTest { |
152 public: | 152 public: |
153 NewTabUIProcessPerTabTest() {} | 153 NewTabUIProcessPerTabTest() {} |
154 | 154 |
155 void SetUpCommandLine(CommandLine* command_line) override { | 155 void SetUpCommandLine(base::CommandLine* command_line) override { |
156 command_line->AppendSwitch(switches::kProcessPerTab); | 156 command_line->AppendSwitch(switches::kProcessPerTab); |
157 } | 157 } |
158 }; | 158 }; |
159 | 159 |
160 // Navigates away from NTP before it commits, in process-per-tab mode. | 160 // Navigates away from NTP before it commits, in process-per-tab mode. |
161 // Ensures that we don't load the normal page in the NTP process (and thus | 161 // Ensures that we don't load the normal page in the NTP process (and thus |
162 // crash), as in http://crbug.com/69224. | 162 // crash), as in http://crbug.com/69224. |
163 // If this flakes, use http://crbug.com/87200 | 163 // If this flakes, use http://crbug.com/87200 |
164 IN_PROC_BROWSER_TEST_F(NewTabUIProcessPerTabTest, NavBeforeNTPCommits) { | 164 IN_PROC_BROWSER_TEST_F(NewTabUIProcessPerTabTest, NavBeforeNTPCommits) { |
165 // Bring up a new tab page. | 165 // Bring up a new tab page. |
166 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); | 166 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); |
167 | 167 |
168 // Navigate to chrome://hang/ to stall the process. | 168 // Navigate to chrome://hang/ to stall the process. |
169 ui_test_utils::NavigateToURLWithDisposition( | 169 ui_test_utils::NavigateToURLWithDisposition( |
170 browser(), GURL(content::kChromeUIHangURL), CURRENT_TAB, 0); | 170 browser(), GURL(content::kChromeUIHangURL), CURRENT_TAB, 0); |
171 | 171 |
172 // Visit a normal URL in another NTP that hasn't committed. | 172 // Visit a normal URL in another NTP that hasn't committed. |
173 ui_test_utils::NavigateToURLWithDisposition( | 173 ui_test_utils::NavigateToURLWithDisposition( |
174 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, 0); | 174 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, 0); |
175 | 175 |
176 // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits | 176 // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits |
177 // for current loading to stop. | 177 // for current loading to stop. |
178 content::TestNavigationObserver observer( | 178 content::TestNavigationObserver observer( |
179 browser()->tab_strip_model()->GetActiveWebContents()); | 179 browser()->tab_strip_model()->GetActiveWebContents()); |
180 browser()->OpenURL(OpenURLParams( | 180 browser()->OpenURL(OpenURLParams( |
181 GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB, | 181 GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB, |
182 ui::PAGE_TRANSITION_TYPED, false)); | 182 ui::PAGE_TRANSITION_TYPED, false)); |
183 observer.Wait(); | 183 observer.Wait(); |
184 } | 184 } |
OLD | NEW |