Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" 11 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/browser_list.h" 13 #include "chrome/browser/ui/browser_list.h"
14 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
15 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
16 #include "chrome/test/base/in_process_browser_test.h" 16 #include "chrome/test/base/in_process_browser_test.h"
17 #include "chrome/test/base/ui_test_utils.h" 17 #include "chrome/test/base/ui_test_utils.h"
18 #include "content/browser/tab_contents/tab_contents.h" 18 #include "content/browser/tab_contents/tab_contents.h"
19 #include "content/public/browser/notification_service.h"
19 #include "content/public/browser/notification_types.h" 20 #include "content/public/browser/notification_types.h"
20 #include "googleurl/src/gurl.h" 21 #include "googleurl/src/gurl.h"
21 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
22 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
23 24
24 namespace chromeos { 25 namespace chromeos {
25 26
26 class TabCloseableStateWatcherTest : public InProcessBrowserTest { 27 class TabCloseableStateWatcherTest : public InProcessBrowserTest {
27 public: 28 public:
28 TabCloseableStateWatcherTest() { 29 TabCloseableStateWatcherTest() {
29 // This test is testing TabCloseStateWatcher, so enable it. 30 // This test is testing TabCloseStateWatcher, so enable it.
30 EnableTabCloseableStateWatcher(); 31 EnableTabCloseableStateWatcher();
31 blank_url_ = GURL(chrome::kAboutBlankURL); 32 blank_url_ = GURL(chrome::kAboutBlankURL);
32 ntp_url_ = GURL(chrome::kChromeUINewTabURL); 33 ntp_url_ = GURL(chrome::kChromeUINewTabURL);
33 other_url_ = ui_test_utils::GetTestUrl( 34 other_url_ = ui_test_utils::GetTestUrl(
34 FilePath(FilePath::kCurrentDirectory), 35 FilePath(FilePath::kCurrentDirectory),
35 FilePath(FILE_PATH_LITERAL("title2.html"))); 36 FilePath(FILE_PATH_LITERAL("title2.html")));
36 } 37 }
37 38
38 protected: 39 protected:
39 // Wrapper for Browser::AddTabWithURL 40 // Wrapper for Browser::AddTabWithURL
40 void AddTabWithURL(Browser* browser, const GURL& url) { 41 void AddTabWithURL(Browser* browser, const GURL& url) {
41 ui_test_utils::WindowedNotificationObserver observer( 42 ui_test_utils::WindowedNotificationObserver observer(
42 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources()); 43 content::NOTIFICATION_LOAD_STOP,
44 content::NotificationService::AllSources());
43 AddTabAtIndexToBrowser(browser, 0, url, content::PAGE_TRANSITION_TYPED); 45 AddTabAtIndexToBrowser(browser, 0, url, content::PAGE_TRANSITION_TYPED);
44 observer.Wait(); 46 observer.Wait();
45 } 47 }
46 48
47 // Wrapper for TabCloseableStateWatcher::CanCloseTab 49 // Wrapper for TabCloseableStateWatcher::CanCloseTab
48 bool CanCloseTab(const Browser* browser) { 50 bool CanCloseTab(const Browser* browser) {
49 return browser->tabstrip_model()->delegate()->CanCloseTab(); 51 return browser->tabstrip_model()->delegate()->CanCloseTab();
50 } 52 }
51 53
52 // Create popup browser. 54 // Create popup browser.
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 AppModalDialog* confirm = ui_test_utils::WaitForAppModalDialog(); 316 AppModalDialog* confirm = ui_test_utils::WaitForAppModalDialog();
315 confirm->native_dialog()->AcceptAppModalDialog(); 317 confirm->native_dialog()->AcceptAppModalDialog();
316 NewTabObserver new_tab_observer(browser()); 318 NewTabObserver new_tab_observer(browser());
317 EXPECT_EQ(1u, BrowserList::size()); 319 EXPECT_EQ(1u, BrowserList::size());
318 EXPECT_EQ(browser(), *(BrowserList::begin())); 320 EXPECT_EQ(browser(), *(BrowserList::begin()));
319 EXPECT_EQ(1, browser()->tab_count()); 321 EXPECT_EQ(1, browser()->tab_count());
320 EXPECT_EQ(ntp_url_, browser()->GetSelectedTabContents()->GetURL()); 322 EXPECT_EQ(ntp_url_, browser()->GetSelectedTabContents()->GetURL());
321 } 323 }
322 324
323 } // namespace chromeos 325 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/tab_closeable_state_watcher.cc ('k') | chrome/browser/chromeos/user_cros_settings_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698