diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-15 22:10:01 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-15 22:10:01 +0000 |
commit | 8d167c212898cb233c51abf13913541c86cfd9ae (patch) | |
tree | f33768df22c405d0ea3e3521a14fc03f565fc07d /chrome/browser/notifications | |
parent | dce08b668bed17b26e497ca56129538ba3da0b42 (diff) | |
download | chromium_src-8d167c212898cb233c51abf13913541c86cfd9ae.zip chromium_src-8d167c212898cb233c51abf13913541c86cfd9ae.tar.gz chromium_src-8d167c212898cb233c51abf13913541c86cfd9ae.tar.bz2 |
Even more test cleanup. Some fixes to non-test code that's regressed.
BUG=none
TEST=compiles
Review URL: http://codereview.chromium.org/6523032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75014 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications')
4 files changed, 48 insertions, 14 deletions
diff --git a/chrome/browser/notifications/desktop_notifications_unittest.cc b/chrome/browser/notifications/desktop_notifications_unittest.cc index 6effdf1..1470cb6 100644 --- a/chrome/browser/notifications/desktop_notifications_unittest.cc +++ b/chrome/browser/notifications/desktop_notifications_unittest.cc @@ -35,6 +35,10 @@ void MockBalloonCollection::Add(const Notification& notification, BalloonCollectionImpl::Add(test_notification, profile); } +bool MockBalloonCollection::HasSpace() const { + return count() < kMockBalloonSpace; +} + Balloon* MockBalloonCollection::MakeBalloon(const Notification& notification, Profile* profile) { // Start with a normal balloon but mock out the view. @@ -55,6 +59,10 @@ void MockBalloonCollection::OnBalloonClosed(Balloon* source) { } } +const BalloonCollection::Balloons& MockBalloonCollection::GetActiveBalloons() { + return balloons_; +} + int MockBalloonCollection::UppermostVerticalPosition() { int min = 0; std::deque<Balloon*>::iterator iter; diff --git a/chrome/browser/notifications/desktop_notifications_unittest.h b/chrome/browser/notifications/desktop_notifications_unittest.h index 25e5270..faa470a 100644 --- a/chrome/browser/notifications/desktop_notifications_unittest.h +++ b/chrome/browser/notifications/desktop_notifications_unittest.h @@ -39,14 +39,12 @@ class MockBalloonCollection : public BalloonCollectionImpl { // BalloonCollectionImpl overrides virtual void Add(const Notification& notification, Profile* profile); - virtual bool HasSpace() const { return count() < kMockBalloonSpace; } + virtual bool HasSpace() const; virtual Balloon* MakeBalloon(const Notification& notification, Profile* profile); virtual void DisplayChanged() {} virtual void OnBalloonClosed(Balloon* source); - virtual const BalloonCollection::Balloons& GetActiveBalloons() { - return balloons_; - } + virtual const BalloonCollection::Balloons& GetActiveBalloons(); // Number of balloons being shown. std::deque<Balloon*>& balloons() { return balloons_; } diff --git a/chrome/browser/notifications/notification_test_util.cc b/chrome/browser/notifications/notification_test_util.cc new file mode 100644 index 0000000..540e296 --- /dev/null +++ b/chrome/browser/notifications/notification_test_util.cc @@ -0,0 +1,26 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/notifications/notification_test_util.h" + +MockNotificationDelegate::MockNotificationDelegate(const std::string& id) + : id_(id) {} + +MockNotificationDelegate::~MockNotificationDelegate() {} + +std::string MockNotificationDelegate::id() const { + return id_; +} + +void MockBalloonView::Close(bool by_user) { + balloon_->OnClose(by_user); +} + +gfx::Size MockBalloonView::GetSize() const { + return balloon_->content_size(); +} + +BalloonHost* MockBalloonView::GetHost() const { + return NULL; +} diff --git a/chrome/browser/notifications/notification_test_util.h b/chrome/browser/notifications/notification_test_util.h index 38863cf..19b1fd7 100644 --- a/chrome/browser/notifications/notification_test_util.h +++ b/chrome/browser/notifications/notification_test_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,15 +16,15 @@ // the notification events are not important. class MockNotificationDelegate : public NotificationDelegate { public: - explicit MockNotificationDelegate(const std::string& id) : id_(id) {} - virtual ~MockNotificationDelegate() {} + explicit MockNotificationDelegate(const std::string& id); + virtual ~MockNotificationDelegate(); // NotificationDelegate interface. virtual void Display() {} virtual void Error() {} virtual void Close(bool by_user) {} virtual void Click() {} - virtual std::string id() const { return id_; } + virtual std::string id() const; private: std::string id_; @@ -77,12 +77,14 @@ class MockBalloonView : public BalloonView { public: explicit MockBalloonView(Balloon * balloon) : balloon_(balloon) {} - void Show(Balloon* balloon) {} - void Update() {} - void RepositionToBalloon() {} - void Close(bool by_user) { balloon_->OnClose(by_user); } - gfx::Size GetSize() const { return balloon_->content_size(); } - BalloonHost* GetHost() const { return NULL; } + + // BalloonView: + virtual void Show(Balloon* balloon) {} + virtual void Update() {} + virtual void RepositionToBalloon() {} + virtual void Close(bool by_user); + virtual gfx::Size GetSize() const; + virtual BalloonHost* GetHost() const; private: // Non-owned pointer. |