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

Unified Diff: chromeos/dbus/fake_old_bluetooth_manager_client.cc

Issue 14508007: dbus: Add FakeOldBluetooth{Adapter,Device,Manager} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unnecessary lines. Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chromeos/dbus/fake_old_bluetooth_manager_client.cc
diff --git a/chromeos/dbus/fake_old_bluetooth_manager_client.cc b/chromeos/dbus/fake_old_bluetooth_manager_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b26c80a1892c021777db3e02344e487c20f5b201
--- /dev/null
+++ b/chromeos/dbus/fake_old_bluetooth_manager_client.cc
@@ -0,0 +1,84 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chromeos/dbus/fake_old_bluetooth_manager_client.h"
+
+namespace chromeos {
+
+FakeOldBluetoothManagerClient::Properties::Properties(
+ const PropertyChangedCallback& callback) :
+ BluetoothManagerClient::Properties(NULL, callback) {
+}
+
+FakeOldBluetoothManagerClient::Properties::~Properties() {
+}
+
+void FakeOldBluetoothManagerClient::Properties::Get(
+ dbus::PropertyBase* property,
+ dbus::PropertySet::GetCallback callback) {
+ VLOG(1)<< "Get " << property->name();
+ callback.Run(false);
+}
+
+void FakeOldBluetoothManagerClient::Properties::GetAll() {
+ VLOG(1) << "GetAll";
+}
+
+void FakeOldBluetoothManagerClient::Properties::Set(
+ dbus::PropertyBase*property,
+ dbus::PropertySet::SetCallback callback) {
+ VLOG(1) << "Set " << property->name();
+ callback.Run(false);
+}
+
+FakeOldBluetoothManagerClient::FakeOldBluetoothManagerClient() {
+ properties_.reset(new Properties(base::Bind(
+ &FakeOldBluetoothManagerClient::OnPropertyChanged,
+ base::Unretained(this))));
+
+ std::vector<dbus::ObjectPath> adapters;
+ adapters.push_back(dbus::ObjectPath("/fake/hci0"));
+ properties_->adapters.ReplaceValue(adapters);
+}
+
+FakeOldBluetoothManagerClient::~FakeOldBluetoothManagerClient() {
+}
+
+void FakeOldBluetoothManagerClient::AddObserver(Observer* observer) {
+ observers_.AddObserver(observer);
+}
+
+void FakeOldBluetoothManagerClient::RemoveObserver(Observer* observer) {
+ observers_.RemoveObserver(observer);
+}
+
+FakeOldBluetoothManagerClient::Properties*
+FakeOldBluetoothManagerClient::GetProperties() {
+ VLOG(1) << "GetProperties";
+ return properties_.get();
+}
+
+void FakeOldBluetoothManagerClient::DefaultAdapter(
+ const AdapterCallback& callback) {
+ VLOG(1) << "DefaultAdapter.";
+ callback.Run(dbus::ObjectPath("/fake/hci0"), true);
+}
+
+void FakeOldBluetoothManagerClient::FindAdapter(
+ const std::string& address,
+ const AdapterCallback& callback) {
+ VLOG(1) << "FindAdapter: " << address;
+ if (address == "hci0")
+ callback.Run(dbus::ObjectPath("/fake/hci0"), true);
+ else
+ callback.Run(dbus::ObjectPath(), false);
+}
+
+void FakeOldBluetoothManagerClient::OnPropertyChanged(
+ const std::string& property_name) {
+ FOR_EACH_OBSERVER(BluetoothManagerClient::Observer, observers_,
+ ManagerPropertyChanged(property_name));
+}
+
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698