| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_STUB_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_STUB_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_STUB_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_STUB_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/hash_tables.h" | 12 #include "base/hash_tables.h" |
| 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 14 #include "chrome/browser/chromeos/net/network_portal_detector.h" | 15 #include "chrome/browser/chromeos/net/network_portal_detector.h" |
| 15 | 16 |
| 16 namespace chromeos { | 17 namespace chromeos { |
| 17 | 18 |
| 18 class NetworkPortalDetectorStub : public NetworkPortalDetector { | 19 class NetworkPortalDetectorStub : public NetworkPortalDetector { |
| 19 public: | 20 public: |
| 20 NetworkPortalDetectorStub(); | 21 NetworkPortalDetectorStub(); |
| 21 virtual ~NetworkPortalDetectorStub(); | 22 virtual ~NetworkPortalDetectorStub(); |
| 22 | 23 |
| 23 // NetworkPortalDetector implementation: | 24 // NetworkPortalDetector implementation: |
| 24 virtual void Init() OVERRIDE; | 25 virtual void Init() OVERRIDE; |
| 25 virtual void Shutdown() OVERRIDE; | 26 virtual void Shutdown() OVERRIDE; |
| 26 virtual void AddObserver(Observer* observer) OVERRIDE; | 27 virtual void AddObserver(Observer* observer) OVERRIDE; |
| 27 virtual void AddAndFireObserver(Observer* observer) OVERRIDE; | 28 virtual void AddAndFireObserver(Observer* observer) OVERRIDE; |
| 28 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 29 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
| 29 virtual CaptivePortalState GetCaptivePortalState( | 30 virtual CaptivePortalState GetCaptivePortalState( |
| 30 const chromeos::Network* network) OVERRIDE; | 31 const chromeos::NetworkState* network) OVERRIDE; |
| 31 virtual bool IsEnabled() OVERRIDE; | 32 virtual bool IsEnabled() OVERRIDE; |
| 32 virtual void Enable(bool start_detection) OVERRIDE; | 33 virtual void Enable(bool start_detection) OVERRIDE; |
| 33 virtual bool StartDetectionIfIdle() OVERRIDE; | 34 virtual bool StartDetectionIfIdle() OVERRIDE; |
| 34 virtual void EnableLazyDetection() OVERRIDE; | 35 virtual void EnableLazyDetection() OVERRIDE; |
| 35 virtual void DisableLazyDetection() OVERRIDE; | 36 virtual void DisableLazyDetection() OVERRIDE; |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 friend class UpdateScreenTest; | 39 friend class UpdateScreenTest; |
| 39 | 40 |
| 40 typedef std::string NetworkId; | 41 typedef std::string NetworkId; |
| 41 typedef base::hash_map<NetworkId, CaptivePortalState> CaptivePortalStateMap; | 42 typedef base::hash_map<NetworkId, CaptivePortalState> CaptivePortalStateMap; |
| 42 | 43 |
| 43 void SetActiveNetworkForTesting(const Network* network); | 44 void SetDefaultNetworkPathForTesting(const std::string& service_path); |
| 44 void SetDetectionResultsForTesting(const Network* network, | 45 void SetDetectionResultsForTesting(const std::string& service_path, |
| 45 const CaptivePortalState& state); | 46 const CaptivePortalState& state); |
| 46 void NotifyObserversForTesting(); | 47 void NotifyObserversForTesting(); |
| 47 | 48 |
| 48 ObserverList<Observer> observers_; | 49 ObserverList<Observer> observers_; |
| 49 const Network* active_network_; | 50 scoped_ptr<NetworkState> default_network_; |
| 50 CaptivePortalStateMap portal_state_map_; | 51 CaptivePortalStateMap portal_state_map_; |
| 51 | 52 |
| 52 DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorStub); | 53 DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorStub); |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 } // namespace chromeos | 56 } // namespace chromeos |
| 56 | 57 |
| 57 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_STUB_H_ | 58 #endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_STUB_H_ |
| OLD | NEW |