| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ |
| 6 #define CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 MockBalloonCollection(); | 31 MockBalloonCollection(); |
| 32 virtual ~MockBalloonCollection(); | 32 virtual ~MockBalloonCollection(); |
| 33 | 33 |
| 34 // Our mock collection has an area large enough for a fixed number | 34 // Our mock collection has an area large enough for a fixed number |
| 35 // of balloons. | 35 // of balloons. |
| 36 static const int kMockBalloonSpace; | 36 static const int kMockBalloonSpace; |
| 37 int max_balloon_count() const { return kMockBalloonSpace; } | 37 int max_balloon_count() const { return kMockBalloonSpace; } |
| 38 | 38 |
| 39 // BalloonCollectionImpl overrides | 39 // BalloonCollectionImpl overrides |
| 40 virtual void Add(const Notification& notification, | 40 virtual void Add(const Notification& notification, |
| 41 Profile* profile); | 41 Profile* profile) OVERRIDE; |
| 42 virtual bool HasSpace() const; | 42 virtual bool HasSpace() const OVERRIDE; |
| 43 virtual Balloon* MakeBalloon(const Notification& notification, | 43 virtual Balloon* MakeBalloon(const Notification& notification, |
| 44 Profile* profile); | 44 Profile* profile) OVERRIDE; |
| 45 virtual void DisplayChanged() {} | 45 virtual void DisplayChanged() OVERRIDE {} |
| 46 virtual void OnBalloonClosed(Balloon* source); | 46 virtual void OnBalloonClosed(Balloon* source) OVERRIDE; |
| 47 virtual const BalloonCollection::Balloons& GetActiveBalloons(); | 47 virtual const BalloonCollection::Balloons& GetActiveBalloons() OVERRIDE; |
| 48 | 48 |
| 49 // Number of balloons being shown. | 49 // Number of balloons being shown. |
| 50 std::deque<Balloon*>& balloons() { return balloons_; } | 50 std::deque<Balloon*>& balloons() { return balloons_; } |
| 51 int count() const { return balloons_.size(); } | 51 int count() const { return balloons_.size(); } |
| 52 | 52 |
| 53 // Returns the highest y-coordinate of all the balloons in the collection. | 53 // Returns the highest y-coordinate of all the balloons in the collection. |
| 54 int UppermostVerticalPosition(); | 54 int UppermostVerticalPosition(); |
| 55 | 55 |
| 56 // Returns the height bounds of a balloon. | 56 // Returns the height bounds of a balloon. |
| 57 int MinHeight() { return Layout::min_balloon_height(); } | 57 int MinHeight() { return Layout::min_balloon_height(); } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 72 virtual ~DesktopNotificationsTest(); | 72 virtual ~DesktopNotificationsTest(); |
| 73 | 73 |
| 74 static void log(const std::string& message) { | 74 static void log(const std::string& message) { |
| 75 log_output_.append(message); | 75 log_output_.append(message); |
| 76 } | 76 } |
| 77 | 77 |
| 78 Profile* profile() { return profile_.get(); } | 78 Profile* profile() { return profile_.get(); } |
| 79 | 79 |
| 80 protected: | 80 protected: |
| 81 // testing::Test overrides | 81 // testing::Test overrides |
| 82 virtual void SetUp(); | 82 virtual void SetUp() OVERRIDE; |
| 83 virtual void TearDown(); | 83 virtual void TearDown() OVERRIDE; |
| 84 | 84 |
| 85 void AllowOrigin(const GURL& origin) { | 85 void AllowOrigin(const GURL& origin) { |
| 86 service_->GrantPermission(origin); | 86 service_->GrantPermission(origin); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void DenyOrigin(const GURL& origin) { | 89 void DenyOrigin(const GURL& origin) { |
| 90 service_->DenyPermission(origin); | 90 service_->DenyPermission(origin); |
| 91 } | 91 } |
| 92 | 92 |
| 93 // Constructs a notification parameter structure for use in tests. | 93 // Constructs a notification parameter structure for use in tests. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 111 scoped_ptr<NotificationUIManager> ui_manager_; | 111 scoped_ptr<NotificationUIManager> ui_manager_; |
| 112 | 112 |
| 113 // Real DesktopNotificationService | 113 // Real DesktopNotificationService |
| 114 scoped_ptr<DesktopNotificationService> service_; | 114 scoped_ptr<DesktopNotificationService> service_; |
| 115 | 115 |
| 116 // Contains the cumulative output of the unit test. | 116 // Contains the cumulative output of the unit test. |
| 117 static std::string log_output_; | 117 static std::string log_output_; |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ | 120 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATIONS_UNITTEST_H_ |
| OLD | NEW |