Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: chrome/browser/ui/panels/panel_and_desktop_notification_browsertest.cc

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix some new gfx::Screen additions Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 params, 0, 0, DesktopNotificationService::PageNotification)); 76 params, 0, 0, DesktopNotificationService::PageNotification));
77 MessageLoopForUI::current()->RunAllPending(); 77 MessageLoopForUI::current()->RunAllPending();
78 return balloons().front(); 78 return balloons().front();
79 } 79 }
80 80
81 static int GetBalloonBottomPosition(Balloon* balloon) { 81 static int GetBalloonBottomPosition(Balloon* balloon) {
82 #if defined(OS_MACOSX) 82 #if defined(OS_MACOSX)
83 // The position returned by the notification balloon is based on Mac's 83 // The position returned by the notification balloon is based on Mac's
84 // vertically inverted orientation. We need to flip it so that it can 84 // vertically inverted orientation. We need to flip it so that it can
85 // be compared against the position returned by the panel. 85 // be compared against the position returned by the panel.
86 gfx::Size screen_size = gfx::Screen::GetPrimaryDisplay().size(); 86 gfx::Size screen_size =
87 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().size();
87 return screen_size.height() - balloon->GetPosition().y(); 88 return screen_size.height() - balloon->GetPosition().y();
88 #else 89 #else
89 return balloon->GetPosition().y() + balloon->GetViewSize().height(); 90 return balloon->GetPosition().y() + balloon->GetViewSize().height();
90 #endif 91 #endif
91 } 92 }
92 93
93 static void DragPanelToMouseLocation(Panel* panel, 94 static void DragPanelToMouseLocation(Panel* panel,
94 const gfx::Point& new_mouse_location) { 95 const gfx::Point& new_mouse_location) {
95 PanelManager* panel_manager = PanelManager::GetInstance(); 96 PanelManager* panel_manager = PanelManager::GetInstance();
96 panel_manager->StartDragging(panel, panel->GetBounds().origin()); 97 panel_manager->StartDragging(panel, panel->GetBounds().origin());
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 MessageLoopForUI::current()->RunAllPending(); 393 MessageLoopForUI::current()->RunAllPending();
393 EXPECT_EQ(balloon_bottom_after_short_panel_created, 394 EXPECT_EQ(balloon_bottom_after_short_panel_created,
394 GetBalloonBottomPosition(balloon)); 395 GetBalloonBottomPosition(balloon));
395 396
396 // Close short panel. Expect that the notification balloo moves back to its 397 // Close short panel. Expect that the notification balloo moves back to its
397 // original position. 398 // original position.
398 short_panel->Close(); 399 short_panel->Close();
399 MessageLoopForUI::current()->RunAllPending(); 400 MessageLoopForUI::current()->RunAllPending();
400 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); 401 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon));
401 } 402 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698