| 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 | |
| 25 // Desktop notification code subscribes to various panel change notifications | 21 // Desktop notification code subscribes to various panel change notifications |
| 26 // 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 |
| 27 // desktop notification code a chance to process the change notifications, | 23 // desktop notification code a chance to process the change notifications, |
| 28 // we call MessageLoopForUI::current()->RunAllPending() after any panel change | 24 // we call MessageLoopForUI::current()->RunAllPending() after any panel change |
| 29 // has been made. | 25 // has been made. |
| 30 class PanelAndDesktopNotificationTest : public BasePanelBrowserTest { | 26 class PanelAndDesktopNotificationTest : public BasePanelBrowserTest { |
| 31 public: | 27 public: |
| 32 PanelAndDesktopNotificationTest() : BasePanelBrowserTest() { | 28 PanelAndDesktopNotificationTest() : BasePanelBrowserTest() { |
| 33 } | 29 } |
| 34 | 30 |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 MessageLoopForUI::current()->RunAllPending(); | 392 MessageLoopForUI::current()->RunAllPending(); |
| 397 EXPECT_EQ(balloon_bottom_after_short_panel_created, | 393 EXPECT_EQ(balloon_bottom_after_short_panel_created, |
| 398 GetBalloonBottomPosition(balloon)); | 394 GetBalloonBottomPosition(balloon)); |
| 399 | 395 |
| 400 // Close short panel. Expect that the notification balloo moves back to its | 396 // Close short panel. Expect that the notification balloo moves back to its |
| 401 // original position. | 397 // original position. |
| 402 short_panel->Close(); | 398 short_panel->Close(); |
| 403 MessageLoopForUI::current()->RunAllPending(); | 399 MessageLoopForUI::current()->RunAllPending(); |
| 404 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); | 400 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); |
| 405 } | 401 } |
| 406 | |
| 407 #endif // OS_WIN || OS_MACOSX | |
| OLD | NEW |