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

Side by Side Diff: extensions/test/extension_test_notification_observer.cc

Issue 2701473007: Switch WindowedNotificationObserver to use base::RunLoop. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « content/public/test/test_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
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
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
OLDNEW
« no previous file with comments | « content/public/test/test_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698