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

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

Issue 2853433002: bluetooth: Implement simulateCentral (Closed)
Patch Set: Address dcheng's comments 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
« no previous file with comments | « device/bluetooth/test/fake_bluetooth.h ('k') | device/bluetooth/test/fake_central.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bluetooth_adapter_factory.h"
(...skipping 14 matching lines...) Expand all
25 mojo::MakeStrongBinding(base::MakeUnique<FakeBluetooth>(), 25 mojo::MakeStrongBinding(base::MakeUnique<FakeBluetooth>(),
26 std::move(request)); 26 std::move(request));
27 } 27 }
28 28
29 void FakeBluetooth::SetLESupported(bool supported, 29 void FakeBluetooth::SetLESupported(bool supported,
30 const SetLESupportedCallback& callback) { 30 const SetLESupportedCallback& callback) {
31 global_factory_values_->SetLESupported(supported); 31 global_factory_values_->SetLESupported(supported);
32 callback.Run(); 32 callback.Run();
33 } 33 }
34 34
35 void FakeBluetooth::SimulateCentral(mojom::CentralState state,
36 const SimulateCentralCallback& callback) {
37 mojom::FakeCentralPtr fake_central_ptr;
38 fake_central_ = base::MakeShared<FakeCentral>(
39 state, mojo::MakeRequest(&fake_central_ptr));
40 device::BluetoothAdapterFactory::SetAdapterForTesting(fake_central_);
41 callback.Run(std::move(fake_central_ptr));
42 }
43
35 } // namespace bluetooth 44 } // namespace bluetooth
OLDNEW
« no previous file with comments | « device/bluetooth/test/fake_bluetooth.h ('k') | device/bluetooth/test/fake_central.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698