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 #include "net/quic/chromium/mock_network_change_notifier.h" | 5 #include "net/quic/chromium/mock_network_change_notifier.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 namespace test { | 10 namespace test { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // Spin the message loop so the notification is delivered. | 56 // Spin the message loop so the notification is delivered. |
57 base::RunLoop().RunUntilIdle(); | 57 base::RunLoop().RunUntilIdle(); |
58 } | 58 } |
59 | 59 |
60 void MockNetworkChangeNotifier::QueueNetworkDisconnected( | 60 void MockNetworkChangeNotifier::QueueNetworkDisconnected( |
61 NetworkChangeNotifier::NetworkHandle network) { | 61 NetworkChangeNotifier::NetworkHandle network) { |
62 NetworkChangeNotifier::NotifyObserversOfSpecificNetworkChange( | 62 NetworkChangeNotifier::NotifyObserversOfSpecificNetworkChange( |
63 NetworkChangeNotifier::DISCONNECTED, network); | 63 NetworkChangeNotifier::DISCONNECTED, network); |
64 } | 64 } |
65 | 65 |
| 66 void MockNetworkChangeNotifier::NotifyNetworkConnected( |
| 67 NetworkChangeNotifier::NetworkHandle network) { |
| 68 NetworkChangeNotifier::NotifyObserversOfSpecificNetworkChange( |
| 69 NetworkChangeNotifier::CONNECTED, network); |
| 70 // Spin the message loop so the notification is delivered. |
| 71 base::RunLoop().RunUntilIdle(); |
| 72 } |
| 73 |
66 ScopedMockNetworkChangeNotifier::ScopedMockNetworkChangeNotifier() | 74 ScopedMockNetworkChangeNotifier::ScopedMockNetworkChangeNotifier() |
67 : disable_network_change_notifier_for_tests_( | 75 : disable_network_change_notifier_for_tests_( |
68 new NetworkChangeNotifier::DisableForTest()), | 76 new NetworkChangeNotifier::DisableForTest()), |
69 mock_network_change_notifier_(new MockNetworkChangeNotifier()) {} | 77 mock_network_change_notifier_(new MockNetworkChangeNotifier()) {} |
70 | 78 |
71 ScopedMockNetworkChangeNotifier::~ScopedMockNetworkChangeNotifier() {} | 79 ScopedMockNetworkChangeNotifier::~ScopedMockNetworkChangeNotifier() {} |
72 | 80 |
73 MockNetworkChangeNotifier* | 81 MockNetworkChangeNotifier* |
74 ScopedMockNetworkChangeNotifier::mock_network_change_notifier() { | 82 ScopedMockNetworkChangeNotifier::mock_network_change_notifier() { |
75 return mock_network_change_notifier_.get(); | 83 return mock_network_change_notifier_.get(); |
76 } | 84 } |
77 | 85 |
78 } // namespace test | 86 } // namespace test |
79 } // namespace net | 87 } // namespace net |
OLD | NEW |