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