| OLD | NEW |
| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 class DNSChangeObserver : public NetworkChangeNotifier::DNSObserver { | 88 class DNSChangeObserver : public NetworkChangeNotifier::DNSObserver { |
| 89 public: | 89 public: |
| 90 DNSChangeObserver() | 90 DNSChangeObserver() |
| 91 : change_notifications_count_(0), initial_notifications_count_(0) {} | 91 : change_notifications_count_(0), initial_notifications_count_(0) {} |
| 92 | 92 |
| 93 // NetworkChangeNotifier::DNSObserver: | 93 // NetworkChangeNotifier::DNSObserver: |
| 94 void OnDNSChanged() override { change_notifications_count_++; } | 94 void OnDNSChanged() override { change_notifications_count_++; } |
| 95 | 95 |
| 96 void OnInitialDNSConfigRead() override { | 96 void OnInitialDNSConfigRead() override { |
| 97 initial_notifications_count_++; | 97 initial_notifications_count_++; |
| 98 base::MessageLoop::current()->Quit(); | 98 base::MessageLoop::current()->QuitWhenIdle(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 int change_notifications_count() const { return change_notifications_count_; } | 101 int change_notifications_count() const { return change_notifications_count_; } |
| 102 | 102 |
| 103 int initial_notifications_count() const { | 103 int initial_notifications_count() const { |
| 104 return initial_notifications_count_; | 104 return initial_notifications_count_; |
| 105 } | 105 } |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 int change_notifications_count_; | 108 int change_notifications_count_; |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 NetworkChangeNotifier::GetConnectedNetworks(&network_list); | 475 NetworkChangeNotifier::GetConnectedNetworks(&network_list); |
| 476 EXPECT_EQ(1u, network_list.size()); | 476 EXPECT_EQ(1u, network_list.size()); |
| 477 EXPECT_EQ(100, network_list[0]); | 477 EXPECT_EQ(100, network_list[0]); |
| 478 EXPECT_EQ(NetworkChangeNotifier::kInvalidNetworkHandle, | 478 EXPECT_EQ(NetworkChangeNotifier::kInvalidNetworkHandle, |
| 479 NetworkChangeNotifier::GetDefaultNetwork()); | 479 NetworkChangeNotifier::GetDefaultNetwork()); |
| 480 | 480 |
| 481 NetworkChangeNotifier::RemoveNetworkObserver(&network_observer); | 481 NetworkChangeNotifier::RemoveNetworkObserver(&network_observer); |
| 482 } | 482 } |
| 483 | 483 |
| 484 } // namespace net | 484 } // namespace net |
| OLD | NEW |