diff options
author | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-11 17:40:31 +0000 |
---|---|---|
committer | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-11 17:40:31 +0000 |
commit | 8b7135d6aa44d68307bfb7ff5e6441fcf1c5231b (patch) | |
tree | 39f24246b28900218dded1cfe462ebe400ee3a6d /chrome/browser/notifications/balloon_collection.h | |
parent | 4a3dab23cadf0cbe68bd82c06fd970ae8b1d7e10 (diff) | |
download | chromium_src-8b7135d6aa44d68307bfb7ff5e6441fcf1c5231b.zip chromium_src-8b7135d6aa44d68307bfb7ff5e6441fcf1c5231b.tar.gz chromium_src-8b7135d6aa44d68307bfb7ff5e6441fcf1c5231b.tar.bz2 |
Unit tests for desktop notifications.
* Allow non-windows BalloonCollections to create non-viewable balloons (so that non-viewing aspects are cross-platform testable)
* Makes NotificationObjectProxy overridable by a mock object which logs instead of calls to JS
* Move Layout code from private to protected in BalloonCollection to enable verification of position code.
BUG=none
TEST=these
Review URL: http://codereview.chromium.org/371041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31670 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications/balloon_collection.h')
-rw-r--r-- | chrome/browser/notifications/balloon_collection.h | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/chrome/browser/notifications/balloon_collection.h b/chrome/browser/notifications/balloon_collection.h index 8241f19..918f993 100644 --- a/chrome/browser/notifications/balloon_collection.h +++ b/chrome/browser/notifications/balloon_collection.h @@ -70,18 +70,6 @@ class BalloonCollectionImpl : public BalloonCollection, virtual void OnBalloonClosed(Balloon* source); protected: - // Creates a new balloon. Overridable by unit tests. The caller is - // responsible for freeing the pointer returned. - virtual Balloon* MakeBalloon(const Notification& notification, - Profile* profile); - - private: - // The number of balloons being displayed. - int count() const { return balloons_.size(); } - - // Adjusts the positions of the balloons (e.g., when one is closed). - void PositionBalloons(bool is_reposition); - // Calculates layout values for the balloons including // the scaling, the max/min sizes, and the upper left corner of each. class Layout { @@ -92,10 +80,10 @@ class BalloonCollectionImpl : public BalloonCollection, void OnDisplaySettingsChanged(); // TODO(johnnyg): Scale the size to account for the system font factor. - int min_balloon_width() const { return kBalloonMinWidth; } - int max_balloon_width() const { return kBalloonMaxWidth; } - int min_balloon_height() const { return kBalloonMinHeight; } - int max_balloon_height() const { return kBalloonMaxHeight; } + static int min_balloon_width() { return kBalloonMinWidth; } + static int max_balloon_width() { return kBalloonMaxWidth; } + static int min_balloon_height() { return kBalloonMinHeight; } + static int max_balloon_height() { return kBalloonMaxHeight; } // Returns both the total space available and the maximum // allowed per balloon. @@ -140,6 +128,18 @@ class BalloonCollectionImpl : public BalloonCollection, DISALLOW_COPY_AND_ASSIGN(Layout); }; + // Creates a new balloon. Overridable by unit tests. The caller is + // responsible for freeing the pointer returned. + virtual Balloon* MakeBalloon(const Notification& notification, + Profile* profile); + + private: + // The number of balloons being displayed. + int count() const { return balloons_.size(); } + + // Adjusts the positions of the balloons (e.g., when one is closed). + void PositionBalloons(bool is_reposition); + // Non-owned pointer to an object listening for space changes. BalloonSpaceChangeListener* space_change_listener_; |