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

Unified Diff: components/arc/test/fake_bluetooth_instance.cc

Issue 2046283003: Add unit test for ArcBluetoothBridge and TypeConverter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bt
Patch Set: rebase Created 4 years, 6 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: components/arc/test/fake_bluetooth_instance.cc
diff --git a/components/arc/test/fake_bluetooth_instance.cc b/components/arc/test/fake_bluetooth_instance.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5af01838a06c247ad72f3f870c86ca706c3fc7a9
--- /dev/null
+++ b/components/arc/test/fake_bluetooth_instance.cc
@@ -0,0 +1,88 @@
+// Copyright 2016 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 "components/arc/test/fake_bluetooth_instance.h"
+
+namespace arc {
+
+FakeBluetoothInstance::FakeBluetoothInstance() {}
+FakeBluetoothInstance::~FakeBluetoothInstance() {}
+
+FakeBluetoothInstance::GattDBResult::GattDBResult(
+ mojom::BluetoothAddressPtr&& remote_addr,
+ mojo::Array<mojom::BluetoothGattDBElementPtr>&& db)
+ : remote_addr_(std::move(remote_addr)), db_(std::move(db)) {}
+
+FakeBluetoothInstance::GattDBResult::~GattDBResult() {}
+
+FakeBluetoothInstance::LEDeviceFoundData::LEDeviceFoundData(
+ mojom::BluetoothAddressPtr&& addr,
+ int32_t rssi,
+ mojo::Array<mojom::BluetoothAdvertisingDataPtr>&& adv_data)
+ : addr_(std::move(addr)), rssi_(rssi), adv_data_(std::move(adv_data)) {}
+
+FakeBluetoothInstance::LEDeviceFoundData::~LEDeviceFoundData() {}
+
+void FakeBluetoothInstance::Init(mojom::BluetoothHostPtr host_ptr) {}
+
+void FakeBluetoothInstance::OnAdapterProperties(
+ mojom::BluetoothStatus status,
+ mojo::Array<mojom::BluetoothPropertyPtr> properties) {}
+
+void FakeBluetoothInstance::OnRemoteDeviceProperties(
+ mojom::BluetoothStatus status,
+ mojom::BluetoothAddressPtr address,
+ mojo::Array<mojom::BluetoothPropertyPtr> properties) {}
+
+void FakeBluetoothInstance::OnDeviceFound(
rkc 2016/06/19 18:45:43 What does the actual OnDeviceFound method do? This
puthik_chromium 2016/06/22 23:38:54 It's will send the list of known device to Android
+ mojo::Array<mojom::BluetoothPropertyPtr> properties) {
+ device_found_data_.emplace_back(std::move(properties));
+}
+
+void FakeBluetoothInstance::OnDiscoveryStateChanged(
+ mojom::BluetoothDiscoveryState state) {}
+
+void FakeBluetoothInstance::OnBondStateChanged(
+ mojom::BluetoothStatus status,
+ mojom::BluetoothAddressPtr remote_addr,
+ mojom::BluetoothBondState state) {}
+
+void FakeBluetoothInstance::OnAclStateChanged(
+ mojom::BluetoothStatus status,
+ mojom::BluetoothAddressPtr remote_addr,
+ mojom::BluetoothAclState state) {}
+
+void FakeBluetoothInstance::OnLEDeviceFound(
+ mojom::BluetoothAddressPtr addr,
+ int32_t rssi,
+ mojo::Array<mojom::BluetoothAdvertisingDataPtr> adv_data) {
+ le_device_found_data_.emplace_back(
+ new LEDeviceFoundData(std::move(addr), rssi, std::move(adv_data)));
+}
+
+void FakeBluetoothInstance::OnLEConnectionStateChange(
+ mojom::BluetoothAddressPtr remote_addr,
+ bool connected) {}
+
+void FakeBluetoothInstance::OnSearchComplete(
+ mojom::BluetoothAddressPtr remote_addr,
+ mojom::BluetoothGattStatus status) {}
+
+void FakeBluetoothInstance::OnGetGattDB(
+ mojom::BluetoothAddressPtr remote_addr,
+ mojo::Array<mojom::BluetoothGattDBElementPtr> db) {
+ gatt_db_result_.emplace_back(
+ new GattDBResult(std::move(remote_addr), std::move(db)));
+}
+
+void FakeBluetoothInstance::OnServicesRemoved(
+ mojom::BluetoothAddressPtr remote_addr,
+ uint16_t start_handle,
+ uint16_t end_handle) {}
+
+void FakeBluetoothInstance::OnServicesAdded(
+ mojom::BluetoothAddressPtr remote_addr,
+ mojo::Array<mojom::BluetoothGattDBElementPtr> db) {}
+
+} // namespace arc

Powered by Google App Engine
This is Rietveld 408576698