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

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

Issue 8511075: Move the struct used when showing a desktop notification to content/public/common, so that chrome... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/string_number_conversions.h" 6 #include "base/string_number_conversions.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/download/download_service.h" 9 #include "chrome/browser/download/download_service.h"
10 #include "chrome/browser/download/download_service_factory.h" 10 #include "chrome/browser/download/download_service_factory.h"
(...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 virtual void CleanUpOnMainThread() OVERRIDE { 1601 virtual void CleanUpOnMainThread() OVERRIDE {
1602 balloons_->RemoveAll(); 1602 balloons_->RemoveAll();
1603 MessageLoopForUI::current()->RunAllPending(); 1603 MessageLoopForUI::current()->RunAllPending();
1604 1604
1605 service_.reset(); 1605 service_.reset();
1606 ui_manager_.reset(); 1606 ui_manager_.reset();
1607 1607
1608 PanelBrowserTest::CleanUpOnMainThread(); 1608 PanelBrowserTest::CleanUpOnMainThread();
1609 } 1609 }
1610 1610
1611 DesktopNotificationHostMsg_Show_Params StandardTestNotification() { 1611 content::ShowDesktopNotificationHostMsgParams StandardTestNotification() {
1612 DesktopNotificationHostMsg_Show_Params params; 1612 content::ShowDesktopNotificationHostMsgParams params;
1613 params.notification_id = 0; 1613 params.notification_id = 0;
1614 params.origin = GURL("http://www.google.com"); 1614 params.origin = GURL("http://www.google.com");
1615 params.is_html = false; 1615 params.is_html = false;
1616 params.icon_url = GURL("/icon.png"); 1616 params.icon_url = GURL("/icon.png");
1617 params.title = ASCIIToUTF16("Title"); 1617 params.title = ASCIIToUTF16("Title");
1618 params.body = ASCIIToUTF16("Text"); 1618 params.body = ASCIIToUTF16("Text");
1619 params.direction = WebKit::WebTextDirectionDefault; 1619 params.direction = WebKit::WebTextDirectionDefault;
1620 return params; 1620 return params;
1621 } 1621 }
1622 1622
(...skipping 18 matching lines...) Expand all
1641 BalloonCollectionImpl* balloons_; // Owned by NotificationUIManager. 1641 BalloonCollectionImpl* balloons_; // Owned by NotificationUIManager.
1642 scoped_ptr<NotificationUIManager> ui_manager_; 1642 scoped_ptr<NotificationUIManager> ui_manager_;
1643 scoped_ptr<DesktopNotificationService> service_; 1643 scoped_ptr<DesktopNotificationService> service_;
1644 }; 1644 };
1645 1645
1646 IN_PROC_BROWSER_TEST_F(PanelAndNotificationTest, NoOverlapping) { 1646 IN_PROC_BROWSER_TEST_F(PanelAndNotificationTest, NoOverlapping) {
1647 const int kPanelWidth = 200; 1647 const int kPanelWidth = 200;
1648 const int kShortPanelHeight = 150; 1648 const int kShortPanelHeight = 150;
1649 const int kTallPanelHeight = 200; 1649 const int kTallPanelHeight = 200;
1650 1650
1651 DesktopNotificationHostMsg_Show_Params params = StandardTestNotification(); 1651 content::ShowDesktopNotificationHostMsgParams params =
1652 StandardTestNotification();
1652 EXPECT_TRUE(service()->ShowDesktopNotification( 1653 EXPECT_TRUE(service()->ShowDesktopNotification(
1653 params, 0, 0, DesktopNotificationService::PageNotification)); 1654 params, 0, 0, DesktopNotificationService::PageNotification));
1654 MessageLoopForUI::current()->RunAllPending(); 1655 MessageLoopForUI::current()->RunAllPending();
1655 Balloon* balloon = balloons().front(); 1656 Balloon* balloon = balloons().front();
1656 int original_balloon_bottom = GetBalloonBottomPosition(balloon); 1657 int original_balloon_bottom = GetBalloonBottomPosition(balloon);
1657 // Ensure that balloon width is greater than the panel width. 1658 // Ensure that balloon width is greater than the panel width.
1658 EXPECT_GT(balloon->GetViewSize().width(), kPanelWidth); 1659 EXPECT_GT(balloon->GetViewSize().width(), kPanelWidth);
1659 1660
1660 // Creating a short panel should move the notification balloon up. 1661 // Creating a short panel should move the notification balloon up.
1661 Panel* panel1 = CreatePanelWithBounds( 1662 Panel* panel1 = CreatePanelWithBounds(
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 WaitForBoundsAnimationFinished(panel1); 1729 WaitForBoundsAnimationFinished(panel1);
1729 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up, 1730 EXPECT_EQ(balloon_bottom_after_tall_panel_titlebar_up,
1730 GetBalloonBottomPosition(balloon)); 1731 GetBalloonBottomPosition(balloon));
1731 1732
1732 // Closing the remaining tall panel should move the notification balloon back 1733 // Closing the remaining tall panel should move the notification balloon back
1733 // to its original position. 1734 // to its original position.
1734 panel2->Close(); 1735 panel2->Close();
1735 WaitForBoundsAnimationFinished(panel2); 1736 WaitForBoundsAnimationFinished(panel2);
1736 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon)); 1737 EXPECT_EQ(original_balloon_bottom, GetBalloonBottomPosition(balloon));
1737 } 1738 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/desktop_notifications_unittest.cc ('k') | content/browser/mock_content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698