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

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

Issue 9960042: Refactor screen/monitor so that gfx::Screen returns monitor object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix command line Created 8 years, 8 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/bind.h" 5 #include "base/bind.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/download/download_service.h" 8 #include "chrome/browser/download/download_service.h"
9 #include "chrome/browser/download/download_service_factory.h" 9 #include "chrome/browser/download/download_service_factory.h"
10 #include "chrome/browser/net/url_request_mock_util.h" 10 #include "chrome/browser/net/url_request_mock_util.h"
(...skipping 26 matching lines...) Expand all
37 #include "chrome/common/url_constants.h" 37 #include "chrome/common/url_constants.h"
38 #include "chrome/test/base/ui_test_utils.h" 38 #include "chrome/test/base/ui_test_utils.h"
39 #include "content/public/browser/download_manager.h" 39 #include "content/public/browser/download_manager.h"
40 #include "content/public/browser/notification_service.h" 40 #include "content/public/browser/notification_service.h"
41 #include "content/public/browser/web_contents.h" 41 #include "content/public/browser/web_contents.h"
42 #include "content/public/common/show_desktop_notification_params.h" 42 #include "content/public/common/show_desktop_notification_params.h"
43 #include "content/public/common/url_constants.h" 43 #include "content/public/common/url_constants.h"
44 #include "content/test/net/url_request_mock_http_job.h" 44 #include "content/test/net/url_request_mock_http_job.h"
45 #include "net/base/net_util.h" 45 #include "net/base/net_util.h"
46 #include "testing/gtest/include/gtest/gtest.h" 46 #include "testing/gtest/include/gtest/gtest.h"
47 #include "ui/gfx/monitor.h"
47 #include "ui/gfx/screen.h" 48 #include "ui/gfx/screen.h"
48 49
49 using content::BrowserThread; 50 using content::BrowserThread;
50 using content::DownloadItem; 51 using content::DownloadItem;
51 using content::DownloadManager; 52 using content::DownloadManager;
52 using content::WebContents; 53 using content::WebContents;
53 54
54 class PanelBrowserTest : public BasePanelBrowserTest { 55 class PanelBrowserTest : public BasePanelBrowserTest {
55 public: 56 public:
56 PanelBrowserTest() : BasePanelBrowserTest() { 57 PanelBrowserTest() : BasePanelBrowserTest() {
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 params.body = ASCIIToUTF16("Text"); 1634 params.body = ASCIIToUTF16("Text");
1634 params.direction = WebKit::WebTextDirectionDefault; 1635 params.direction = WebKit::WebTextDirectionDefault;
1635 return params; 1636 return params;
1636 } 1637 }
1637 1638
1638 int GetBalloonBottomPosition(Balloon* balloon) const { 1639 int GetBalloonBottomPosition(Balloon* balloon) const {
1639 #if defined(OS_MACOSX) 1640 #if defined(OS_MACOSX)
1640 // The position returned by the notification balloon is based on Mac's 1641 // The position returned by the notification balloon is based on Mac's
1641 // vertically inverted orientation. We need to flip it so that it can 1642 // vertically inverted orientation. We need to flip it so that it can
1642 // be compared against the position returned by the panel. 1643 // be compared against the position returned by the panel.
1643 gfx::Size screen_size = gfx::Screen::GetPrimaryMonitorSize(); 1644 gfx::Size screen_size = gfx::Screen::GetPrimaryMonitor()->GetSize();
1644 return screen_size.height() - balloon->GetPosition().y(); 1645 return screen_size.height() - balloon->GetPosition().y();
1645 #else 1646 #else
1646 return balloon->GetPosition().y() + balloon->GetViewSize().height(); 1647 return balloon->GetPosition().y() + balloon->GetViewSize().height();
1647 #endif 1648 #endif
1648 } 1649 }
1649 1650
1650 DesktopNotificationService* service() const { return service_.get(); } 1651 DesktopNotificationService* service() const { return service_.get(); }
1651 const BalloonCollection::Balloons& balloons() const { 1652 const BalloonCollection::Balloons& balloons() const {
1652 return balloons_->GetActiveBalloons(); 1653 return balloons_->GetActiveBalloons();
1653 } 1654 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 // position when tall panel brings up its titlebar. 1750 // position when tall panel brings up its titlebar.
1750 CloseWindowAndWait(panel1->browser()); 1751 CloseWindowAndWait(panel1->browser());
1751 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, 1752 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up,
1752 GetBalloonBottomPosition(balloon)); 1753 GetBalloonBottomPosition(balloon));
1753 1754
1754 // Closing the remaining tall panel should move the notification balloon back 1755 // Closing the remaining tall panel should move the notification balloon back
1755 // to its original position. 1756 // to its original position.
1756 CloseWindowAndWait(panel2->browser()); 1757 CloseWindowAndWait(panel2->browser());
1757 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); 1758 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon));
1758 } 1759 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698