| 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 #if defined(OS_POSIX) | 5 #if defined(OS_POSIX) |
| 6 #include <signal.h> | 6 #include <signal.h> |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 return; | 208 return; |
| 209 | 209 |
| 210 NavigateToDataURL(INFINITE_UNLOAD_HTML, "infiniteunload"); | 210 NavigateToDataURL(INFINITE_UNLOAD_HTML, "infiniteunload"); |
| 211 // Must navigate to a non-data URL to trigger cross-site codepath. | 211 // Must navigate to a non-data URL to trigger cross-site codepath. |
| 212 NavigateToNolistenersFileTwice(); | 212 NavigateToNolistenersFileTwice(); |
| 213 } | 213 } |
| 214 | 214 |
| 215 // Navigate to a page with an infinite beforeunload handler. | 215 // Navigate to a page with an infinite beforeunload handler. |
| 216 // Then two two async crosssite requests to ensure | 216 // Then two two async crosssite requests to ensure |
| 217 // we don't get confused and think we're closing the tab. | 217 // we don't get confused and think we're closing the tab. |
| 218 // This test is flaky on the valgrind UI bots. http://crbug.com/39057 | 218 // This test is flaky on the valgrind UI bots. http://crbug.com/39057 and |
| 219 IN_PROC_BROWSER_TEST_F(UnloadTest, CrossSiteInfiniteBeforeUnloadAsync) { | 219 // http://crbug.com/86469 |
| 220 IN_PROC_BROWSER_TEST_F(UnloadTest, |
| 221 DISABLED_CrossSiteInfiniteBeforeUnloadAsync) { |
| 220 // Tests makes no sense in single-process mode since the renderer is hung. | 222 // Tests makes no sense in single-process mode since the renderer is hung. |
| 221 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) | 223 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) |
| 222 return; | 224 return; |
| 223 | 225 |
| 224 NavigateToDataURL(INFINITE_BEFORE_UNLOAD_HTML, "infinitebeforeunload"); | 226 NavigateToDataURL(INFINITE_BEFORE_UNLOAD_HTML, "infinitebeforeunload"); |
| 225 // Must navigate to a non-data URL to trigger cross-site codepath. | 227 // Must navigate to a non-data URL to trigger cross-site codepath. |
| 226 NavigateToNolistenersFileTwiceAsync(); | 228 NavigateToNolistenersFileTwiceAsync(); |
| 227 } | 229 } |
| 228 | 230 |
| 229 // Navigate to a page with an infinite beforeunload handler. | 231 // Navigate to a page with an infinite beforeunload handler. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseInfiniteUnload) { | 326 IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseInfiniteUnload) { |
| 325 // Tests makes no sense in single-process mode since the renderer is hung. | 327 // Tests makes no sense in single-process mode since the renderer is hung. |
| 326 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) | 328 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) |
| 327 return; | 329 return; |
| 328 | 330 |
| 329 LoadUrlAndQuitBrowser(INFINITE_UNLOAD_HTML, "infiniteunload"); | 331 LoadUrlAndQuitBrowser(INFINITE_UNLOAD_HTML, "infiniteunload"); |
| 330 } | 332 } |
| 331 | 333 |
| 332 // Tests closing the browser with a beforeunload handler that hangs. | 334 // Tests closing the browser with a beforeunload handler that hangs. |
| 333 // If this flakes, use http://crbug.com/78803 and http://crbug.com/86469 | 335 // If this flakes, use http://crbug.com/78803 and http://crbug.com/86469 |
| 334 IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseInfiniteBeforeUnload) { | 336 IN_PROC_BROWSER_TEST_F(UnloadTest, DISABLED_BrowserCloseInfiniteBeforeUnload) { |
| 335 // Tests makes no sense in single-process mode since the renderer is hung. | 337 // Tests makes no sense in single-process mode since the renderer is hung. |
| 336 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) | 338 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) |
| 337 return; | 339 return; |
| 338 | 340 |
| 339 LoadUrlAndQuitBrowser(INFINITE_BEFORE_UNLOAD_HTML, "infinitebeforeunload"); | 341 LoadUrlAndQuitBrowser(INFINITE_BEFORE_UNLOAD_HTML, "infinitebeforeunload"); |
| 340 } | 342 } |
| 341 | 343 |
| 342 // Tests closing the browser on a page with an unload listener registered where | 344 // Tests closing the browser on a page with an unload listener registered where |
| 343 // the unload handler has an infinite loop followed by an alert. | 345 // the unload handler has an infinite loop followed by an alert. |
| 344 // If this flakes, use http://crbug.com/86469 | 346 // If this flakes, use http://crbug.com/86469 |
| 345 IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseInfiniteUnloadAlert) { | 347 IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseInfiniteUnloadAlert) { |
| 346 // Tests makes no sense in single-process mode since the renderer is hung. | 348 // Tests makes no sense in single-process mode since the renderer is hung. |
| 347 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) | 349 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) |
| 348 return; | 350 return; |
| 349 | 351 |
| 350 LoadUrlAndQuitBrowser(INFINITE_UNLOAD_ALERT_HTML, "infiniteunloadalert"); | 352 LoadUrlAndQuitBrowser(INFINITE_UNLOAD_ALERT_HTML, "infiniteunloadalert"); |
| 351 } | 353 } |
| 352 | 354 |
| 353 // Tests closing the browser with a beforeunload handler that hangs then | 355 // Tests closing the browser with a beforeunload handler that hangs then |
| 354 // pops up an alert. | 356 // pops up an alert. |
| 355 // If this flakes, use http://crbug.com/78803. | 357 // If this flakes, use http://crbug.com/78803 and http://crbug.com/86469. |
| 356 IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseInfiniteBeforeUnloadAlert) { | 358 IN_PROC_BROWSER_TEST_F(UnloadTest, |
| 359 DISABLED_BrowserCloseInfiniteBeforeUnloadAlert) { |
| 357 // Tests makes no sense in single-process mode since the renderer is hung. | 360 // Tests makes no sense in single-process mode since the renderer is hung. |
| 358 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) | 361 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) |
| 359 return; | 362 return; |
| 360 | 363 |
| 361 LoadUrlAndQuitBrowser(INFINITE_BEFORE_UNLOAD_ALERT_HTML, | 364 LoadUrlAndQuitBrowser(INFINITE_BEFORE_UNLOAD_ALERT_HTML, |
| 362 "infinitebeforeunloadalert"); | 365 "infinitebeforeunloadalert"); |
| 363 } | 366 } |
| 364 | 367 |
| 365 // Tests closing the browser on a page with an unload listener registered where | 368 // Tests closing the browser on a page with an unload listener registered where |
| 366 // the unload handler has an 2 second long loop followed by an alert. | 369 // the unload handler has an 2 second long loop followed by an alert. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 404 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 402 content::NotificationService::AllSources()); | 405 content::NotificationService::AllSources()); |
| 403 chrome::CloseTab(browser()); | 406 chrome::CloseTab(browser()); |
| 404 tab_close_observer.Wait(); | 407 tab_close_observer.Wait(); |
| 405 | 408 |
| 406 CheckTitle("only_one_unload"); | 409 CheckTitle("only_one_unload"); |
| 407 } | 410 } |
| 408 | 411 |
| 409 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs | 412 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs |
| 410 // and multiple windows. | 413 // and multiple windows. |
| OLD | NEW |