Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: chromeos/components/tether/fake_wifi_hotspot_connector.h

Issue 2792483002: [CrOS Tether] Create TetherConnector, which attempts to connect to a nearby tether host. (Closed)
Patch Set: hansberry@ comment. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 CHROMEOS_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_CONNECTOR_H_ 5 #ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_CONNECTOR_H_
6 #define CHROMEOS_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_CONNECTOR_H_ 6 #define CHROMEOS_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_CONNECTOR_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "chromeos/components/tether/wifi_hotspot_connector.h" 11 #include "chromeos/components/tether/wifi_hotspot_connector.h"
12 12
13 namespace chromeos { 13 namespace chromeos {
14 14
15 namespace tether { 15 namespace tether {
16 16
17 // Test double for WifiHotspotConnector. 17 // Test double for WifiHotspotConnector.
18 class FakeWifiHotspotConnector : public WifiHotspotConnector { 18 class FakeWifiHotspotConnector : public WifiHotspotConnector {
19 public: 19 public:
20 static std::unique_ptr<FakeWifiHotspotConnector> Create(); 20 FakeWifiHotspotConnector(NetworkStateHandler* network_state_handler);
21 ~FakeWifiHotspotConnector() override; 21 ~FakeWifiHotspotConnector() override;
22 22
23 // Pass an empty string for |wifi_guid| to signify a failed connection. 23 // Pass an empty string for |wifi_guid| to signify a failed connection.
24 void CallMostRecentCallback(const std::string& wifi_guid); 24 void CallMostRecentCallback(const std::string& wifi_guid);
25 25
26 std::string most_recent_ssid() { return most_recent_ssid_; } 26 std::string most_recent_ssid() { return most_recent_ssid_; }
27 27
28 std::string most_recent_password() { return most_recent_password_; } 28 std::string most_recent_password() { return most_recent_password_; }
29 29
30 // WifiHotspotConnector: 30 // WifiHotspotConnector:
31 void ConnectToWifiHotspot( 31 void ConnectToWifiHotspot(
32 const std::string& ssid, 32 const std::string& ssid,
33 const std::string& password, 33 const std::string& password,
34 const WifiHotspotConnector::WifiConnectionCallback& callback) override; 34 const WifiHotspotConnector::WifiConnectionCallback& callback) override;
35 35
36 private: 36 private:
37 FakeWifiHotspotConnector(
38 std::unique_ptr<NetworkStateHandler> network_state_handler);
39
40 std::string most_recent_ssid_; 37 std::string most_recent_ssid_;
41 std::string most_recent_password_; 38 std::string most_recent_password_;
42 WifiHotspotConnector::WifiConnectionCallback most_recent_callback_; 39 WifiHotspotConnector::WifiConnectionCallback most_recent_callback_;
43 40
44 // Not actually used. Only stored to keep the pointer valid for the lifetime
45 // of the object so that AddObserver() and RemoteObserver() can be called in
46 // the base class constructor/destructor.
47 std::unique_ptr<NetworkStateHandler> network_state_handler_;
48
49 DISALLOW_COPY_AND_ASSIGN(FakeWifiHotspotConnector); 41 DISALLOW_COPY_AND_ASSIGN(FakeWifiHotspotConnector);
50 }; 42 };
51 43
52 } // namespace tether 44 } // namespace tether
53 45
54 } // namespace chromeos 46 } // namespace chromeos
55 47
56 #endif // CHROMEOS_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_CONNECTOR_H_ 48 #endif // CHROMEOS_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_CONNECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698