| 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/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 Loading... |
| 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 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 params.body = ASCIIToUTF16("Text"); | 1636 params.body = ASCIIToUTF16("Text"); |
| 1636 params.direction = WebKit::WebTextDirectionDefault; | 1637 params.direction = WebKit::WebTextDirectionDefault; |
| 1637 return params; | 1638 return params; |
| 1638 } | 1639 } |
| 1639 | 1640 |
| 1640 int GetBalloonBottomPosition(Balloon* balloon) const { | 1641 int GetBalloonBottomPosition(Balloon* balloon) const { |
| 1641 #if defined(OS_MACOSX) | 1642 #if defined(OS_MACOSX) |
| 1642 // The position returned by the notification balloon is based on Mac's | 1643 // The position returned by the notification balloon is based on Mac's |
| 1643 // vertically inverted orientation. We need to flip it so that it can | 1644 // vertically inverted orientation. We need to flip it so that it can |
| 1644 // be compared against the position returned by the panel. | 1645 // be compared against the position returned by the panel. |
| 1645 gfx::Size screen_size = gfx::Screen::GetPrimaryMonitorSize(); | 1646 gfx::Size screen_size = gfx::Screen::GetPrimaryMonitor()->GetSize(); |
| 1646 return screen_size.height() - balloon->GetPosition().y(); | 1647 return screen_size.height() - balloon->GetPosition().y(); |
| 1647 #else | 1648 #else |
| 1648 return balloon->GetPosition().y() + balloon->GetViewSize().height(); | 1649 return balloon->GetPosition().y() + balloon->GetViewSize().height(); |
| 1649 #endif | 1650 #endif |
| 1650 } | 1651 } |
| 1651 | 1652 |
| 1652 DesktopNotificationService* service() const { return service_.get(); } | 1653 DesktopNotificationService* service() const { return service_.get(); } |
| 1653 const BalloonCollection::Balloons& balloons() const { | 1654 const BalloonCollection::Balloons& balloons() const { |
| 1654 return balloons_->GetActiveBalloons(); | 1655 return balloons_->GetActiveBalloons(); |
| 1655 } | 1656 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1751 // position when tall panel brings up its titlebar. | 1752 // position when tall panel brings up its titlebar. |
| 1752 CloseWindowAndWait(panel1->browser()); | 1753 CloseWindowAndWait(panel1->browser()); |
| 1753 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, | 1754 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, |
| 1754 GetBalloonBottomPosition(balloon)); | 1755 GetBalloonBottomPosition(balloon)); |
| 1755 | 1756 |
| 1756 // Closing the remaining tall panel should move the notification balloon back | 1757 // Closing the remaining tall panel should move the notification balloon back |
| 1757 // to its original position. | 1758 // to its original position. |
| 1758 CloseWindowAndWait(panel2->browser()); | 1759 CloseWindowAndWait(panel2->browser()); |
| 1759 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); | 1760 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); |
| 1760 } | 1761 } |
| OLD | NEW |