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

Side by Side Diff: chromeos/dbus/shill_ipconfig_client_stub.cc

Issue 31513002: dbus: Remove MockShillDeviceClient and MockShillIPConfigClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix the build Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/dbus/shill_ipconfig_client_stub.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chromeos/dbus/shill_ipconfig_client_stub.h"
6
7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h"
9 #include "base/stl_util.h"
10 #include "base/values.h"
11 #include "chromeos/dbus/shill_property_changed_observer.h"
12 #include "dbus/bus.h"
13 #include "dbus/message.h"
14 #include "dbus/object_path.h"
15 #include "dbus/object_proxy.h"
16 #include "dbus/values_util.h"
17 #include "third_party/cros_system_api/dbus/service_constants.h"
18
19 namespace chromeos {
20
21 ShillIPConfigClientStub::ShillIPConfigClientStub() : weak_ptr_factory_(this) {
22 }
23
24 ShillIPConfigClientStub::~ShillIPConfigClientStub() {
25 }
26
27 void ShillIPConfigClientStub::Init(dbus::Bus* bus) {
28 }
29
30 void ShillIPConfigClientStub::AddPropertyChangedObserver(
31 const dbus::ObjectPath& ipconfig_path,
32 ShillPropertyChangedObserver* observer) {
33 }
34
35 void ShillIPConfigClientStub::RemovePropertyChangedObserver(
36 const dbus::ObjectPath& ipconfig_path,
37 ShillPropertyChangedObserver* observer) {
38 }
39
40 void ShillIPConfigClientStub::Refresh(const dbus::ObjectPath& ipconfig_path,
41 const VoidDBusMethodCallback& callback) {
42 }
43
44 void ShillIPConfigClientStub::GetProperties(
45 const dbus::ObjectPath& ipconfig_path,
46 const DictionaryValueCallback& callback) {
47 const base::DictionaryValue* dict = NULL;
48 if (!ipconfigs_.GetDictionaryWithoutPathExpansion(ipconfig_path.value(),
49 &dict))
50 return;
51 base::MessageLoop::current()->PostTask(
52 FROM_HERE, base::Bind(&ShillIPConfigClientStub::PassProperties,
53 weak_ptr_factory_.GetWeakPtr(),
54 dict,
55 callback));
56 }
57
58 void ShillIPConfigClientStub::SetProperty(
59 const dbus::ObjectPath& ipconfig_path,
60 const std::string& name,
61 const base::Value& value,
62 const VoidDBusMethodCallback& callback) {
63 base::DictionaryValue* dict = NULL;
64 if (ipconfigs_.GetDictionaryWithoutPathExpansion(ipconfig_path.value(),
65 &dict)) {
66 // Update existing ip config stub object's properties.
67 dict->SetWithoutPathExpansion(name, value.DeepCopy());
68 } else {
69 // Create a new stub ipconfig object, and update its properties.
70 base::DictionaryValue* dvalue = new base::DictionaryValue;
71 dvalue->SetWithoutPathExpansion(name, value.DeepCopy());
72 ipconfigs_.SetWithoutPathExpansion(ipconfig_path.value(),
73 dvalue);
74 }
75 base::MessageLoop::current()->PostTask(
76 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS));
77 }
78
79 void ShillIPConfigClientStub::ClearProperty(
80 const dbus::ObjectPath& ipconfig_path,
81 const std::string& name,
82 const VoidDBusMethodCallback& callback) {
83 base::MessageLoop::current()->PostTask(
84 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS));
85 }
86
87 void ShillIPConfigClientStub::Remove(const dbus::ObjectPath& ipconfig_path,
88 const VoidDBusMethodCallback& callback) {
89 base::MessageLoop::current()->PostTask(
90 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS));
91 }
92
93 void ShillIPConfigClientStub::PassProperties(
94 const base::DictionaryValue* values,
95 const DictionaryValueCallback& callback) const {
96 callback.Run(DBUS_METHOD_CALL_SUCCESS, *values);
97 }
98
99 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/shill_ipconfig_client_stub.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698