| 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 #ifndef NET_QUIC_CHROMIUM_MOCK_NETWORK_CHANGE_NOTIFIER_H_ | 5 #ifndef NET_QUIC_CHROMIUM_MOCK_NETWORK_CHANGE_NOTIFIER_H_ |
| 6 #define NET_QUIC_CHROMIUM_MOCK_NETWORK_CHANGE_NOTIFIER_H_ | 6 #define NET_QUIC_CHROMIUM_MOCK_NETWORK_CHANGE_NOTIFIER_H_ |
| 7 | 7 |
| 8 #include "net/base/network_change_notifier.h" | 8 #include "net/base/network_change_notifier.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // but does not spin the message loop to actually deliver it. | 32 // but does not spin the message loop to actually deliver it. |
| 33 void QueueNetworkMadeDefault(NetworkChangeNotifier::NetworkHandle network); | 33 void QueueNetworkMadeDefault(NetworkChangeNotifier::NetworkHandle network); |
| 34 | 34 |
| 35 // Delivers a DISCONNECTED notification to observers. | 35 // Delivers a DISCONNECTED notification to observers. |
| 36 void NotifyNetworkDisconnected(NetworkChangeNotifier::NetworkHandle network); | 36 void NotifyNetworkDisconnected(NetworkChangeNotifier::NetworkHandle network); |
| 37 | 37 |
| 38 // Queues a DISCONNECTED notification to be delivered to observers | 38 // Queues a DISCONNECTED notification to be delivered to observers |
| 39 // but does not spin the message loop to actually deliver it. | 39 // but does not spin the message loop to actually deliver it. |
| 40 void QueueNetworkDisconnected(NetworkChangeNotifier::NetworkHandle network); | 40 void QueueNetworkDisconnected(NetworkChangeNotifier::NetworkHandle network); |
| 41 | 41 |
| 42 // Delivers a CONNECTED notification to observers. |
| 43 void NotifyNetworkConnected(NetworkChangeNotifier::NetworkHandle network); |
| 44 |
| 42 private: | 45 private: |
| 43 bool force_network_handles_supported_; | 46 bool force_network_handles_supported_; |
| 44 NetworkChangeNotifier::NetworkList connected_networks_; | 47 NetworkChangeNotifier::NetworkList connected_networks_; |
| 45 }; | 48 }; |
| 46 | 49 |
| 47 // Class to replace existing NetworkChangeNotifier singleton with a | 50 // Class to replace existing NetworkChangeNotifier singleton with a |
| 48 // MockNetworkChangeNotifier for a test. To use, simply create a | 51 // MockNetworkChangeNotifier for a test. To use, simply create a |
| 49 // ScopedMockNetworkChangeNotifier object in the test. | 52 // ScopedMockNetworkChangeNotifier object in the test. |
| 50 class ScopedMockNetworkChangeNotifier { | 53 class ScopedMockNetworkChangeNotifier { |
| 51 public: | 54 public: |
| 52 ScopedMockNetworkChangeNotifier(); | 55 ScopedMockNetworkChangeNotifier(); |
| 53 ~ScopedMockNetworkChangeNotifier(); | 56 ~ScopedMockNetworkChangeNotifier(); |
| 54 | 57 |
| 55 MockNetworkChangeNotifier* mock_network_change_notifier(); | 58 MockNetworkChangeNotifier* mock_network_change_notifier(); |
| 56 | 59 |
| 57 private: | 60 private: |
| 58 std::unique_ptr<NetworkChangeNotifier::DisableForTest> | 61 std::unique_ptr<NetworkChangeNotifier::DisableForTest> |
| 59 disable_network_change_notifier_for_tests_; | 62 disable_network_change_notifier_for_tests_; |
| 60 std::unique_ptr<MockNetworkChangeNotifier> mock_network_change_notifier_; | 63 std::unique_ptr<MockNetworkChangeNotifier> mock_network_change_notifier_; |
| 61 }; | 64 }; |
| 62 | 65 |
| 63 } // namespace test | 66 } // namespace test |
| 64 } // namespace net | 67 } // namespace net |
| 65 | 68 |
| 66 #endif // NET_QUIC_CHROMIUM_MOCK_NETWORK_CHANGE_NOTIFIER_H_ | 69 #endif // NET_QUIC_CHROMIUM_MOCK_NETWORK_CHANGE_NOTIFIER_H_ |
| OLD | NEW |