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 "extensions/test/extension_test_notification_observer.h" | 5 #include "extensions/test/extension_test_notification_observer.h" |
6 | 6 |
7 #include "content/public/browser/browser_context.h" | 7 #include "content/public/browser/browser_context.h" |
8 #include "content/public/browser/notification_details.h" | 8 #include "content/public/browser/notification_details.h" |
9 #include "content/public/browser/notification_registrar.h" | 9 #include "content/public/browser/notification_registrar.h" |
10 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 void ExtensionTestNotificationObserver::Watch( | 133 void ExtensionTestNotificationObserver::Watch( |
134 int type, | 134 int type, |
135 const content::NotificationSource& source) { | 135 const content::NotificationSource& source) { |
136 CHECK(!observer_); | 136 CHECK(!observer_); |
137 observer_.reset(new content::WindowedNotificationObserver(type, source)); | 137 observer_.reset(new content::WindowedNotificationObserver(type, source)); |
138 registrar_.Add(this, type, source); | 138 registrar_.Add(this, type, source); |
139 } | 139 } |
140 | 140 |
141 void ExtensionTestNotificationObserver::Wait() { | 141 void ExtensionTestNotificationObserver::Wait() { |
142 observer_->Wait(); | 142 observer_->Wait(); |
143 // TODO(...): Find out why tests fail without it. | |
Alexander Semashko
2017/02/21 21:33:47
Please advise what to do here, e.g. assign this TO
Devlin
2017/02/22 00:26:48
Filing a bug would probably be best here, ideally
Alexander Semashko
2017/02/22 17:10:08
Done, https://bugs.chromium.org/p/chromium/issues/
| |
144 content::RunAllPendingInMessageLoop(); | |
143 | 145 |
144 registrar_.RemoveAll(); | 146 registrar_.RemoveAll(); |
145 observer_.reset(); | 147 observer_.reset(); |
146 } | 148 } |
147 | 149 |
148 void ExtensionTestNotificationObserver::Observe( | 150 void ExtensionTestNotificationObserver::Observe( |
149 int type, | 151 int type, |
150 const content::NotificationSource& source, | 152 const content::NotificationSource& source, |
151 const content::NotificationDetails& details) { | 153 const content::NotificationDetails& details) { |
152 switch (type) { | 154 switch (type) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 condition_.Reset(); | 203 condition_.Reset(); |
202 quit_closure_.Reset(); | 204 quit_closure_.Reset(); |
203 } | 205 } |
204 | 206 |
205 void ExtensionTestNotificationObserver::MaybeQuit() { | 207 void ExtensionTestNotificationObserver::MaybeQuit() { |
206 if (condition_.Run()) | 208 if (condition_.Run()) |
207 quit_closure_.Run(); | 209 quit_closure_.Run(); |
208 } | 210 } |
209 | 211 |
210 } // namespace extensions | 212 } // namespace extensions |
OLD | NEW |