| 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 run_loop_(run_loop) { | 454 run_loop_(run_loop) { |
| 455 model_->AddObserver(this); | 455 model_->AddObserver(this); |
| 456 } | 456 } |
| 457 | 457 |
| 458 virtual ~FastTabCloseTabStripModelObserver() { | 458 virtual ~FastTabCloseTabStripModelObserver() { |
| 459 model_->RemoveObserver(this); | 459 model_->RemoveObserver(this); |
| 460 } | 460 } |
| 461 | 461 |
| 462 // TabStripModelObserver: | 462 // TabStripModelObserver: |
| 463 virtual void TabDetachedAt(content::WebContents* contents, | 463 virtual void TabDetachedAt(content::WebContents* contents, |
| 464 int index) OVERRIDE { | 464 int index, |
| 465 bool closing_all) OVERRIDE { |
| 465 run_loop_->Quit(); | 466 run_loop_->Quit(); |
| 466 } | 467 } |
| 467 | 468 |
| 468 private: | 469 private: |
| 469 TabStripModel* const model_; | 470 TabStripModel* const model_; |
| 470 base::RunLoop* const run_loop_; | 471 base::RunLoop* const run_loop_; |
| 471 }; | 472 }; |
| 472 | 473 |
| 473 | 474 |
| 474 // Test that fast-tab-close works when closing a tab with an unload handler | 475 // Test that fast-tab-close works when closing a tab with an unload handler |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 content::WindowedNotificationObserver window_observer( | 612 content::WindowedNotificationObserver window_observer( |
| 612 chrome::NOTIFICATION_BROWSER_CLOSED, | 613 chrome::NOTIFICATION_BROWSER_CLOSED, |
| 613 content::NotificationService::AllSources()); | 614 content::NotificationService::AllSources()); |
| 614 chrome::CloseWindow(browser()); | 615 chrome::CloseWindow(browser()); |
| 615 CrashTab(beforeunload_contents); | 616 CrashTab(beforeunload_contents); |
| 616 window_observer.Wait(); | 617 window_observer.Wait(); |
| 617 } | 618 } |
| 618 | 619 |
| 619 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs | 620 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs |
| 620 // and multiple windows. | 621 // and multiple windows. |
| OLD | NEW |