OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bluetooth_test.h" | 5 #include "device/bluetooth/test/bluetooth_test.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 NOTIMPLEMENTED(); | 85 NOTIMPLEMENTED(); |
86 return false; | 86 return false; |
87 } | 87 } |
88 | 88 |
89 std::vector<uint8_t> BluetoothTestBase::LastNotifactionValueForCharacteristic( | 89 std::vector<uint8_t> BluetoothTestBase::LastNotifactionValueForCharacteristic( |
90 BluetoothLocalGattCharacteristic* characteristic) { | 90 BluetoothLocalGattCharacteristic* characteristic) { |
91 NOTIMPLEMENTED(); | 91 NOTIMPLEMENTED(); |
92 return std::vector<uint8_t>(); | 92 return std::vector<uint8_t>(); |
93 } | 93 } |
94 | 94 |
| 95 void BluetoothTestBase::ExpectedChangeNotifyValueAttempts(int attempts) { |
| 96 EXPECT_EQ(attempts, gatt_write_descriptor_attempts_); |
| 97 EXPECT_EQ(attempts, gatt_notify_characteristic_attempts_); |
| 98 } |
| 99 |
| 100 void BluetoothTestBase::ExpectedNotifyValue( |
| 101 NotifyValueState expected_value_state) { |
| 102 ASSERT_EQ(2u, last_write_value_.size()); |
| 103 switch (expected_value_state) { |
| 104 case NotifyValueState::NONE: |
| 105 EXPECT_EQ(0, last_write_value_[0]); |
| 106 EXPECT_EQ(0, last_write_value_[1]); |
| 107 break; |
| 108 case NotifyValueState::NOTIFY: |
| 109 EXPECT_EQ(1, last_write_value_[0]); |
| 110 EXPECT_EQ(0, last_write_value_[1]); |
| 111 break; |
| 112 case NotifyValueState::INDICATE: |
| 113 EXPECT_EQ(2, last_write_value_[0]); |
| 114 EXPECT_EQ(0, last_write_value_[1]); |
| 115 break; |
| 116 } |
| 117 } |
| 118 |
95 std::vector<BluetoothLocalGattService*> | 119 std::vector<BluetoothLocalGattService*> |
96 BluetoothTestBase::RegisteredGattServices() { | 120 BluetoothTestBase::RegisteredGattServices() { |
97 NOTIMPLEMENTED(); | 121 NOTIMPLEMENTED(); |
98 return std::vector<BluetoothLocalGattService*>(); | 122 return std::vector<BluetoothLocalGattService*>(); |
99 } | 123 } |
100 | 124 |
101 void BluetoothTestBase::DeleteDevice(BluetoothDevice* device) { | 125 void BluetoothTestBase::DeleteDevice(BluetoothDevice* device) { |
102 adapter_->DeleteDeviceForTesting(device->GetAddress()); | 126 adapter_->DeleteDeviceForTesting(device->GetAddress()); |
103 } | 127 } |
104 | 128 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 gatt_write_characteristic_attempts_ = 0; | 403 gatt_write_characteristic_attempts_ = 0; |
380 gatt_read_descriptor_attempts_ = 0; | 404 gatt_read_descriptor_attempts_ = 0; |
381 gatt_write_descriptor_attempts_ = 0; | 405 gatt_write_descriptor_attempts_ = 0; |
382 } | 406 } |
383 | 407 |
384 void BluetoothTestBase::RemoveTimedOutDevices() { | 408 void BluetoothTestBase::RemoveTimedOutDevices() { |
385 adapter_->RemoveTimedOutDevices(); | 409 adapter_->RemoveTimedOutDevices(); |
386 } | 410 } |
387 | 411 |
388 } // namespace device | 412 } // namespace device |
OLD | NEW |