Commit 35fdb442 authored by Abhishek Bhardwaj's avatar Abhishek Bhardwaj Committed by Commit Bot

Clang format network related files

This change clang formats a subset of network related source files.

BUG=891143
TEST=Compile.

Change-Id: I131d132dbcd36200310a8c785eab067795e20576
Reviewed-on: https://chromium-review.googlesource.com/c/1252334
Commit-Queue: Abhishek Bhardwaj <abhishekbh@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595904}
parent 88a928b2
...@@ -39,8 +39,8 @@ const char kFailedMessage[] = "Failed"; ...@@ -39,8 +39,8 @@ const char kFailedMessage[] = "Failed";
void ErrorFunction(const std::string& device_path, void ErrorFunction(const std::string& device_path,
const std::string& error_name, const std::string& error_name,
const std::string& error_message) { const std::string& error_message) {
LOG(ERROR) << "Shill Error for: " << device_path LOG(ERROR) << "Shill Error for: " << device_path << ": " << error_name
<< ": " << error_name << " : " << error_message; << " : " << error_message;
} }
void PostError(const std::string& error, void PostError(const std::string& error,
...@@ -391,8 +391,10 @@ ShillDeviceClient::TestInterface* FakeShillDeviceClient::GetTestInterface() { ...@@ -391,8 +391,10 @@ ShillDeviceClient::TestInterface* FakeShillDeviceClient::GetTestInterface() {
void FakeShillDeviceClient::AddDevice(const std::string& device_path, void FakeShillDeviceClient::AddDevice(const std::string& device_path,
const std::string& type, const std::string& type,
const std::string& name) { const std::string& name) {
DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> DBusThreadManager::Get()
AddDevice(device_path); ->GetShillManagerClient()
->GetTestInterface()
->AddDevice(device_path);
base::Value* properties = GetDeviceProperties(device_path); base::Value* properties = GetDeviceProperties(device_path);
properties->SetKey(shill::kTypeProperty, base::Value(type)); properties->SetKey(shill::kTypeProperty, base::Value(type));
...@@ -407,15 +409,19 @@ void FakeShillDeviceClient::AddDevice(const std::string& device_path, ...@@ -407,15 +409,19 @@ void FakeShillDeviceClient::AddDevice(const std::string& device_path,
} }
void FakeShillDeviceClient::RemoveDevice(const std::string& device_path) { void FakeShillDeviceClient::RemoveDevice(const std::string& device_path) {
DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> DBusThreadManager::Get()
RemoveDevice(device_path); ->GetShillManagerClient()
->GetTestInterface()
->RemoveDevice(device_path);
stub_devices_.RemoveWithoutPathExpansion(device_path, NULL); stub_devices_.RemoveWithoutPathExpansion(device_path, NULL);
} }
void FakeShillDeviceClient::ClearDevices() { void FakeShillDeviceClient::ClearDevices() {
DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> DBusThreadManager::Get()
ClearDevices(); ->GetShillManagerClient()
->GetTestInterface()
->ClearDevices();
stub_devices_.Clear(); stub_devices_.Clear();
} }
...@@ -424,8 +430,8 @@ void FakeShillDeviceClient::SetDeviceProperty(const std::string& device_path, ...@@ -424,8 +430,8 @@ void FakeShillDeviceClient::SetDeviceProperty(const std::string& device_path,
const std::string& name, const std::string& name,
const base::Value& value, const base::Value& value,
bool notify_changed) { bool notify_changed) {
VLOG(1) << "SetDeviceProperty: " << device_path VLOG(1) << "SetDeviceProperty: " << device_path << ": " << name << " = "
<< ": " << name << " = " << value; << value;
SetPropertyInternal(dbus::ObjectPath(device_path), name, value, SetPropertyInternal(dbus::ObjectPath(device_path), name, value,
base::DoNothing(), base::DoNothing(),
base::Bind(&ErrorFunction, device_path), notify_changed); base::Bind(&ErrorFunction, device_path), notify_changed);
...@@ -433,14 +439,14 @@ void FakeShillDeviceClient::SetDeviceProperty(const std::string& device_path, ...@@ -433,14 +439,14 @@ void FakeShillDeviceClient::SetDeviceProperty(const std::string& device_path,
std::string FakeShillDeviceClient::GetDevicePathForType( std::string FakeShillDeviceClient::GetDevicePathForType(
const std::string& type) { const std::string& type) {
for (base::DictionaryValue::Iterator iter(stub_devices_); for (base::DictionaryValue::Iterator iter(stub_devices_); !iter.IsAtEnd();
!iter.IsAtEnd(); iter.Advance()) { iter.Advance()) {
const base::DictionaryValue* properties = NULL; const base::DictionaryValue* properties = NULL;
if (!iter.value().GetAsDictionary(&properties)) if (!iter.value().GetAsDictionary(&properties))
continue; continue;
std::string prop_type; std::string prop_type;
if (!properties->GetStringWithoutPathExpansion( if (!properties->GetStringWithoutPathExpansion(shill::kTypeProperty,
shill::kTypeProperty, &prop_type) || &prop_type) ||
prop_type != type) prop_type != type)
continue; continue;
return iter.key(); return iter.key();
...@@ -611,8 +617,8 @@ void FakeShillDeviceClient::PassStubDeviceProperties( ...@@ -611,8 +617,8 @@ void FakeShillDeviceClient::PassStubDeviceProperties(
const dbus::ObjectPath& device_path, const dbus::ObjectPath& device_path,
const DictionaryValueCallback& callback) const { const DictionaryValueCallback& callback) const {
const base::DictionaryValue* device_properties = NULL; const base::DictionaryValue* device_properties = NULL;
if (!stub_devices_.GetDictionaryWithoutPathExpansion( if (!stub_devices_.GetDictionaryWithoutPathExpansion(device_path.value(),
device_path.value(), &device_properties)) { &device_properties)) {
base::DictionaryValue empty_dictionary; base::DictionaryValue empty_dictionary;
callback.Run(DBUS_METHOD_CALL_FAILURE, empty_dictionary); callback.Run(DBUS_METHOD_CALL_FAILURE, empty_dictionary);
return; return;
...@@ -638,8 +644,7 @@ void FakeShillDeviceClient::NotifyObserversPropertyChanged( ...@@ -638,8 +644,7 @@ void FakeShillDeviceClient::NotifyObserversPropertyChanged(
} }
base::Value* value = NULL; base::Value* value = NULL;
if (!dict->GetWithoutPathExpansion(property, &value)) { if (!dict->GetWithoutPathExpansion(property, &value)) {
LOG(ERROR) << "Notify for unknown property: " LOG(ERROR) << "Notify for unknown property: " << path << " : " << property;
<< path << " : " << property;
return; return;
} }
for (auto& observer : GetObserverList(device_path)) for (auto& observer : GetObserverList(device_path))
......
...@@ -78,11 +78,10 @@ class CHROMEOS_EXPORT FakeShillDeviceClient ...@@ -78,11 +78,10 @@ class CHROMEOS_EXPORT FakeShillDeviceClient
const std::string& peer, const std::string& peer,
const StringCallback& callback, const StringCallback& callback,
const ErrorCallback& error_callback) override; const ErrorCallback& error_callback) override;
void AddWakeOnPacketConnection( void AddWakeOnPacketConnection(const dbus::ObjectPath& device_path,
const dbus::ObjectPath& device_path, const net::IPEndPoint& ip_endpoint,
const net::IPEndPoint& ip_endpoint, const base::Closure& callback,
const base::Closure& callback, const ErrorCallback& error_callback) override;
const ErrorCallback& error_callback) override;
void RemoveWakeOnPacketConnection( void RemoveWakeOnPacketConnection(
const dbus::ObjectPath& device_path, const dbus::ObjectPath& device_path,
const net::IPEndPoint& ip_endpoint, const net::IPEndPoint& ip_endpoint,
...@@ -165,7 +164,7 @@ class CHROMEOS_EXPORT FakeShillDeviceClient ...@@ -165,7 +164,7 @@ class CHROMEOS_EXPORT FakeShillDeviceClient
std::string tdls_state_; std::string tdls_state_;
// Wake on packet connections for each device. // Wake on packet connections for each device.
std::map<dbus::ObjectPath, std::set<net::IPEndPoint> > std::map<dbus::ObjectPath, std::set<net::IPEndPoint>>
wake_on_packet_connections_; wake_on_packet_connections_;
// Current SIM PIN per device path. // Current SIM PIN per device path.
......
...@@ -27,13 +27,11 @@ namespace { ...@@ -27,13 +27,11 @@ namespace {
// The ShillDeviceClient implementation. // The ShillDeviceClient implementation.
class ShillDeviceClientImpl : public ShillDeviceClient { class ShillDeviceClientImpl : public ShillDeviceClient {
public: public:
ShillDeviceClientImpl() ShillDeviceClientImpl() : bus_(NULL) {}
: bus_(NULL) {
}
~ShillDeviceClientImpl() override { ~ShillDeviceClientImpl() override {
for (HelperMap::iterator iter = helpers_.begin(); for (HelperMap::iterator iter = helpers_.begin(); iter != helpers_.end();
iter != helpers_.end(); ++iter) { ++iter) {
// This *should* never happen, yet we're getting crash reports that // This *should* never happen, yet we're getting crash reports that
// seem to imply that it does happen sometimes. Adding CHECKs here // seem to imply that it does happen sometimes. Adding CHECKs here
// so we can determine more accurately where the problem lies. // so we can determine more accurately where the problem lies.
...@@ -75,9 +73,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -75,9 +73,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(name); writer.AppendString(name);
ShillClientHelper::AppendValueDataAsVariant(&writer, value); ShillClientHelper::AppendValueDataAsVariant(&writer, value);
GetHelper(device_path)->CallVoidMethodWithErrorCallback(&method_call, GetHelper(device_path)
callback, ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback); error_callback);
} }
void ClearProperty(const dbus::ObjectPath& device_path, void ClearProperty(const dbus::ObjectPath& device_path,
...@@ -100,8 +98,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -100,8 +98,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(pin); writer.AppendString(pin);
writer.AppendBool(require); writer.AppendBool(require);
GetHelper(device_path)->CallVoidMethodWithErrorCallback( GetHelper(device_path)
&method_call, callback, error_callback); ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
} }
void EnterPin(const dbus::ObjectPath& device_path, void EnterPin(const dbus::ObjectPath& device_path,
...@@ -112,8 +111,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -112,8 +111,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
shill::kEnterPinFunction); shill::kEnterPinFunction);
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(pin); writer.AppendString(pin);
GetHelper(device_path)->CallVoidMethodWithErrorCallback( GetHelper(device_path)
&method_call, callback, error_callback); ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
} }
void UnblockPin(const dbus::ObjectPath& device_path, void UnblockPin(const dbus::ObjectPath& device_path,
...@@ -126,8 +126,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -126,8 +126,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(puk); writer.AppendString(puk);
writer.AppendString(pin); writer.AppendString(pin);
GetHelper(device_path)->CallVoidMethodWithErrorCallback( GetHelper(device_path)
&method_call, callback, error_callback); ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
} }
void ChangePin(const dbus::ObjectPath& device_path, void ChangePin(const dbus::ObjectPath& device_path,
...@@ -140,8 +141,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -140,8 +141,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(old_pin); writer.AppendString(old_pin);
writer.AppendString(new_pin); writer.AppendString(new_pin);
GetHelper(device_path)->CallVoidMethodWithErrorCallback( GetHelper(device_path)
&method_call, callback, error_callback); ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
} }
void Register(const dbus::ObjectPath& device_path, void Register(const dbus::ObjectPath& device_path,
...@@ -152,8 +154,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -152,8 +154,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
shill::kRegisterFunction); shill::kRegisterFunction);
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(network_id); writer.AppendString(network_id);
GetHelper(device_path)->CallVoidMethodWithErrorCallback( GetHelper(device_path)
&method_call, callback, error_callback); ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
} }
void SetCarrier(const dbus::ObjectPath& device_path, void SetCarrier(const dbus::ObjectPath& device_path,
...@@ -164,8 +167,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -164,8 +167,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
shill::kSetCarrierFunction); shill::kSetCarrierFunction);
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(carrier); writer.AppendString(carrier);
GetHelper(device_path)->CallVoidMethodWithErrorCallback( GetHelper(device_path)
&method_call, callback, error_callback); ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
} }
void Reset(const dbus::ObjectPath& device_path, void Reset(const dbus::ObjectPath& device_path,
...@@ -173,8 +177,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -173,8 +177,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
const ErrorCallback& error_callback) override { const ErrorCallback& error_callback) override {
dbus::MethodCall method_call(shill::kFlimflamDeviceInterface, dbus::MethodCall method_call(shill::kFlimflamDeviceInterface,
shill::kResetFunction); shill::kResetFunction);
GetHelper(device_path)->CallVoidMethodWithErrorCallback( GetHelper(device_path)
&method_call, callback, error_callback); ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback);
} }
void PerformTDLSOperation(const dbus::ObjectPath& device_path, void PerformTDLSOperation(const dbus::ObjectPath& device_path,
...@@ -187,15 +192,15 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -187,15 +192,15 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(operation); writer.AppendString(operation);
writer.AppendString(peer); writer.AppendString(peer);
GetHelper(device_path)->CallStringMethodWithErrorCallback( GetHelper(device_path)
&method_call, callback, error_callback); ->CallStringMethodWithErrorCallback(&method_call, callback,
error_callback);
} }
void AddWakeOnPacketConnection( void AddWakeOnPacketConnection(const dbus::ObjectPath& device_path,
const dbus::ObjectPath& device_path, const net::IPEndPoint& ip_endpoint,
const net::IPEndPoint& ip_endpoint, const base::Closure& callback,
const base::Closure& callback, const ErrorCallback& error_callback) override {
const ErrorCallback& error_callback) override {
if (ip_endpoint.address().empty()) { if (ip_endpoint.address().empty()) {
LOG(ERROR) << "AddWakeOnPacketConnection: null address"; LOG(ERROR) << "AddWakeOnPacketConnection: null address";
return; return;
...@@ -204,9 +209,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -204,9 +209,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
shill::kAddWakeOnPacketConnectionFunction); shill::kAddWakeOnPacketConnectionFunction);
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(ip_endpoint.ToStringWithoutPort()); writer.AppendString(ip_endpoint.ToStringWithoutPort());
GetHelper(device_path)->CallVoidMethodWithErrorCallback(&method_call, GetHelper(device_path)
callback, ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback); error_callback);
} }
void RemoveWakeOnPacketConnection( void RemoveWakeOnPacketConnection(
...@@ -222,9 +227,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -222,9 +227,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
shill::kRemoveWakeOnPacketConnectionFunction); shill::kRemoveWakeOnPacketConnectionFunction);
dbus::MessageWriter writer(&method_call); dbus::MessageWriter writer(&method_call);
writer.AppendString(ip_endpoint.ToStringWithoutPort()); writer.AppendString(ip_endpoint.ToStringWithoutPort());
GetHelper(device_path)->CallVoidMethodWithErrorCallback(&method_call, GetHelper(device_path)
callback, ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback); error_callback);
} }
void RemoveAllWakeOnPacketConnections( void RemoveAllWakeOnPacketConnections(
...@@ -234,9 +239,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient { ...@@ -234,9 +239,9 @@ class ShillDeviceClientImpl : public ShillDeviceClient {
dbus::MethodCall method_call( dbus::MethodCall method_call(
shill::kFlimflamDeviceInterface, shill::kFlimflamDeviceInterface,
shill::kRemoveAllWakeOnPacketConnectionsFunction); shill::kRemoveAllWakeOnPacketConnectionsFunction);
GetHelper(device_path)->CallVoidMethodWithErrorCallback(&method_call, GetHelper(device_path)
callback, ->CallVoidMethodWithErrorCallback(&method_call, callback,
error_callback); error_callback);
} }
TestInterface* GetTestInterface() override { return NULL; } TestInterface* GetTestInterface() override { return NULL; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment