| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_TEST_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_TEST_IMPL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_TEST_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_TEST_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "chromeos/network/portal_detector/network_portal_detector.h" | 15 #include "chromeos/network/portal_detector/network_portal_detector.h" |
| 16 | 16 |
| 17 namespace chromeos { | 17 namespace chromeos { |
| 18 | 18 |
| 19 class NetworkPortalDetectorTestImpl : public NetworkPortalDetector { | 19 class NetworkPortalDetectorTestImpl : public NetworkPortalDetector { |
| 20 public: | 20 public: |
| 21 NetworkPortalDetectorTestImpl(); | 21 NetworkPortalDetectorTestImpl(); |
| 22 virtual ~NetworkPortalDetectorTestImpl(); | 22 virtual ~NetworkPortalDetectorTestImpl(); |
| 23 | 23 |
| 24 void SetDefaultNetworkForTesting(const std::string& guid); | 24 void SetDefaultNetworkForTesting(const std::string& guid); |
| 25 void SetDetectionResultsForTesting(const std::string& guid, | 25 void SetDetectionResultsForTesting(const std::string& guid, |
| 26 const CaptivePortalState& state); | 26 const CaptivePortalState& state); |
| 27 void NotifyObserversForTesting(); | 27 void NotifyObserversForTesting(); |
| 28 | 28 |
| 29 // NetworkPortalDetector implementation: | 29 // NetworkPortalDetector implementation: |
| 30 virtual void AddObserver(Observer* observer) OVERRIDE; | 30 virtual void AddObserver(Observer* observer) override; |
| 31 virtual void AddAndFireObserver(Observer* observer) OVERRIDE; | 31 virtual void AddAndFireObserver(Observer* observer) override; |
| 32 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 32 virtual void RemoveObserver(Observer* observer) override; |
| 33 virtual CaptivePortalState GetCaptivePortalState( | 33 virtual CaptivePortalState GetCaptivePortalState( |
| 34 const std::string& service_path) OVERRIDE; | 34 const std::string& service_path) override; |
| 35 virtual bool IsEnabled() OVERRIDE; | 35 virtual bool IsEnabled() override; |
| 36 virtual void Enable(bool start_detection) OVERRIDE; | 36 virtual void Enable(bool start_detection) override; |
| 37 virtual bool StartDetectionIfIdle() OVERRIDE; | 37 virtual bool StartDetectionIfIdle() override; |
| 38 | 38 |
| 39 virtual void SetStrategy(PortalDetectorStrategy::StrategyId id) OVERRIDE; | 39 virtual void SetStrategy(PortalDetectorStrategy::StrategyId id) override; |
| 40 | 40 |
| 41 PortalDetectorStrategy::StrategyId strategy_id() const { | 41 PortalDetectorStrategy::StrategyId strategy_id() const { |
| 42 return strategy_id_; | 42 return strategy_id_; |
| 43 } | 43 } |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 typedef std::string NetworkId; | 46 typedef std::string NetworkId; |
| 47 typedef base::hash_map<NetworkId, CaptivePortalState> CaptivePortalStateMap; | 47 typedef base::hash_map<NetworkId, CaptivePortalState> CaptivePortalStateMap; |
| 48 | 48 |
| 49 ObserverList<Observer> observers_; | 49 ObserverList<Observer> observers_; |
| 50 scoped_ptr<NetworkState> default_network_; | 50 scoped_ptr<NetworkState> default_network_; |
| 51 CaptivePortalStateMap portal_state_map_; | 51 CaptivePortalStateMap portal_state_map_; |
| 52 PortalDetectorStrategy::StrategyId strategy_id_; | 52 PortalDetectorStrategy::StrategyId strategy_id_; |
| 53 | 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorTestImpl); | 54 DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorTestImpl); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace chromeos | 57 } // namespace chromeos |
| 58 | 58 |
| 59 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_TEST_IMPL_H_ | 59 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_TEST_IMPL_H_ |
| OLD | NEW |