| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_NETWORK_QUALITY_PROVIDER_STUB_H
_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_NETWORK_QUALITY_PROVIDER_STUB_H
_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_NETWORK_QUALITY_PROVIDER_STUB_H
_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_NETWORK_QUALITY_PROVIDER_STUB_H
_ |
| 7 | 7 |
| 8 #include "base/supports_user_data.h" | 8 #include "base/supports_user_data.h" |
| 9 #include "net/nqe/effective_connection_type.h" | 9 #include "net/nqe/effective_connection_type.h" |
| 10 #include "net/nqe/network_quality_estimator.h" | 10 #include "net/nqe/network_quality_provider.h" |
| 11 | 11 |
| 12 namespace offline_pages { | 12 namespace offline_pages { |
| 13 | 13 |
| 14 // Test class stubbing out the functionality of NQE::NetworkQualityProvider. | 14 // Test class stubbing out the functionality of NQE::NetworkQualityProvider. |
| 15 // It is only used for test support. | 15 // It is only used for test support. |
| 16 class NetworkQualityProviderStub | 16 class NetworkQualityProviderStub : public net::NetworkQualityProvider, |
| 17 : public net::NetworkQualityEstimator::NetworkQualityProvider, | 17 public base::SupportsUserData::Data { |
| 18 public base::SupportsUserData::Data { | |
| 19 public: | 18 public: |
| 20 NetworkQualityProviderStub(); | 19 NetworkQualityProviderStub(); |
| 21 ~NetworkQualityProviderStub() override; | 20 ~NetworkQualityProviderStub() override; |
| 22 | 21 |
| 23 static NetworkQualityProviderStub* GetUserData( | 22 static NetworkQualityProviderStub* GetUserData( |
| 24 base::SupportsUserData* supports_user_data); | 23 base::SupportsUserData* supports_user_data); |
| 25 static void SetUserData(base::SupportsUserData* supports_user_data, | 24 static void SetUserData(base::SupportsUserData* supports_user_data, |
| 26 std::unique_ptr<NetworkQualityProviderStub> stub); | 25 std::unique_ptr<NetworkQualityProviderStub> stub); |
| 27 | 26 |
| 28 net::EffectiveConnectionType GetEffectiveConnectionType() const override; | 27 net::EffectiveConnectionType GetEffectiveConnectionType() const override; |
| 29 | 28 |
| 30 void AddEffectiveConnectionTypeObserver( | |
| 31 net::NetworkQualityEstimator::EffectiveConnectionTypeObserver* observer) | |
| 32 override; | |
| 33 | |
| 34 void RemoveEffectiveConnectionTypeObserver( | |
| 35 net::NetworkQualityEstimator::EffectiveConnectionTypeObserver* observer) | |
| 36 override; | |
| 37 | |
| 38 void AddRTTAndThroughputEstimatesObserver( | |
| 39 net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver* observer) | |
| 40 override; | |
| 41 | |
| 42 void RemoveRTTAndThroughputEstimatesObserver( | |
| 43 net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver* observer) | |
| 44 override; | |
| 45 | |
| 46 void SetEffectiveConnectionTypeForTest(net::EffectiveConnectionType type) { | 29 void SetEffectiveConnectionTypeForTest(net::EffectiveConnectionType type) { |
| 47 connection_type_ = type; | 30 connection_type_ = type; |
| 48 } | 31 } |
| 49 | 32 |
| 50 private: | 33 private: |
| 51 net::EffectiveConnectionType connection_type_; | 34 net::EffectiveConnectionType connection_type_; |
| 52 }; | 35 }; |
| 53 | 36 |
| 54 } // namespace offline_pages | 37 } // namespace offline_pages |
| 55 | 38 |
| 56 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_NETWORK_QUALITY_PROVIDER_STU
B_H_ | 39 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_NETWORK_QUALITY_PROVIDER_STU
B_H_ |
| OLD | NEW |