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

Side by Side Diff: device/bluetooth/test/fake_bluetooth.cc

Issue 2853433002: bluetooth: Implement simulateCentral (Closed)
Patch Set: even moar cleanup Created 3 years, 7 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/test/fake_bluetooth.h" 5 #include "device/bluetooth/test/fake_bluetooth.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "device/bluetooth/bluetooth_adapter_factory.h"
10 #include "device/bluetooth/public/interfaces/test/fake_bluetooth.mojom.h" 11 #include "device/bluetooth/public/interfaces/test/fake_bluetooth.mojom.h"
11 #include "mojo/public/cpp/bindings/strong_binding.h" 12 #include "mojo/public/cpp/bindings/strong_binding.h"
12 13
13 namespace bluetooth { 14 namespace bluetooth {
14 15
15 FakeBluetooth::FakeBluetooth() {} 16 FakeBluetooth::FakeBluetooth() {}
16 FakeBluetooth::~FakeBluetooth() {} 17 FakeBluetooth::~FakeBluetooth() {}
17 18
18 // static 19 // static
19 void FakeBluetooth::Create(mojom::FakeBluetoothRequest request) { 20 void FakeBluetooth::Create(mojom::FakeBluetoothRequest request) {
20 mojo::MakeStrongBinding(base::MakeUnique<FakeBluetooth>(), 21 mojo::MakeStrongBinding(base::MakeUnique<FakeBluetooth>(),
21 std::move(request)); 22 std::move(request));
22 } 23 }
23 24
24 void FakeBluetooth::SetLESupported(bool available, 25 void FakeBluetooth::SetLESupported(bool available,
25 const SetLESupportedCallback& callback) { 26 const SetLESupportedCallback& callback) {
26 // TODO(crbug.com/569709): Actually implement this method. 27 // TODO(crbug.com/569709): Actually implement this method.
27 callback.Run(); 28 callback.Run();
28 } 29 }
29 30
31 void FakeBluetooth::SimulateLECentralObserverManager(
32 mojom::LECentralObserverManagerState state,
33 const SimulateLECentralObserverManagerCallback& callback) {
34 mojom::FakeLECentralObserverManagerPtr fake_manager_ptr;
35 fake_manager_ = new FakeLECentralObserverManager(
36 state, mojo::MakeRequest(&fake_manager_ptr));
37 device::BluetoothAdapterFactory::SetAdapterForTesting(fake_manager_);
38 callback.Run(std::move(fake_manager_ptr));
39 }
40
30 } // namespace bluetooth 41 } // namespace bluetooth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698