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" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 params, 0, 0, DesktopNotificationService::PageNotification)); | 77 params, 0, 0, DesktopNotificationService::PageNotification)); |
78 MessageLoopForUI::current()->RunAllPending(); | 78 MessageLoopForUI::current()->RunAllPending(); |
79 return balloons().front(); | 79 return balloons().front(); |
80 } | 80 } |
81 | 81 |
82 static int GetBalloonBottomPosition(Balloon* balloon) { | 82 static int GetBalloonBottomPosition(Balloon* balloon) { |
83 #if defined(OS_MACOSX) | 83 #if defined(OS_MACOSX) |
84 // The position returned by the notification balloon is based on Mac's | 84 // The position returned by the notification balloon is based on Mac's |
85 // vertically inverted orientation. We need to flip it so that it can | 85 // vertically inverted orientation. We need to flip it so that it can |
86 // be compared against the position returned by the panel. | 86 // be compared against the position returned by the panel. |
87 gfx::Size screen_size = gfx::Screen::GetPrimaryMonitor().size(); | 87 gfx::Size screen_size = gfx::Screen::GetPrimaryDisplay().size(); |
88 return screen_size.height() - balloon->GetPosition().y(); | 88 return screen_size.height() - balloon->GetPosition().y(); |
89 #else | 89 #else |
90 return balloon->GetPosition().y() + balloon->GetViewSize().height(); | 90 return balloon->GetPosition().y() + balloon->GetViewSize().height(); |
91 #endif | 91 #endif |
92 } | 92 } |
93 | 93 |
94 static void DragPanelToMouseLocation(Panel* panel, | 94 static void DragPanelToMouseLocation(Panel* panel, |
95 const gfx::Point& new_mouse_location) { | 95 const gfx::Point& new_mouse_location) { |
96 PanelManager* panel_manager = PanelManager::GetInstance(); | 96 PanelManager* panel_manager = PanelManager::GetInstance(); |
97 panel_manager->StartDragging(panel, panel->GetBounds().origin()); | 97 panel_manager->StartDragging(panel, panel->GetBounds().origin()); |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 MessageLoopForUI::current()->RunAllPending(); | 401 MessageLoopForUI::current()->RunAllPending(); |
402 EXPECT_EQ(balloon_bottom_after_short_panel_created, | 402 EXPECT_EQ(balloon_bottom_after_short_panel_created, |
403 GetBalloonBottomPosition(balloon)); | 403 GetBalloonBottomPosition(balloon)); |
404 | 404 |
405 // Close short panel. Expect that the notification balloo moves back to its | 405 // Close short panel. Expect that the notification balloo moves back to its |
406 // original position. | 406 // original position. |
407 short_panel->Close(); | 407 short_panel->Close(); |
408 MessageLoopForUI::current()->RunAllPending(); | 408 MessageLoopForUI::current()->RunAllPending(); |
409 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); | 409 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); |
410 } | 410 } |
OLD | NEW |