| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_NETWORK_QUALITY_PROVIDER_STUB_H_ | |
| 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_NETWORK_QUALITY_PROVIDER_STUB_H_ | |
| 7 | |
| 8 #include "base/supports_user_data.h" | |
| 9 #include "net/nqe/effective_connection_type.h" | |
| 10 #include "net/nqe/network_quality_estimator.h" | |
| 11 | |
| 12 namespace offline_pages { | |
| 13 | |
| 14 // Test class stubbing out the functionality of NQE::NetworkQualityProvider. | |
| 15 // It is only used for test support. | |
| 16 class NetworkQualityProviderStub | |
| 17 : public net::NetworkQualityEstimator::NetworkQualityProvider, | |
| 18 public base::SupportsUserData::Data { | |
| 19 public: | |
| 20 NetworkQualityProviderStub(); | |
| 21 ~NetworkQualityProviderStub() override; | |
| 22 | |
| 23 static NetworkQualityProviderStub* GetUserData( | |
| 24 base::SupportsUserData* supports_user_data); | |
| 25 static void SetUserData(base::SupportsUserData* supports_user_data, | |
| 26 NetworkQualityProviderStub* stub); | |
| 27 | |
| 28 net::EffectiveConnectionType GetEffectiveConnectionType() const override; | |
| 29 | |
| 30 void AddEffectiveConnectionTypeObserver( | |
| 31 net::NetworkQualityEstimator::EffectiveConnectionTypeObserver* observer) | |
| 32 override; | |
| 33 | |
| 34 void RemoveEffectiveConnectionTypeObserver( | |
| 35 net::NetworkQualityEstimator::EffectiveConnectionTypeObserver* observer) | |
| 36 override; | |
| 37 | |
| 38 void SetEffectiveConnectionTypeForTest(net::EffectiveConnectionType type) { | |
| 39 connection_type_ = type; | |
| 40 } | |
| 41 | |
| 42 private: | |
| 43 net::EffectiveConnectionType connection_type_; | |
| 44 }; | |
| 45 | |
| 46 } // namespace offline_pages | |
| 47 | |
| 48 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_NETWORK_QUALITY_PROVIDER_STUB_H_ | |
| OLD | NEW |