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

Side by Side Diff: chrome/browser/chromeos/panels/panel_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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "chrome/browser/ui/browser.h" 6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/browser/ui/browser_list.h" 7 #include "chrome/browser/ui/browser_list.h"
8 #include "chrome/browser/ui/browser_window.h" 8 #include "chrome/browser/ui/browser_window.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/test/base/in_process_browser_test.h" 10 #include "chrome/test/base/in_process_browser_test.h"
11 #include "chrome/test/base/ui_test_utils.h" 11 #include "chrome/test/base/ui_test_utils.h"
12 #include "content/browser/renderer_host/render_view_host.h" 12 #include "content/browser/renderer_host/render_view_host.h"
13 #include "content/public/browser/notification_service.h"
13 #include "content/public/browser/notification_types.h" 14 #include "content/public/browser/notification_types.h"
14 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h" 15 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h"
15 16
16 #if defined(TOOLKIT_USES_GTK) 17 #if defined(TOOLKIT_USES_GTK)
17 #include "chrome/browser/chromeos/wm_ipc.h" 18 #include "chrome/browser/chromeos/wm_ipc.h"
18 #endif 19 #endif
19 20
20 namespace chromeos { 21 namespace chromeos {
21 22
22 class PanelTest : public InProcessBrowserTest { 23 class PanelTest : public InProcessBrowserTest {
(...skipping 18 matching lines...) Expand all
41 " window.open(null, null, 'width=100,height=100');" 42 " window.open(null, null, 'width=100,height=100');"
42 " }" 43 " }"
43 "</script>" 44 "</script>"
44 "</body></html>"; 45 "</body></html>";
45 GURL url("data:text/html," + HTML); 46 GURL url("data:text/html," + HTML);
46 CommandLine::ForCurrentProcess()->AppendSwitch( 47 CommandLine::ForCurrentProcess()->AppendSwitch(
47 switches::kDisablePopupBlocking); 48 switches::kDisablePopupBlocking);
48 49
49 ui_test_utils::WindowedNotificationObserver tab_added_observer( 50 ui_test_utils::WindowedNotificationObserver tab_added_observer(
50 content::NOTIFICATION_TAB_ADDED, 51 content::NOTIFICATION_TAB_ADDED,
51 NotificationService::AllSources()); 52 content::NotificationService::AllSources());
52 browser()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); 53 browser()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED);
53 tab_added_observer.Wait(); 54 tab_added_observer.Wait();
54 55
55 // Find the new browser. 56 // Find the new browser.
56 Browser* new_browser = NULL; 57 Browser* new_browser = NULL;
57 for (BrowserList::const_iterator i = BrowserList::begin(); 58 for (BrowserList::const_iterator i = BrowserList::begin();
58 i != BrowserList::end() && !new_browser; ++i) { 59 i != BrowserList::end() && !new_browser; ++i) {
59 if (*i != browser()) 60 if (*i != browser())
60 new_browser = *i; 61 new_browser = *i;
61 } 62 }
(...skipping 22 matching lines...) Expand all
84 " window.open(null, null, 'width=1000,height=1000');" 85 " window.open(null, null, 'width=1000,height=1000');"
85 " }" 86 " }"
86 "</script>" 87 "</script>"
87 "</body></html>"; 88 "</body></html>";
88 GURL url("data:text/html," + HTML); 89 GURL url("data:text/html," + HTML);
89 CommandLine::ForCurrentProcess()->AppendSwitch( 90 CommandLine::ForCurrentProcess()->AppendSwitch(
90 switches::kDisablePopupBlocking); 91 switches::kDisablePopupBlocking);
91 int old_tab_count = browser()->tab_count(); 92 int old_tab_count = browser()->tab_count();
92 ui_test_utils::WindowedNotificationObserver tab_added_observer( 93 ui_test_utils::WindowedNotificationObserver tab_added_observer(
93 content::NOTIFICATION_TAB_ADDED, 94 content::NOTIFICATION_TAB_ADDED,
94 NotificationService::AllSources()); 95 content::NotificationService::AllSources());
95 browser()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); 96 browser()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED);
96 tab_added_observer.Wait(); 97 tab_added_observer.Wait();
97 98
98 // Shouldn't find a new browser. 99 // Shouldn't find a new browser.
99 Browser* new_browser = NULL; 100 Browser* new_browser = NULL;
100 for (BrowserList::const_iterator i = BrowserList::begin(); 101 for (BrowserList::const_iterator i = BrowserList::begin();
101 i != BrowserList::end() && !new_browser; ++i) { 102 i != BrowserList::end() && !new_browser; ++i) {
102 if (*i != browser()) 103 if (*i != browser())
103 new_browser = *i; 104 new_browser = *i;
104 } 105 }
105 EXPECT_FALSE(new_browser); 106 EXPECT_FALSE(new_browser);
106 107
107 // Should find a new tab. 108 // Should find a new tab.
108 EXPECT_EQ(old_tab_count + 1, browser()->tab_count()); 109 EXPECT_EQ(old_tab_count + 1, browser()->tab_count());
109 } 110 }
110 111
111 } // namespace chromeos 112 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/take_photo_dialog.cc ('k') | chrome/browser/chromeos/status/input_method_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698