OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/scoped_nsobject.h" | 5 #include "base/memory/scoped_nsobject.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/notifications/balloon.h" | 7 #include "chrome/browser/notifications/balloon.h" |
8 #include "chrome/browser/notifications/balloon_collection.h" | 8 #include "chrome/browser/notifications/balloon_collection.h" |
9 #include "chrome/browser/notifications/notification.h" | 9 #include "chrome/browser/notifications/notification.h" |
10 #include "chrome/browser/notifications/notification_object_proxy.h" | 10 #include "chrome/browser/notifications/notification_object_proxy.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 @implementation TestBalloonController | 27 @implementation TestBalloonController |
28 - (void)initializeHost {} | 28 - (void)initializeHost {} |
29 @end | 29 @end |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 // Use a dummy balloon collection for testing. | 33 // Use a dummy balloon collection for testing. |
34 class MockBalloonCollection : public BalloonCollection { | 34 class MockBalloonCollection : public BalloonCollection { |
35 virtual void Add(const Notification& notification, | 35 virtual void Add(const Notification& notification, |
36 Profile* profile) {} | 36 Profile* profile) OVERRIDE {} |
37 virtual bool DoesIdExist(const std::string& id) { return false; } | 37 virtual bool DoesIdExist(const std::string& id) OVERRIDE { return false; } |
38 virtual bool RemoveById(const std::string& id) { return false; } | 38 virtual bool RemoveById(const std::string& id) OVERRIDE { return false; } |
39 virtual bool RemoveBySourceOrigin(const GURL& origin) { return false; } | 39 virtual bool RemoveBySourceOrigin(const GURL& origin) OVERRIDE { |
40 virtual bool RemoveByProfile(Profile* profile) { return false; } | 40 return false; |
41 virtual void RemoveAll() {} | 41 } |
42 virtual bool HasSpace() const { return true; } | 42 virtual bool RemoveByProfile(Profile* profile) OVERRIDE { return false; } |
43 virtual void ResizeBalloon(Balloon* balloon, const gfx::Size& size) {} | 43 virtual void RemoveAll() OVERRIDE {} |
44 virtual void DisplayChanged() {} | 44 virtual bool HasSpace() const OVERRIDE { return true; } |
45 virtual void SetPositionPreference(PositionPreference preference) {} | 45 virtual void ResizeBalloon( |
46 virtual void OnBalloonClosed(Balloon* source) {}; | 46 Balloon* balloon, |
47 virtual const Balloons& GetActiveBalloons() { | 47 const gfx::Size& size) OVERRIDE { |
| 48 } |
| 49 virtual void DisplayChanged() OVERRIDE {} |
| 50 virtual void SetPositionPreference(PositionPreference preference) OVERRIDE {} |
| 51 virtual void OnBalloonClosed(Balloon* source) OVERRIDE {}; |
| 52 virtual const Balloons& GetActiveBalloons() OVERRIDE { |
48 NOTREACHED(); | 53 NOTREACHED(); |
49 return balloons_; | 54 return balloons_; |
50 } | 55 } |
51 private: | 56 private: |
52 Balloons balloons_; | 57 Balloons balloons_; |
53 }; | 58 }; |
54 | 59 |
55 class BalloonControllerTest : public ChromeRenderViewHostTestHarness { | 60 class BalloonControllerTest : public ChromeRenderViewHostTestHarness { |
56 public: | 61 public: |
57 BalloonControllerTest() : | 62 BalloonControllerTest() : |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 119 |
115 [controller showWindow:nil]; | 120 [controller showWindow:nil]; |
116 | 121 |
117 EXPECT_TRUE([controller desiredTotalWidth] > 100); | 122 EXPECT_TRUE([controller desiredTotalWidth] > 100); |
118 EXPECT_TRUE([controller desiredTotalHeight] > 100); | 123 EXPECT_TRUE([controller desiredTotalHeight] > 100); |
119 | 124 |
120 [controller closeBalloon:YES]; | 125 [controller closeBalloon:YES]; |
121 } | 126 } |
122 | 127 |
123 } | 128 } |
OLD | NEW |