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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 // handler can be closed. | 377 // handler can be closed. |
378 // If this flakes, see http://crbug.com/45162, http://crbug.com/45281 and | 378 // If this flakes, see http://crbug.com/45162, http://crbug.com/45281 and |
379 // http://crbug.com/86769. | 379 // http://crbug.com/86769. |
380 IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseTabWhenOtherTabHasListener) { | 380 IN_PROC_BROWSER_TEST_F(UnloadTest, BrowserCloseTabWhenOtherTabHasListener) { |
381 NavigateToDataURL(CLOSE_TAB_WHEN_OTHER_TAB_HAS_LISTENER, "only_one_unload"); | 381 NavigateToDataURL(CLOSE_TAB_WHEN_OTHER_TAB_HAS_LISTENER, "only_one_unload"); |
382 | 382 |
383 // Simulate a click to force user_gesture to true; if we don't, the resulting | 383 // Simulate a click to force user_gesture to true; if we don't, the resulting |
384 // popup will be constrained, which isn't what we want to test. | 384 // popup will be constrained, which isn't what we want to test. |
385 | 385 |
386 ui_test_utils::WindowedNotificationObserver observer( | 386 ui_test_utils::WindowedNotificationObserver observer( |
387 content::NOTIFICATION_TAB_ADDED, | 387 chrome::NOTIFICATION_TAB_ADDED, |
388 content::NotificationService::AllSources()); | 388 content::NotificationService::AllSources()); |
389 ui_test_utils::WindowedNotificationObserver load_stop_observer( | 389 ui_test_utils::WindowedNotificationObserver load_stop_observer( |
390 content::NOTIFICATION_LOAD_STOP, | 390 content::NOTIFICATION_LOAD_STOP, |
391 content::NotificationService::AllSources()); | 391 content::NotificationService::AllSources()); |
392 ui_test_utils::SimulateMouseClick( | 392 ui_test_utils::SimulateMouseClick( |
393 browser()->GetSelectedWebContents(), 20, 20); | 393 browser()->GetSelectedWebContents(), 20, 20); |
394 observer.Wait(); | 394 observer.Wait(); |
395 load_stop_observer.Wait(); | 395 load_stop_observer.Wait(); |
396 CheckTitle("popup"); | 396 CheckTitle("popup"); |
397 | 397 |
398 ui_test_utils::WindowedNotificationObserver tab_close_observer( | 398 ui_test_utils::WindowedNotificationObserver tab_close_observer( |
399 content::NOTIFICATION_TAB_CLOSED, | 399 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
400 content::NotificationService::AllSources()); | 400 content::NotificationService::AllSources()); |
401 browser()->CloseTab(); | 401 browser()->CloseTab(); |
402 tab_close_observer.Wait(); | 402 tab_close_observer.Wait(); |
403 | 403 |
404 CheckTitle("only_one_unload"); | 404 CheckTitle("only_one_unload"); |
405 } | 405 } |
406 | 406 |
407 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs | 407 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs |
408 // and multiple windows. | 408 // and multiple windows. |
OLD | NEW |