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/base_panel_browser_test.h" | 14 #include "chrome/browser/ui/panels/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" | 17 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
19 #include "content/public/common/show_desktop_notification_params.h" | 19 #include "content/public/common/show_desktop_notification_params.h" |
20 #include "ui/gfx/screen.h" | 20 #include "ui/gfx/screen.h" |
21 | 21 |
22 | |
23 // Refactor has only been done for Win and Mac panels so far. | |
24 #if defined(OS_WIN) || defined(OS_MACOSX) | |
25 | |
26 // Desktop notification code subscribes to various panel change notifications | 22 // Desktop notification code subscribes to various panel change notifications |
27 // so that it knows when to adjusts balloon positions. In order to give | 23 // so that it knows when to adjusts balloon positions. In order to give |
28 // desktop notification code a chance to process the change notifications, | 24 // desktop notification code a chance to process the change notifications, |
29 // we call MessageLoopForUI::current()->RunAllPending() after any panel change | 25 // we call MessageLoopForUI::current()->RunAllPending() after any panel change |
30 // has been made. | 26 // has been made. |
31 class PanelAndDesktopNotificationTest : public BasePanelBrowserTest { | 27 class PanelAndDesktopNotificationTest : public BasePanelBrowserTest { |
32 public: | 28 public: |
33 PanelAndDesktopNotificationTest() : BasePanelBrowserTest() { | 29 PanelAndDesktopNotificationTest() : BasePanelBrowserTest() { |
34 } | 30 } |
35 | 31 |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 MessageLoopForUI::current()->RunAllPending(); | 399 MessageLoopForUI::current()->RunAllPending(); |
404 EXPECT_EQ(balloon_bottom_after_short_panel_created, | 400 EXPECT_EQ(balloon_bottom_after_short_panel_created, |
405 GetBalloonBottomPosition(balloon)); | 401 GetBalloonBottomPosition(balloon)); |
406 | 402 |
407 // Close short panel. Expect that the notification balloo moves back to its | 403 // Close short panel. Expect that the notification balloo moves back to its |
408 // original position. | 404 // original position. |
409 short_panel->Close(); | 405 short_panel->Close(); |
410 MessageLoopForUI::current()->RunAllPending(); | 406 MessageLoopForUI::current()->RunAllPending(); |
411 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); | 407 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); |
412 } | 408 } |
413 | |
414 #endif // OS_WIN || OS_MACOSX | |
OLD | NEW |