OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
6 #include <string> | 6 #include <string> |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 bool ready_ = false; | 70 bool ready_ = false; |
71 | 71 |
72 DISALLOW_COPY_AND_ASSIGN(NotificationsObserver); | 72 DISALLOW_COPY_AND_ASSIGN(NotificationsObserver); |
73 }; | 73 }; |
74 | 74 |
75 } // anonymous namespace | 75 } // anonymous namespace |
76 | 76 |
77 class ArcNotificationManagerTest : public testing::Test { | 77 class ArcNotificationManagerTest : public testing::Test { |
78 public: | 78 public: |
79 ArcNotificationManagerTest() {} | 79 ArcNotificationManagerTest() {} |
80 ~ArcNotificationManagerTest() override { loop_.RunUntilIdle(); } | 80 ~ArcNotificationManagerTest() override { base::RunLoop().RunUntilIdle(); } |
81 | 81 |
82 protected: | 82 protected: |
83 FakeArcBridgeService* service() { return service_.get(); } | 83 FakeArcBridgeService* service() { return service_.get(); } |
84 FakeNotificationsInstance* arc_notifications_instance() { | 84 FakeNotificationsInstance* arc_notifications_instance() { |
85 return arc_notifications_instance_.get(); | 85 return arc_notifications_instance_.get(); |
86 } | 86 } |
87 ArcNotificationManager* arc_notification_manager() { | 87 ArcNotificationManager* arc_notification_manager() { |
88 return arc_notification_manager_.get(); | 88 return arc_notification_manager_.get(); |
89 } | 89 } |
90 MockMessageCenter* message_center() { return message_center_.get(); } | 90 MockMessageCenter* message_center() { return message_center_.get(); } |
(...skipping 29 matching lines...) Expand all Loading... |
120 message_center_.reset(new MockMessageCenter()); | 120 message_center_.reset(new MockMessageCenter()); |
121 | 121 |
122 arc_notification_manager_.reset(new ArcNotificationManager( | 122 arc_notification_manager_.reset(new ArcNotificationManager( |
123 service(), EmptyAccountId(), message_center_.get())); | 123 service(), EmptyAccountId(), message_center_.get())); |
124 | 124 |
125 NotificationsObserver observer; | 125 NotificationsObserver observer; |
126 service_->notifications()->AddObserver(&observer); | 126 service_->notifications()->AddObserver(&observer); |
127 service_->notifications()->SetInstance(arc_notifications_instance_.get()); | 127 service_->notifications()->SetInstance(arc_notifications_instance_.get()); |
128 | 128 |
129 while (!observer.IsReady()) | 129 while (!observer.IsReady()) |
130 loop_.RunUntilIdle(); | 130 base::RunLoop().RunUntilIdle(); |
131 | 131 |
132 service_->notifications()->RemoveObserver(&observer); | 132 service_->notifications()->RemoveObserver(&observer); |
133 } | 133 } |
134 | 134 |
135 void TearDown() override { | 135 void TearDown() override { |
136 arc_notification_manager_.reset(); | 136 arc_notification_manager_.reset(); |
137 message_center_.reset(); | 137 message_center_.reset(); |
138 service_.reset(); | 138 service_.reset(); |
139 arc_notifications_instance_.reset(); | 139 arc_notifications_instance_.reset(); |
140 } | 140 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 CreateNotificationWithKey("notification2"); | 178 CreateNotificationWithKey("notification2"); |
179 CreateNotificationWithKey("notification3"); | 179 CreateNotificationWithKey("notification3"); |
180 EXPECT_EQ(3u, message_center()->GetVisibleNotifications().size()); | 180 EXPECT_EQ(3u, message_center()->GetVisibleNotifications().size()); |
181 | 181 |
182 arc_notification_manager()->OnInstanceClosed(); | 182 arc_notification_manager()->OnInstanceClosed(); |
183 | 183 |
184 EXPECT_EQ(0u, message_center()->GetVisibleNotifications().size()); | 184 EXPECT_EQ(0u, message_center()->GetVisibleNotifications().size()); |
185 } | 185 } |
186 | 186 |
187 } // namespace arc | 187 } // namespace arc |
OLD | NEW |