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

Side by Side Diff: device/bluetooth/test/fake_central.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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "device/bluetooth/test/fake_central.h"
6
7 #include <memory>
8 #include <string>
9 #include <utility>
10
11 #include "device/bluetooth/bluetooth_discovery_filter.h"
12 #include "device/bluetooth/public/interfaces/test/fake_bluetooth.mojom.h"
13
14 namespace bluetooth {
15
16 FakeCentral::FakeCentral(mojom::CentralState state,
17 mojom::FakeCentralRequest request)
18 : state_(state), binding_(this, std::move(request)) {}
19
20 FakeCentral::~FakeCentral() {}
21
22 std::string FakeCentral::GetAddress() const {
23 NOTREACHED();
24 return std::string();
25 }
26
27 std::string FakeCentral::GetName() const {
28 NOTREACHED();
29 return std::string();
30 }
31
32 void FakeCentral::SetName(const std::string& name,
33 const base::Closure& callback,
34 const ErrorCallback& error_callback) {
35 NOTREACHED();
36 }
37
38 bool FakeCentral::IsInitialized() const {
39 return true;
40 }
41
42 bool FakeCentral::IsPresent() const {
43 switch (state_) {
44 case mojom::CentralState::ABSENT:
45 return false;
46 case mojom::CentralState::POWERED_OFF:
47 case mojom::CentralState::POWERED_ON:
48 return true;
49 }
50 NOTREACHED();
51 return false;
52 }
53
54 bool FakeCentral::IsPowered() const {
55 switch (state_) {
56 case mojom::CentralState::POWERED_OFF:
57 return false;
58 case mojom::CentralState::POWERED_ON:
59 return true;
60 case mojom::CentralState::ABSENT:
61 // Clients shouldn't call IsPowered() when the adapter is not present.
62 NOTREACHED();
63 return false;
64 }
65 NOTREACHED();
66 return false;
67 }
68
69 void FakeCentral::SetPowered(bool powered,
70 const base::Closure& callback,
71 const ErrorCallback& error_callback) {
72 NOTREACHED();
73 }
74
75 bool FakeCentral::IsDiscoverable() const {
76 NOTREACHED();
77 return false;
78 }
79
80 void FakeCentral::SetDiscoverable(bool discoverable,
81 const base::Closure& callback,
82 const ErrorCallback& error_callback) {
83 NOTREACHED();
84 }
85
86 bool FakeCentral::IsDiscovering() const {
87 NOTREACHED();
88 return false;
89 }
90
91 FakeCentral::UUIDList FakeCentral::GetUUIDs() const {
92 NOTREACHED();
93 return UUIDList();
94 }
95
96 void FakeCentral::CreateRfcommService(
97 const device::BluetoothUUID& uuid,
98 const ServiceOptions& options,
99 const CreateServiceCallback& callback,
100 const CreateServiceErrorCallback& error_callback) {
101 NOTREACHED();
102 }
103
104 void FakeCentral::CreateL2capService(
105 const device::BluetoothUUID& uuid,
106 const ServiceOptions& options,
107 const CreateServiceCallback& callback,
108 const CreateServiceErrorCallback& error_callback) {
109 NOTREACHED();
110 }
111
112 void FakeCentral::RegisterAdvertisement(
113 std::unique_ptr<device::BluetoothAdvertisement::Data> advertisement_data,
114 const CreateAdvertisementCallback& callback,
115 const AdvertisementErrorCallback& error_callback) {
116 NOTREACHED();
117 }
118
119 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
120 void FakeCentral::SetAdvertisingInterval(
121 const base::TimeDelta& min,
122 const base::TimeDelta& max,
123 const base::Closure& callback,
124 const AdvertisementErrorCallback& error_callback) {
125 NOTREACHED();
126 }
127 #endif
128
129 device::BluetoothLocalGattService* FakeCentral::GetGattService(
130 const std::string& identifier) const {
131 NOTREACHED();
132 return nullptr;
133 }
134
135 void FakeCentral::AddDiscoverySession(
136 device::BluetoothDiscoveryFilter* discovery_filter,
137 const base::Closure& callback,
138 const DiscoverySessionErrorCallback& error_callback) {
139 NOTREACHED();
140 }
141
142 void FakeCentral::RemoveDiscoverySession(
143 device::BluetoothDiscoveryFilter* discovery_filter,
144 const base::Closure& callback,
145 const DiscoverySessionErrorCallback& error_callback) {
146 NOTREACHED();
147 }
148
149 void FakeCentral::SetDiscoveryFilter(
150 std::unique_ptr<device::BluetoothDiscoveryFilter> discovery_filter,
151 const base::Closure& callback,
152 const DiscoverySessionErrorCallback& error_callback) {
153 NOTREACHED();
154 }
155
156 void FakeCentral::RemovePairingDelegateInternal(
157 device::BluetoothDevice::PairingDelegate* pairing_delegate) {
158 NOTREACHED();
159 }
160
161 } // namespace bluetooth
OLDNEW
« no previous file with comments | « device/bluetooth/test/fake_central.h ('k') | third_party/WebKit/LayoutTests/bluetooth/requestDevice/adapter-not-present.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698