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

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

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 #include "chromeos/components/tether/fake_wifi_hotspot_connector.h" 5 #include "chromeos/components/tether/fake_wifi_hotspot_connector.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "chromeos/network/network_state_handler.h" 8 #include "chromeos/network/network_state_handler.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace chromeos { 11 namespace chromeos {
12 12
13 namespace tether { 13 namespace tether {
14 14
15 // static
16 std::unique_ptr<FakeWifiHotspotConnector> FakeWifiHotspotConnector::Create() {
17 return base::WrapUnique(
18 new FakeWifiHotspotConnector(NetworkStateHandler::InitializeForTest()));
19 }
20
21 FakeWifiHotspotConnector::FakeWifiHotspotConnector( 15 FakeWifiHotspotConnector::FakeWifiHotspotConnector(
22 std::unique_ptr<NetworkStateHandler> network_state_handler) 16 NetworkStateHandler* network_state_handler)
23 : WifiHotspotConnector(network_state_handler.get(), nullptr), 17 : WifiHotspotConnector(network_state_handler, nullptr) {}
24 network_state_handler_(std::move(network_state_handler)) {}
25 18
26 FakeWifiHotspotConnector::~FakeWifiHotspotConnector() {} 19 FakeWifiHotspotConnector::~FakeWifiHotspotConnector() {}
27 20
28 void FakeWifiHotspotConnector::CallMostRecentCallback( 21 void FakeWifiHotspotConnector::CallMostRecentCallback(
29 const std::string& wifi_guid) { 22 const std::string& wifi_guid) {
30 EXPECT_FALSE(most_recent_callback_.is_null()); 23 EXPECT_FALSE(most_recent_callback_.is_null());
31 most_recent_callback_.Run(wifi_guid); 24 most_recent_callback_.Run(wifi_guid);
32 } 25 }
33 26
34 void FakeWifiHotspotConnector::ConnectToWifiHotspot( 27 void FakeWifiHotspotConnector::ConnectToWifiHotspot(
35 const std::string& ssid, 28 const std::string& ssid,
36 const std::string& password, 29 const std::string& password,
37 const WifiHotspotConnector::WifiConnectionCallback& callback) { 30 const WifiHotspotConnector::WifiConnectionCallback& callback) {
38 most_recent_ssid_ = ssid; 31 most_recent_ssid_ = ssid;
39 most_recent_password_ = password; 32 most_recent_password_ = password;
40 most_recent_callback_ = callback; 33 most_recent_callback_ = callback;
41 } 34 }
42 35
43 } // namespace tether 36 } // namespace tether
44 37
45 } // namespace chromeos 38 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698