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