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

Side by Side Diff: chrome/browser/notifications/notification_test_util.h

Issue 6523032: Even more test cleanup. Some fixes to non-test code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 months 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) 2010 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_NOTIFICATION_TEST_UTIL_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "chrome/browser/notifications/notification_object_proxy.h" 11 #include "chrome/browser/notifications/notification_object_proxy.h"
12 #include "chrome/browser/notifications/balloon.h" 12 #include "chrome/browser/notifications/balloon.h"
13 #include "ui/gfx/size.h" 13 #include "ui/gfx/size.h"
14 14
15 // NotificationDelegate which does nothing, useful for testing when 15 // NotificationDelegate which does nothing, useful for testing when
16 // the notification events are not important. 16 // the notification events are not important.
17 class MockNotificationDelegate : public NotificationDelegate { 17 class MockNotificationDelegate : public NotificationDelegate {
18 public: 18 public:
19 explicit MockNotificationDelegate(const std::string& id) : id_(id) {} 19 explicit MockNotificationDelegate(const std::string& id);
20 virtual ~MockNotificationDelegate() {} 20 virtual ~MockNotificationDelegate();
21 21
22 // NotificationDelegate interface. 22 // NotificationDelegate interface.
23 virtual void Display() {} 23 virtual void Display() {}
24 virtual void Error() {} 24 virtual void Error() {}
25 virtual void Close(bool by_user) {} 25 virtual void Close(bool by_user) {}
26 virtual void Click() {} 26 virtual void Click() {}
27 virtual std::string id() const { return id_; } 27 virtual std::string id() const;
28 28
29 private: 29 private:
30 std::string id_; 30 std::string id_;
31 31
32 DISALLOW_COPY_AND_ASSIGN(MockNotificationDelegate); 32 DISALLOW_COPY_AND_ASSIGN(MockNotificationDelegate);
33 }; 33 };
34 34
35 // Mock implementation of Javascript object proxy which logs events that 35 // Mock implementation of Javascript object proxy which logs events that
36 // would have been fired on it. Useful for tests where the sequence of 36 // would have been fired on it. Useful for tests where the sequence of
37 // notification events needs to be verified. 37 // notification events needs to be verified.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 DISALLOW_COPY_AND_ASSIGN(LoggingNotificationDelegate); 70 DISALLOW_COPY_AND_ASSIGN(LoggingNotificationDelegate);
71 }; 71 };
72 72
73 // Test version of a balloon view which doesn't do anything 73 // Test version of a balloon view which doesn't do anything
74 // viewable, but does know how to close itself the same as a regular 74 // viewable, but does know how to close itself the same as a regular
75 // BalloonView. 75 // BalloonView.
76 class MockBalloonView : public BalloonView { 76 class MockBalloonView : public BalloonView {
77 public: 77 public:
78 explicit MockBalloonView(Balloon * balloon) : 78 explicit MockBalloonView(Balloon * balloon) :
79 balloon_(balloon) {} 79 balloon_(balloon) {}
80 void Show(Balloon* balloon) {} 80
81 void Update() {} 81 // BalloonView:
82 void RepositionToBalloon() {} 82 virtual void Show(Balloon* balloon) {}
83 void Close(bool by_user) { balloon_->OnClose(by_user); } 83 virtual void Update() {}
84 gfx::Size GetSize() const { return balloon_->content_size(); } 84 virtual void RepositionToBalloon() {}
85 BalloonHost* GetHost() const { return NULL; } 85 virtual void Close(bool by_user);
86 virtual gfx::Size GetSize() const;
87 virtual BalloonHost* GetHost() const;
86 88
87 private: 89 private:
88 // Non-owned pointer. 90 // Non-owned pointer.
89 Balloon* balloon_; 91 Balloon* balloon_;
90 }; 92 };
91 93
92 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_ 94 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TEST_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698