| Index: chromeos/dbus/fake_shill_device_client.cc
|
| diff --git a/chromeos/dbus/fake_shill_device_client.cc b/chromeos/dbus/fake_shill_device_client.cc
|
| index 623487b49b7d4522d9c026250e581082888fe410..8a631ad03dabc79d067e9ac176ba8c087c4dd04d 100644
|
| --- a/chromeos/dbus/fake_shill_device_client.cc
|
| +++ b/chromeos/dbus/fake_shill_device_client.cc
|
| @@ -16,6 +16,7 @@
|
| #include "dbus/object_path.h"
|
| #include "dbus/object_proxy.h"
|
| #include "dbus/values_util.h"
|
| +#include "net/base/ip_endpoint.h"
|
| #include "third_party/cros_system_api/dbus/service_constants.h"
|
|
|
| namespace chromeos {
|
| @@ -31,7 +32,7 @@ void ErrorFunction(const std::string& device_path,
|
| << ": " << error_name << " : " << error_message;
|
| }
|
|
|
| -void PostDeviceNotFoundError(
|
| +void PostNotFoundError(
|
| const ShillDeviceClient::ErrorCallback& error_callback) {
|
| std::string error_message("Failed");
|
| base::MessageLoop::current()->PostTask(
|
| @@ -91,7 +92,7 @@ void FakeShillDeviceClient::SetProperty(const dbus::ObjectPath& device_path,
|
| base::DictionaryValue* device_properties = NULL;
|
| if (!stub_devices_.GetDictionaryWithoutPathExpansion(device_path.value(),
|
| &device_properties)) {
|
| - PostDeviceNotFoundError(error_callback);
|
| + PostNotFoundError(error_callback);
|
| return;
|
| }
|
| device_properties->SetWithoutPathExpansion(name, value.DeepCopy());
|
| @@ -141,7 +142,7 @@ void FakeShillDeviceClient::RequirePin(const dbus::ObjectPath& device_path,
|
| base::DictionaryValue* device_properties = NULL;
|
| if (!stub_devices_.GetDictionaryWithoutPathExpansion(device_path.value(),
|
| &device_properties)) {
|
| - PostDeviceNotFoundError(error_callback);
|
| + PostNotFoundError(error_callback);
|
| return;
|
| }
|
| base::DictionaryValue* simlock_dict = NULL;
|
| @@ -174,7 +175,7 @@ void FakeShillDeviceClient::EnterPin(const dbus::ObjectPath& device_path,
|
| return;
|
| }
|
| if (!stub_devices_.HasKey(device_path.value())) {
|
| - PostDeviceNotFoundError(error_callback);
|
| + PostNotFoundError(error_callback);
|
| return;
|
| }
|
| base::MessageLoop::current()->PostTask(FROM_HERE, callback);
|
| @@ -187,7 +188,7 @@ void FakeShillDeviceClient::UnblockPin(const dbus::ObjectPath& device_path,
|
| const ErrorCallback& error_callback) {
|
| VLOG(1) << "UnblockPin: " << device_path.value();
|
| if (!stub_devices_.HasKey(device_path.value())) {
|
| - PostDeviceNotFoundError(error_callback);
|
| + PostNotFoundError(error_callback);
|
| return;
|
| }
|
| base::MessageLoop::current()->PostTask(FROM_HERE, callback);
|
| @@ -200,7 +201,7 @@ void FakeShillDeviceClient::ChangePin(const dbus::ObjectPath& device_path,
|
| const ErrorCallback& error_callback) {
|
| VLOG(1) << "ChangePin: " << device_path.value();
|
| if (!stub_devices_.HasKey(device_path.value())) {
|
| - PostDeviceNotFoundError(error_callback);
|
| + PostNotFoundError(error_callback);
|
| return;
|
| }
|
| base::MessageLoop::current()->PostTask(FROM_HERE, callback);
|
| @@ -211,7 +212,7 @@ void FakeShillDeviceClient::Register(const dbus::ObjectPath& device_path,
|
| const base::Closure& callback,
|
| const ErrorCallback& error_callback) {
|
| if (!stub_devices_.HasKey(device_path.value())) {
|
| - PostDeviceNotFoundError(error_callback);
|
| + PostNotFoundError(error_callback);
|
| return;
|
| }
|
| base::MessageLoop::current()->PostTask(FROM_HERE, callback);
|
| @@ -222,7 +223,7 @@ void FakeShillDeviceClient::SetCarrier(const dbus::ObjectPath& device_path,
|
| const base::Closure& callback,
|
| const ErrorCallback& error_callback) {
|
| if (!stub_devices_.HasKey(device_path.value())) {
|
| - PostDeviceNotFoundError(error_callback);
|
| + PostNotFoundError(error_callback);
|
| return;
|
| }
|
| base::MessageLoop::current()->PostTask(FROM_HERE, callback);
|
| @@ -232,7 +233,7 @@ void FakeShillDeviceClient::Reset(const dbus::ObjectPath& device_path,
|
| const base::Closure& callback,
|
| const ErrorCallback& error_callback) {
|
| if (!stub_devices_.HasKey(device_path.value())) {
|
| - PostDeviceNotFoundError(error_callback);
|
| + PostNotFoundError(error_callback);
|
| return;
|
| }
|
| base::MessageLoop::current()->PostTask(FROM_HERE, callback);
|
| @@ -245,7 +246,7 @@ void FakeShillDeviceClient::PerformTDLSOperation(
|
| const StringCallback& callback,
|
| const ErrorCallback& error_callback) {
|
| if (!stub_devices_.HasKey(device_path.value())) {
|
| - PostDeviceNotFoundError(error_callback);
|
| + PostNotFoundError(error_callback);
|
| return;
|
| }
|
| if (tdls_busy_count_) {
|
| @@ -264,6 +265,60 @@ void FakeShillDeviceClient::PerformTDLSOperation(
|
| base::Bind(callback, result));
|
| }
|
|
|
| +void FakeShillDeviceClient::AddWakeOnPacketConnection(
|
| + const dbus::ObjectPath& device_path,
|
| + const net::IPEndPoint& ip_endpoint,
|
| + const base::Closure& callback,
|
| + const ErrorCallback& error_callback) {
|
| + if (!stub_devices_.HasKey(device_path.value())) {
|
| + PostNotFoundError(error_callback);
|
| + return;
|
| + }
|
| +
|
| + wake_on_packet_connections_[device_path].insert(ip_endpoint);
|
| +
|
| + base::MessageLoop::current()->PostTask(FROM_HERE, callback);
|
| +}
|
| +
|
| +void FakeShillDeviceClient::RemoveWakeOnPacketConnection(
|
| + const dbus::ObjectPath& device_path,
|
| + const net::IPEndPoint& ip_endpoint,
|
| + const base::Closure& callback,
|
| + const ErrorCallback& error_callback) {
|
| + const auto device_iter = wake_on_packet_connections_.find(device_path);
|
| + if (!stub_devices_.HasKey(device_path.value()) ||
|
| + device_iter == wake_on_packet_connections_.end()) {
|
| + PostNotFoundError(error_callback);
|
| + return;
|
| + }
|
| +
|
| + const auto endpoint_iter = device_iter->second.find(ip_endpoint);
|
| + if (endpoint_iter == device_iter->second.end()) {
|
| + PostNotFoundError(error_callback);
|
| + return;
|
| + }
|
| +
|
| + device_iter->second.erase(endpoint_iter);
|
| +
|
| + base::MessageLoop::current()->PostTask(FROM_HERE, callback);
|
| +}
|
| +
|
| +void FakeShillDeviceClient::RemoveAllWakeOnPacketConnections(
|
| + const dbus::ObjectPath& device_path,
|
| + const base::Closure& callback,
|
| + const ErrorCallback& error_callback) {
|
| + const auto iter = wake_on_packet_connections_.find(device_path);
|
| + if (!stub_devices_.HasKey(device_path.value()) ||
|
| + iter == wake_on_packet_connections_.end()) {
|
| + PostNotFoundError(error_callback);
|
| + return;
|
| + }
|
| +
|
| + wake_on_packet_connections_.erase(iter);
|
| +
|
| + base::MessageLoop::current()->PostTask(FROM_HERE, callback);
|
| +}
|
| +
|
| ShillDeviceClient::TestInterface* FakeShillDeviceClient::GetTestInterface() {
|
| return this;
|
| }
|
|
|