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

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

Issue 1967373003: Rename NetworkChangeNotifierAutoDetect.Observer.updateActiveNetworkList (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: expand renames Created 4 years, 7 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
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/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 delegate_.FakeDefaultNetwork(network, type); 245 delegate_.FakeDefaultNetwork(network, type);
246 break; 246 break;
247 case NONE: 247 case NONE:
248 NOTREACHED(); 248 NOTREACHED();
249 break; 249 break;
250 } 250 }
251 // See comment above. 251 // See comment above.
252 base::MessageLoop::current()->RunUntilIdle(); 252 base::MessageLoop::current()->RunUntilIdle();
253 } 253 }
254 254
255 void FakeUpdateActiveNetworkList( 255 void FakePurgeActiveNetworkList(NetworkChangeNotifier::NetworkList networks) {
256 NetworkChangeNotifier::NetworkList networks) { 256 delegate_.FakePurgeActiveNetworkList(networks);
257 delegate_.FakeUpdateActiveNetworkList(networks);
258 // See comment above. 257 // See comment above.
259 base::MessageLoop::current()->RunUntilIdle(); 258 base::MessageLoop::current()->RunUntilIdle();
260 } 259 }
261 260
262 NetworkChangeNotifierDelegateAndroid delegate_; 261 NetworkChangeNotifierDelegateAndroid delegate_;
263 }; 262 };
264 263
265 // Tests that NetworkChangeNotifierDelegateAndroid is initialized with the 264 // Tests that NetworkChangeNotifierDelegateAndroid is initialized with the
266 // actual connection type rather than a hardcoded one (e.g. 265 // actual connection type rather than a hardcoded one (e.g.
267 // CONNECTION_UNKNOWN). Initializing the connection type to CONNECTION_UNKNOWN 266 // CONNECTION_UNKNOWN). Initializing the connection type to CONNECTION_UNKNOWN
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 network_observer.ExpectChange(NONE, 507 network_observer.ExpectChange(NONE,
509 NetworkChangeNotifier::kInvalidNetworkHandle); 508 NetworkChangeNotifier::kInvalidNetworkHandle);
510 EXPECT_EQ(NetworkChangeNotifier::CONNECTION_4G, 509 EXPECT_EQ(NetworkChangeNotifier::CONNECTION_4G,
511 NetworkChangeNotifier::GetNetworkConnectionType(101)); 510 NetworkChangeNotifier::GetNetworkConnectionType(101));
512 // Test purging the network list 511 // Test purging the network list
513 NetworkChangeNotifier::GetConnectedNetworks(&network_list); 512 NetworkChangeNotifier::GetConnectedNetworks(&network_list);
514 EXPECT_EQ(2u, network_list.size()); 513 EXPECT_EQ(2u, network_list.size());
515 EXPECT_EQ(100, network_list[0]); 514 EXPECT_EQ(100, network_list[0]);
516 EXPECT_EQ(101, network_list[1]); 515 EXPECT_EQ(101, network_list[1]);
517 network_list.erase(network_list.begin() + 1); // Remove network 101 516 network_list.erase(network_list.begin() + 1); // Remove network 101
518 FakeUpdateActiveNetworkList(network_list); 517 FakePurgeActiveNetworkList(network_list);
519 network_observer.ExpectChange(DISCONNECTED, 101); 518 network_observer.ExpectChange(DISCONNECTED, 101);
520 NetworkChangeNotifier::GetConnectedNetworks(&network_list); 519 NetworkChangeNotifier::GetConnectedNetworks(&network_list);
521 EXPECT_EQ(1u, network_list.size()); 520 EXPECT_EQ(1u, network_list.size());
522 EXPECT_EQ(100, network_list[0]); 521 EXPECT_EQ(100, network_list[0]);
523 EXPECT_EQ(NetworkChangeNotifier::kInvalidNetworkHandle, 522 EXPECT_EQ(NetworkChangeNotifier::kInvalidNetworkHandle,
524 NetworkChangeNotifier::GetDefaultNetwork()); 523 NetworkChangeNotifier::GetDefaultNetwork());
525 524
526 NetworkChangeNotifier::RemoveNetworkObserver(&network_observer); 525 NetworkChangeNotifier::RemoveNetworkObserver(&network_observer);
527 } 526 }
528 527
529 } // namespace net 528 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698