| 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 #include "chromeos/dbus/fake_shill_manager_client.h" | 5 #include "chromeos/dbus/fake_shill_manager_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 const ErrorCallback& error_callback) { | 178 const ErrorCallback& error_callback) { |
| 179 VLOG(2) << "SetProperty: " << name; | 179 VLOG(2) << "SetProperty: " << name; |
| 180 stub_properties_.SetWithoutPathExpansion(name, value.DeepCopy()); | 180 stub_properties_.SetWithoutPathExpansion(name, value.DeepCopy()); |
| 181 CallNotifyObserversPropertyChanged(name); | 181 CallNotifyObserversPropertyChanged(name); |
| 182 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); | 182 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void FakeShillManagerClient::RequestScan(const std::string& type, | 185 void FakeShillManagerClient::RequestScan(const std::string& type, |
| 186 const base::Closure& callback, | 186 const base::Closure& callback, |
| 187 const ErrorCallback& error_callback) { | 187 const ErrorCallback& error_callback) { |
| 188 VLOG(1) << "RequestScan: " << type; |
| 188 // For Stub purposes, default to a Wifi scan. | 189 // For Stub purposes, default to a Wifi scan. |
| 189 std::string device_type = shill::kTypeWifi; | 190 std::string device_type = shill::kTypeWifi; |
| 190 if (!type.empty()) | 191 if (!type.empty()) |
| 191 device_type = type; | 192 device_type = type; |
| 192 ShillDeviceClient::TestInterface* device_client = | 193 ShillDeviceClient::TestInterface* device_client = |
| 193 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface(); | 194 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface(); |
| 194 std::string device_path = device_client->GetDevicePathForType(device_type); | 195 std::string device_path = device_client->GetDevicePathForType(device_type); |
| 195 if (!device_path.empty()) { | 196 if (!device_path.empty()) { |
| 196 device_client->SetDeviceProperty( | 197 device_client->SetDeviceProperty( |
| 197 device_path, shill::kScanningProperty, base::FundamentalValue(true)); | 198 device_path, shill::kScanningProperty, base::FundamentalValue(true)); |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 } | 1025 } |
| 1025 | 1026 |
| 1026 void FakeShillManagerClient::ScanCompleted(const std::string& device_path, | 1027 void FakeShillManagerClient::ScanCompleted(const std::string& device_path, |
| 1027 const base::Closure& callback) { | 1028 const base::Closure& callback) { |
| 1028 if (!device_path.empty()) { | 1029 if (!device_path.empty()) { |
| 1029 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()-> | 1030 DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()-> |
| 1030 SetDeviceProperty(device_path, | 1031 SetDeviceProperty(device_path, |
| 1031 shill::kScanningProperty, | 1032 shill::kScanningProperty, |
| 1032 base::FundamentalValue(false)); | 1033 base::FundamentalValue(false)); |
| 1033 } | 1034 } |
| 1034 VLOG(2) << "ScanCompleted"; | 1035 VLOG(1) << "ScanCompleted"; |
| 1035 CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty); | 1036 CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty); |
| 1036 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); | 1037 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); |
| 1037 } | 1038 } |
| 1038 | 1039 |
| 1039 void FakeShillManagerClient::ParseCommandLineSwitch() { | 1040 void FakeShillManagerClient::ParseCommandLineSwitch() { |
| 1040 // Default setup | 1041 // Default setup |
| 1041 SetInitialNetworkState(shill::kTypeEthernet, shill::kStateOnline); | 1042 SetInitialNetworkState(shill::kTypeEthernet, shill::kStateOnline); |
| 1042 SetInitialNetworkState(shill::kTypeWifi, shill::kStateOnline); | 1043 SetInitialNetworkState(shill::kTypeWifi, shill::kStateOnline); |
| 1043 SetInitialNetworkState(shill::kTypeCellular, shill::kStateIdle); | 1044 SetInitialNetworkState(shill::kTypeCellular, shill::kStateIdle); |
| 1044 SetInitialNetworkState(shill::kTypeVPN, shill::kStateIdle); | 1045 SetInitialNetworkState(shill::kTypeVPN, shill::kStateIdle); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 *enabled = true; | 1190 *enabled = true; |
| 1190 if ((state == shill::kStatePortal && type != shill::kTypeWifi) || | 1191 if ((state == shill::kStatePortal && type != shill::kTypeWifi) || |
| 1191 (state == kNetworkActivated && type != shill::kTypeCellular)) { | 1192 (state == kNetworkActivated && type != shill::kTypeCellular)) { |
| 1192 LOG(WARNING) << "Invalid state: " << state << " for " << type; | 1193 LOG(WARNING) << "Invalid state: " << state << " for " << type; |
| 1193 return shill::kStateIdle; | 1194 return shill::kStateIdle; |
| 1194 } | 1195 } |
| 1195 return state; | 1196 return state; |
| 1196 } | 1197 } |
| 1197 | 1198 |
| 1198 } // namespace chromeos | 1199 } // namespace chromeos |
| OLD | NEW |