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

Side by Side Diff: net/android/network_change_notifier_android_unittest.cc

Issue 1162943002: Replace more ObserverList with base::ObserverList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@observer
Patch Set: Created 5 years, 6 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 | « mojo/common/message_pump_mojo.h ('k') | net/android/network_change_notifier_delegate_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // See network_change_notifier_android.h for design explanations. 5 // See network_change_notifier_android.h for design explanations.
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 // Going from offline to online should trigger a notification. 117 // Going from offline to online should trigger a notification.
118 SetOnline(); 118 SetOnline();
119 EXPECT_EQ(2, notifications_count_getter.Run()); 119 EXPECT_EQ(2, notifications_count_getter.Run());
120 EXPECT_EQ(NetworkChangeNotifier::CONNECTION_UNKNOWN, 120 EXPECT_EQ(NetworkChangeNotifier::CONNECTION_UNKNOWN,
121 connection_type_getter.Run()); 121 connection_type_getter.Run());
122 } 122 }
123 123
124 void SetOnline() { 124 void SetOnline() {
125 delegate_.SetOnline(); 125 delegate_.SetOnline();
126 // Note that this is needed because ObserverListThreadSafe uses PostTask(). 126 // Note that this is needed because base::ObserverListThreadSafe uses
127 // PostTask().
127 base::MessageLoop::current()->RunUntilIdle(); 128 base::MessageLoop::current()->RunUntilIdle();
128 } 129 }
129 130
130 void SetOffline() { 131 void SetOffline() {
131 delegate_.SetOffline(); 132 delegate_.SetOffline();
132 // See comment above. 133 // See comment above.
133 base::MessageLoop::current()->RunUntilIdle(); 134 base::MessageLoop::current()->RunUntilIdle();
134 } 135 }
135 136
136 NetworkChangeNotifierDelegateAndroid delegate_; 137 NetworkChangeNotifierDelegateAndroid delegate_;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 TEST_F(NetworkChangeNotifierAndroidTest, InitialSignal) { 273 TEST_F(NetworkChangeNotifierAndroidTest, InitialSignal) {
273 DNSChangeObserver dns_change_observer; 274 DNSChangeObserver dns_change_observer;
274 NetworkChangeNotifier::AddDNSObserver(&dns_change_observer); 275 NetworkChangeNotifier::AddDNSObserver(&dns_change_observer);
275 base::MessageLoop::current()->Run(); 276 base::MessageLoop::current()->Run();
276 EXPECT_EQ(1, dns_change_observer.initial_notifications_count()); 277 EXPECT_EQ(1, dns_change_observer.initial_notifications_count());
277 EXPECT_EQ(0, dns_change_observer.change_notifications_count()); 278 EXPECT_EQ(0, dns_change_observer.change_notifications_count());
278 NetworkChangeNotifier::RemoveDNSObserver(&dns_change_observer); 279 NetworkChangeNotifier::RemoveDNSObserver(&dns_change_observer);
279 } 280 }
280 281
281 } // namespace net 282 } // namespace net
OLDNEW
« no previous file with comments | « mojo/common/message_pump_mojo.h ('k') | net/android/network_change_notifier_delegate_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698