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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // See http://crbug.com/59859. | 113 // See http://crbug.com/59859. |
114 // If this flakes, use http://crbug.com/87200. | 114 // If this flakes, use http://crbug.com/87200. |
115 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ChromeHangInNTP) { | 115 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ChromeHangInNTP) { |
116 // Bring up a new tab page. | 116 // Bring up a new tab page. |
117 ui_test_utils::NavigateToURLWithDisposition( | 117 ui_test_utils::NavigateToURLWithDisposition( |
118 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, | 118 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, |
119 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 119 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
120 | 120 |
121 // Navigate to chrome://hang/ to stall the process. | 121 // Navigate to chrome://hang/ to stall the process. |
122 ui_test_utils::NavigateToURLWithDisposition( | 122 ui_test_utils::NavigateToURLWithDisposition( |
123 browser(), GURL(chrome::kChromeUIHangURL), CURRENT_TAB, 0); | 123 browser(), GURL(content::kChromeUIHangURL), CURRENT_TAB, 0); |
124 | 124 |
125 // Visit chrome://hang/ again in another NTP. Don't bother waiting for the | 125 // Visit chrome://hang/ again in another NTP. Don't bother waiting for the |
126 // NTP to load, because it's hung. | 126 // NTP to load, because it's hung. |
127 chrome::NewTab(browser()); | 127 chrome::NewTab(browser()); |
128 browser()->OpenURL(OpenURLParams( | 128 browser()->OpenURL(OpenURLParams( |
129 GURL(chrome::kChromeUIHangURL), Referrer(), CURRENT_TAB, | 129 GURL(content::kChromeUIHangURL), Referrer(), CURRENT_TAB, |
130 content::PAGE_TRANSITION_TYPED, false)); | 130 content::PAGE_TRANSITION_TYPED, false)); |
131 } | 131 } |
132 | 132 |
133 class NewTabUIProcessPerTabTest : public NewTabUIBrowserTest { | 133 class NewTabUIProcessPerTabTest : public NewTabUIBrowserTest { |
134 public: | 134 public: |
135 NewTabUIProcessPerTabTest() {} | 135 NewTabUIProcessPerTabTest() {} |
136 | 136 |
137 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 137 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
138 command_line->AppendSwitch(switches::kProcessPerTab); | 138 command_line->AppendSwitch(switches::kProcessPerTab); |
139 } | 139 } |
140 }; | 140 }; |
141 | 141 |
142 // Navigates away from NTP before it commits, in process-per-tab mode. | 142 // Navigates away from NTP before it commits, in process-per-tab mode. |
143 // Ensures that we don't load the normal page in the NTP process (and thus | 143 // Ensures that we don't load the normal page in the NTP process (and thus |
144 // crash), as in http://crbug.com/69224. | 144 // crash), as in http://crbug.com/69224. |
145 // If this flakes, use http://crbug.com/87200 | 145 // If this flakes, use http://crbug.com/87200 |
146 IN_PROC_BROWSER_TEST_F(NewTabUIProcessPerTabTest, NavBeforeNTPCommits) { | 146 IN_PROC_BROWSER_TEST_F(NewTabUIProcessPerTabTest, NavBeforeNTPCommits) { |
147 // Bring up a new tab page. | 147 // Bring up a new tab page. |
148 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); | 148 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); |
149 | 149 |
150 // Navigate to chrome://hang/ to stall the process. | 150 // Navigate to chrome://hang/ to stall the process. |
151 ui_test_utils::NavigateToURLWithDisposition( | 151 ui_test_utils::NavigateToURLWithDisposition( |
152 browser(), GURL(chrome::kChromeUIHangURL), CURRENT_TAB, 0); | 152 browser(), GURL(content::kChromeUIHangURL), CURRENT_TAB, 0); |
153 | 153 |
154 // Visit a normal URL in another NTP that hasn't committed. | 154 // Visit a normal URL in another NTP that hasn't committed. |
155 ui_test_utils::NavigateToURLWithDisposition( | 155 ui_test_utils::NavigateToURLWithDisposition( |
156 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, 0); | 156 browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, 0); |
157 | 157 |
158 // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits | 158 // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits |
159 // for current loading to stop. | 159 // for current loading to stop. |
160 content::TestNavigationObserver observer( | 160 content::TestNavigationObserver observer( |
161 content::NotificationService::AllSources()); | 161 content::NotificationService::AllSources()); |
162 browser()->OpenURL(OpenURLParams( | 162 browser()->OpenURL(OpenURLParams( |
163 GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB, | 163 GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB, |
164 content::PAGE_TRANSITION_TYPED, false)); | 164 content::PAGE_TRANSITION_TYPED, false)); |
165 observer.Wait(); | 165 observer.Wait(); |
166 } | 166 } |
OLD | NEW |