| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/tabs/tab_strip_model.h" | 9 #include "chrome/browser/tabs/tab_strip_model.h" |
| 10 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 10 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 ntp_url_ = GURL(chrome::kChromeUINewTabURL); | 32 ntp_url_ = GURL(chrome::kChromeUINewTabURL); |
| 33 other_url_ = ui_test_utils::GetTestUrl( | 33 other_url_ = ui_test_utils::GetTestUrl( |
| 34 FilePath(FilePath::kCurrentDirectory), | 34 FilePath(FilePath::kCurrentDirectory), |
| 35 FilePath(FILE_PATH_LITERAL("title2.html"))); | 35 FilePath(FILE_PATH_LITERAL("title2.html"))); |
| 36 } | 36 } |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 // Wrapper for Browser::AddTabWithURL | 39 // Wrapper for Browser::AddTabWithURL |
| 40 void AddTabWithURL(Browser* browser, const GURL& url) { | 40 void AddTabWithURL(Browser* browser, const GURL& url) { |
| 41 ui_test_utils::WindowedNotificationObserver observer( | 41 ui_test_utils::WindowedNotificationObserver observer( |
| 42 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); | 42 content::NOTIFICATION_LOAD_STOP, |
| 43 content::NotificationService::AllSources()); |
| 43 AddTabAtIndexToBrowser(browser, 0, url, content::PAGE_TRANSITION_TYPED); | 44 AddTabAtIndexToBrowser(browser, 0, url, content::PAGE_TRANSITION_TYPED); |
| 44 observer.Wait(); | 45 observer.Wait(); |
| 45 } | 46 } |
| 46 | 47 |
| 47 // Wrapper for TabCloseableStateWatcher::CanCloseTab | 48 // Wrapper for TabCloseableStateWatcher::CanCloseTab |
| 48 bool CanCloseTab(const Browser* browser) { | 49 bool CanCloseTab(const Browser* browser) { |
| 49 return browser->tabstrip_model()->delegate()->CanCloseTab(); | 50 return browser->tabstrip_model()->delegate()->CanCloseTab(); |
| 50 } | 51 } |
| 51 | 52 |
| 52 // Create popup browser. | 53 // Create popup browser. |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 AppModalDialog* confirm = ui_test_utils::WaitForAppModalDialog(); | 315 AppModalDialog* confirm = ui_test_utils::WaitForAppModalDialog(); |
| 315 confirm->native_dialog()->AcceptAppModalDialog(); | 316 confirm->native_dialog()->AcceptAppModalDialog(); |
| 316 NewTabObserver new_tab_observer(browser()); | 317 NewTabObserver new_tab_observer(browser()); |
| 317 EXPECT_EQ(1u, BrowserList::size()); | 318 EXPECT_EQ(1u, BrowserList::size()); |
| 318 EXPECT_EQ(browser(), *(BrowserList::begin())); | 319 EXPECT_EQ(browser(), *(BrowserList::begin())); |
| 319 EXPECT_EQ(1, browser()->tab_count()); | 320 EXPECT_EQ(1, browser()->tab_count()); |
| 320 EXPECT_EQ(ntp_url_, browser()->GetSelectedTabContents()->GetURL()); | 321 EXPECT_EQ(ntp_url_, browser()->GetSelectedTabContents()->GetURL()); |
| 321 } | 322 } |
| 322 | 323 |
| 323 } // namespace chromeos | 324 } // namespace chromeos |
| OLD | NEW |