| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "chromecast/net/connectivity_checker.h" | 6 #include "chromecast/net/connectivity_checker.h" |
| 7 | 7 |
| 8 namespace chromecast { | 8 namespace chromecast { |
| 9 | 9 |
| 10 // A simple fake connectivity checker for testing. Will appeared to be | 10 // A simple fake connectivity checker for testing. Will appeared to be |
| 11 // connected by default. | 11 // connected by default. |
| 12 class FakeConnectivityChecker : public ConnectivityChecker { | 12 class FakeConnectivityChecker : public ConnectivityChecker { |
| 13 public: | 13 public: |
| 14 FakeConnectivityChecker(); | 14 FakeConnectivityChecker(); |
| 15 | 15 |
| 16 // ConnectivityChecker implementation: | 16 // ConnectivityChecker implementation: |
| 17 bool Connected() const override; | 17 bool Connected() const override; |
| 18 void Check() override; | 18 void Check() override; |
| 19 | 19 |
| 20 // Sets connectivity and notifies observers if it has changed. | 20 // Sets connectivity and notifies observers if it has changed. |
| 21 void SetConnectedForTest(bool connected); | 21 void SetConnectedForTest(bool connected); |
| 22 void DetachFromPrefService() override; |
| 22 | 23 |
| 23 protected: | 24 protected: |
| 24 ~FakeConnectivityChecker() override; | 25 ~FakeConnectivityChecker() override; |
| 25 | 26 |
| 26 private: | 27 private: |
| 27 friend class base::RefCountedThreadSafe<FakeConnectivityChecker>; | 28 friend class base::RefCountedThreadSafe<FakeConnectivityChecker>; |
| 28 bool connected_; | 29 bool connected_; |
| 29 | 30 |
| 30 DISALLOW_COPY_AND_ASSIGN(FakeConnectivityChecker); | 31 DISALLOW_COPY_AND_ASSIGN(FakeConnectivityChecker); |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 } // namespace chromecast | 34 } // namespace chromecast |
| OLD | NEW |