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