summaryrefslogtreecommitdiffstats
path: root/device
diff options
context:
space:
mode:
authorrkc <rkc@chromium.org>2015-05-15 13:16:38 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-15 20:16:46 +0000
commit58666c84553ecc058af5e6d178d6d8d3f47e99c1 (patch)
treec93592fbd2b9f8d1d7abe2e12e39005a2b7024b0 /device
parent37d19150ba0d4c59754d786d21d610c2eead7d45 (diff)
downloadchromium_src-58666c84553ecc058af5e6d178d6d8d3f47e99c1.zip
chromium_src-58666c84553ecc058af5e6d178d6d8d3f47e99c1.tar.gz
chromium_src-58666c84553ecc058af5e6d178d6d8d3f47e99c1.tar.bz2
Implement the advertising functions for the BLE API.
This CL implements the RegisterAdvertisement and UnregisterAdvertisement functions for the Chrome API. BUG=466375 Review URL: https://codereview.chromium.org/1132173002 Cr-Commit-Position: refs/heads/master@{#330182}
Diffstat (limited to 'device')
-rw-r--r--device/bluetooth/BUILD.gn2
-rw-r--r--device/bluetooth/bluetooth.gyp2
-rw-r--r--device/bluetooth/test/mock_bluetooth_adapter.cc3
-rw-r--r--device/bluetooth/test/mock_bluetooth_advertisement.cc21
-rw-r--r--device/bluetooth/test/mock_bluetooth_advertisement.h29
5 files changed, 57 insertions, 0 deletions
diff --git a/device/bluetooth/BUILD.gn b/device/bluetooth/BUILD.gn
index 3de7132..31b54e17 100644
--- a/device/bluetooth/BUILD.gn
+++ b/device/bluetooth/BUILD.gn
@@ -215,6 +215,8 @@ static_library("mocks") {
sources = [
"test/mock_bluetooth_adapter.cc",
"test/mock_bluetooth_adapter.h",
+ "test/mock_bluetooth_advertisement.cc",
+ "test/mock_bluetooth_advertisement.h",
"test/mock_bluetooth_device.cc",
"test/mock_bluetooth_device.h",
"test/mock_bluetooth_discovery_session.cc",
diff --git a/device/bluetooth/bluetooth.gyp b/device/bluetooth/bluetooth.gyp
index 4d734c5..d36a2ce 100644
--- a/device/bluetooth/bluetooth.gyp
+++ b/device/bluetooth/bluetooth.gyp
@@ -211,6 +211,8 @@
# Note: file list duplicated in GN build.
'test/mock_bluetooth_adapter.cc',
'test/mock_bluetooth_adapter.h',
+ 'test/mock_bluetooth_advertisement.cc',
+ 'test/mock_bluetooth_advertisement.h',
'test/mock_bluetooth_device.cc',
'test/mock_bluetooth_device.h',
'test/mock_bluetooth_discovery_session.cc',
diff --git a/device/bluetooth/test/mock_bluetooth_adapter.cc b/device/bluetooth/test/mock_bluetooth_adapter.cc
index 4b47579..46d8cb7 100644
--- a/device/bluetooth/test/mock_bluetooth_adapter.cc
+++ b/device/bluetooth/test/mock_bluetooth_adapter.cc
@@ -4,6 +4,8 @@
#include "device/bluetooth/test/mock_bluetooth_adapter.h"
+#include "device/bluetooth/test/mock_bluetooth_advertisement.h"
+
namespace device {
MockBluetoothAdapter::Observer::Observer() {}
@@ -50,6 +52,7 @@ void MockBluetoothAdapter::RegisterAdvertisement(
scoped_ptr<BluetoothAdvertisement::Data> advertisement_data,
const CreateAdvertisementCallback& callback,
const CreateAdvertisementErrorCallback& error_callback) {
+ callback.Run(new MockBluetoothAdvertisement);
}
} // namespace device
diff --git a/device/bluetooth/test/mock_bluetooth_advertisement.cc b/device/bluetooth/test/mock_bluetooth_advertisement.cc
new file mode 100644
index 0000000..ddba516
--- /dev/null
+++ b/device/bluetooth/test/mock_bluetooth_advertisement.cc
@@ -0,0 +1,21 @@
+// Copyright 2015 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 "device/bluetooth/test/mock_bluetooth_advertisement.h"
+
+namespace device {
+
+MockBluetoothAdvertisement::MockBluetoothAdvertisement() {
+}
+
+MockBluetoothAdvertisement::~MockBluetoothAdvertisement() {
+}
+
+void MockBluetoothAdvertisement::Unregister(
+ const SuccessCallback& success_callback,
+ const ErrorCallback& error_callback) {
+ success_callback.Run();
+}
+
+} // namespace chromeos
diff --git a/device/bluetooth/test/mock_bluetooth_advertisement.h b/device/bluetooth/test/mock_bluetooth_advertisement.h
new file mode 100644
index 0000000..ddaeef4
--- /dev/null
+++ b/device/bluetooth/test/mock_bluetooth_advertisement.h
@@ -0,0 +1,29 @@
+// Copyright 2015 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.
+
+#ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_CHROMEOS_H_
+#define DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_CHROMEOS_H_
+
+#include "base/macros.h"
+#include "device/bluetooth/bluetooth_advertisement.h"
+
+namespace device {
+
+class MockBluetoothAdvertisement : public device::BluetoothAdvertisement {
+ public:
+ MockBluetoothAdvertisement();
+
+ // BluetoothAdvertisement overrides:
+ void Unregister(const SuccessCallback& success_callback,
+ const ErrorCallback& error_callback) override;
+
+ private:
+ ~MockBluetoothAdvertisement() override;
+
+ DISALLOW_COPY_AND_ASSIGN(MockBluetoothAdvertisement);
+};
+
+} // namespace chromeos
+
+#endif // DEVICE_BLUETOOTH_BLUETOOTH_ADVERTISEMENT_CHROMEOS_H_