| 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/base/network_change_notifier_win.h" |
| 6 |
| 5 #include "base/macros.h" | 7 #include "base/macros.h" |
| 6 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 7 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" |
| 8 #include "net/base/network_change_notifier.h" | 11 #include "net/base/network_change_notifier.h" |
| 9 #include "net/base/network_change_notifier_factory.h" | 12 #include "net/base/network_change_notifier_factory.h" |
| 10 #include "net/base/network_change_notifier_win.h" | |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 15 |
| 14 using ::testing::AtLeast; | 16 using ::testing::AtLeast; |
| 15 using ::testing::Invoke; | 17 using ::testing::Invoke; |
| 16 using ::testing::Return; | 18 using ::testing::Return; |
| 17 using ::testing::StrictMock; | 19 using ::testing::StrictMock; |
| 18 | 20 |
| 19 namespace net { | 21 namespace net { |
| 20 | 22 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 32 set_is_watching(false); | 34 set_is_watching(false); |
| 33 } | 35 } |
| 34 | 36 |
| 35 // From NetworkChangeNotifierWin. | 37 // From NetworkChangeNotifierWin. |
| 36 NetworkChangeNotifier::ConnectionType RecomputeCurrentConnectionType() | 38 NetworkChangeNotifier::ConnectionType RecomputeCurrentConnectionType() |
| 37 const override { | 39 const override { |
| 38 return NetworkChangeNotifier::CONNECTION_UNKNOWN; | 40 return NetworkChangeNotifier::CONNECTION_UNKNOWN; |
| 39 } | 41 } |
| 40 | 42 |
| 41 // From NetworkChangeNotifierWin. | 43 // From NetworkChangeNotifierWin. |
| 44 void RecomputeCurrentConnectionTypeOnDnsThread( |
| 45 base::Callback<void(ConnectionType)> reply_callback) const override { |
| 46 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 47 FROM_HERE, |
| 48 base::Bind(reply_callback, NetworkChangeNotifier::CONNECTION_UNKNOWN)); |
| 49 } |
| 50 |
| 51 // From NetworkChangeNotifierWin. |
| 42 MOCK_METHOD0(WatchForAddressChangeInternal, bool()); | 52 MOCK_METHOD0(WatchForAddressChangeInternal, bool()); |
| 43 | 53 |
| 44 private: | 54 private: |
| 45 DISALLOW_COPY_AND_ASSIGN(TestNetworkChangeNotifierWin); | 55 DISALLOW_COPY_AND_ASSIGN(TestNetworkChangeNotifierWin); |
| 46 }; | 56 }; |
| 47 | 57 |
| 48 class TestIPAddressObserver : public NetworkChangeNotifier::IPAddressObserver { | 58 class TestIPAddressObserver : public NetworkChangeNotifier::IPAddressObserver { |
| 49 public: | 59 public: |
| 50 TestIPAddressObserver() { | 60 TestIPAddressObserver() { |
| 51 NetworkChangeNotifier::AddIPAddressObserver(this); | 61 NetworkChangeNotifier::AddIPAddressObserver(this); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 263 } |
| 254 | 264 |
| 255 TEST_F(NetworkChangeNotifierWinTest, NetChangeWinFailSignalTwice) { | 265 TEST_F(NetworkChangeNotifierWinTest, NetChangeWinFailSignalTwice) { |
| 256 StartWatchingAndSucceed(); | 266 StartWatchingAndSucceed(); |
| 257 SignalAndFail(); | 267 SignalAndFail(); |
| 258 RetryAndFail(); | 268 RetryAndFail(); |
| 259 RetryAndSucceed(); | 269 RetryAndSucceed(); |
| 260 } | 270 } |
| 261 | 271 |
| 262 } // namespace net | 272 } // namespace net |
| OLD | NEW |