OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/chromeos/tab_closeable_state_watcher.h" | 5 #include "chrome/browser/chromeos/tab_closeable_state_watcher.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "chrome/browser/app_modal_dialog.h" | 8 #include "chrome/browser/app_modal_dialog.h" |
9 #include "chrome/browser/browser_list.h" | 9 #include "chrome/browser/browser_list.h" |
10 #include "chrome/browser/browser_window.h" | 10 #include "chrome/browser/browser_window.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 public: | 95 public: |
96 explicit NewTabObserver(Browser* browser) : browser_(browser) { | 96 explicit NewTabObserver(Browser* browser) : browser_(browser) { |
97 browser_->tabstrip_model()->AddObserver(this); | 97 browser_->tabstrip_model()->AddObserver(this); |
98 ui_test_utils::RunMessageLoop(); | 98 ui_test_utils::RunMessageLoop(); |
99 } | 99 } |
100 virtual ~NewTabObserver() { | 100 virtual ~NewTabObserver() { |
101 browser_->tabstrip_model()->RemoveObserver(this); | 101 browser_->tabstrip_model()->RemoveObserver(this); |
102 } | 102 } |
103 | 103 |
104 private: | 104 private: |
105 virtual void TabInsertedAt(TabContents* contents, int index, | 105 virtual void TabInsertedAt(TabContentsWrapper* contents, |
| 106 int index, |
106 bool foreground) { | 107 bool foreground) { |
107 MessageLoopForUI::current()->Quit(); | 108 MessageLoopForUI::current()->Quit(); |
108 } | 109 } |
109 | 110 |
110 Browser* browser_; | 111 Browser* browser_; |
111 }; | 112 }; |
112 | 113 |
113 // Tests with the only tab in the only normal browser: | 114 // Tests with the only tab in the only normal browser: |
114 // - if tab is about:blank, it is closeable | 115 // - if tab is about:blank, it is closeable |
115 // - if tab is NewTabPage, it is not closeable | 116 // - if tab is NewTabPage, it is not closeable |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 AppModalDialog* confirm = ui_test_utils::WaitForAppModalDialog(); | 311 AppModalDialog* confirm = ui_test_utils::WaitForAppModalDialog(); |
311 confirm->native_dialog()->AcceptAppModalDialog(); | 312 confirm->native_dialog()->AcceptAppModalDialog(); |
312 NewTabObserver new_tab_observer(browser()); | 313 NewTabObserver new_tab_observer(browser()); |
313 EXPECT_EQ(1u, BrowserList::size()); | 314 EXPECT_EQ(1u, BrowserList::size()); |
314 EXPECT_EQ(browser(), *(BrowserList::begin())); | 315 EXPECT_EQ(browser(), *(BrowserList::begin())); |
315 EXPECT_EQ(1, browser()->tab_count()); | 316 EXPECT_EQ(1, browser()->tab_count()); |
316 EXPECT_EQ(ntp_url_, browser()->GetSelectedTabContents()->GetURL()); | 317 EXPECT_EQ(ntp_url_, browser()->GetSelectedTabContents()->GetURL()); |
317 } | 318 } |
318 | 319 |
319 } // namespace chromeos | 320 } // namespace chromeos |
OLD | NEW |