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 #include "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "chrome/browser/browser_process.h" | 6 #include "chrome/browser/browser_process.h" |
7 #include "chrome/browser/notifications/balloon.h" | 7 #include "chrome/browser/notifications/balloon.h" |
8 #include "chrome/browser/notifications/balloon_collection_impl.h" | 8 #include "chrome/browser/notifications/balloon_collection_impl.h" |
9 #include "chrome/browser/notifications/desktop_notification_service.h" | 9 #include "chrome/browser/notifications/desktop_notification_service.h" |
10 #include "chrome/browser/notifications/notification.h" | 10 #include "chrome/browser/notifications/notification.h" |
11 #include "chrome/browser/notifications/notification_ui_manager.h" | 11 #include "chrome/browser/notifications/notification_ui_manager.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/panels/old_base_panel_browser_test.h" | 14 #include "chrome/browser/ui/panels/old_base_panel_browser_test.h" |
15 #include "chrome/browser/ui/panels/panel.h" | 15 #include "chrome/browser/ui/panels/panel.h" |
16 #include "chrome/browser/ui/panels/panel_manager.h" | 16 #include "chrome/browser/ui/panels/panel_manager.h" |
17 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" | |
18 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
19 #include "content/public/common/show_desktop_notification_params.h" | 18 #include "content/public/common/show_desktop_notification_params.h" |
20 #include "ui/gfx/screen.h" | 19 #include "ui/gfx/screen.h" |
21 | 20 |
22 // Desktop notification code subscribes to various panel change notifications | 21 // Desktop notification code subscribes to various panel change notifications |
23 // so that it knows when to adjusts balloon positions. In order to give | 22 // so that it knows when to adjusts balloon positions. In order to give |
24 // desktop notification code a chance to process the change notifications, | 23 // desktop notification code a chance to process the change notifications, |
25 // we call MessageLoopForUI::current()->RunAllPending() after any panel change | 24 // we call MessageLoopForUI::current()->RunAllPending() after any panel change |
26 // has been made. | 25 // has been made. |
27 class OldPanelAndDesktopNotificationTest : public OldBasePanelBrowserTest { | 26 class OldPanelAndDesktopNotificationTest : public OldBasePanelBrowserTest { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 140 |
142 // http://crbug.com/133612 | 141 // http://crbug.com/133612 |
143 #if defined(OS_LINUX) | 142 #if defined(OS_LINUX) |
144 #define MAYBE_ExpandAndCollapsePanel DISABLED_ExpandAndCollapsePanel | 143 #define MAYBE_ExpandAndCollapsePanel DISABLED_ExpandAndCollapsePanel |
145 #else | 144 #else |
146 #define MAYBE_ExpandAndCollapsePanel ExpandAndCollapsePanel | 145 #define MAYBE_ExpandAndCollapsePanel ExpandAndCollapsePanel |
147 #endif | 146 #endif |
148 | 147 |
149 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, | 148 IN_PROC_BROWSER_TEST_F(OldPanelAndDesktopNotificationTest, |
150 MAYBE_ExpandAndCollapsePanel) { | 149 MAYBE_ExpandAndCollapsePanel) { |
151 // Disable mouse watcher since we don't want mouse movements to affect panel | |
152 // testing for title-only state. | |
153 PanelManager* panel_manager = PanelManager::GetInstance(); | |
154 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher(); | |
155 panel_manager->SetMouseWatcherForTesting(mouse_watcher); | |
156 | |
157 Balloon* balloon = CreateBalloon(); | 150 Balloon* balloon = CreateBalloon(); |
158 | 151 |
159 // Create a docked panel. Expect that the notification balloon moves up to be | 152 // Create a docked panel. Expect that the notification balloon moves up to be |
160 // above the panel. | 153 // above the panel. |
161 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); | 154 Panel* panel = CreateDockedPanel("1", gfx::Rect(0, 0, 200, 200)); |
162 MessageLoopForUI::current()->RunAllPending(); | 155 MessageLoopForUI::current()->RunAllPending(); |
163 int balloon_bottom_on_expanded = GetBalloonBottomPosition(balloon); | 156 int balloon_bottom_on_expanded = GetBalloonBottomPosition(balloon); |
164 EXPECT_LT(balloon_bottom_on_expanded, panel->GetBounds().y()); | 157 EXPECT_LT(balloon_bottom_on_expanded, panel->GetBounds().y()); |
165 | 158 |
166 // Minimize the panel. Expect that the notification balloon moves down, but | 159 // Minimize the panel. Expect that the notification balloon moves down, but |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 MessageLoopForUI::current()->RunAllPending(); | 408 MessageLoopForUI::current()->RunAllPending(); |
416 EXPECT_EQ(balloon_bottom_after_short_panel_created, | 409 EXPECT_EQ(balloon_bottom_after_short_panel_created, |
417 GetBalloonBottomPosition(balloon)); | 410 GetBalloonBottomPosition(balloon)); |
418 | 411 |
419 // Close short panel. Expect that the notification balloo moves back to its | 412 // Close short panel. Expect that the notification balloo moves back to its |
420 // original position. | 413 // original position. |
421 short_panel->Close(); | 414 short_panel->Close(); |
422 MessageLoopForUI::current()->RunAllPending(); | 415 MessageLoopForUI::current()->RunAllPending(); |
423 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); | 416 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); |
424 } | 417 } |
OLD | NEW |