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 } | |
98 | |
99 void BluetoothTestBase::ExpectedNotifyValue( | |
100 NotifyValueState expected_value_state) { | |
101 ASSERT_EQ(2u, last_write_value_.size()); | |
102 switch (expected_value_state) { | |
103 case NotifyValueState::NONE: | |
104 EXPECT_EQ(0, last_write_value_[0]); | |
105 EXPECT_EQ(0, last_write_value_[1]); | |
106 break; | |
107 case NotifyValueState::NOTIFY: | |
108 EXPECT_EQ(1, last_write_value_[0]); | |
109 EXPECT_EQ(0, last_write_value_[1]); | |
110 break; | |
111 case NotifyValueState::INDICATE: | |
112 EXPECT_EQ(2, last_write_value_[0]); | |
113 EXPECT_EQ(0, last_write_value_[1]); | |
114 break; | |
115 } | |
116 } | |
117 | |
95 std::vector<BluetoothLocalGattService*> | 118 std::vector<BluetoothLocalGattService*> |
96 BluetoothTestBase::RegisteredGattServices() { | 119 BluetoothTestBase::RegisteredGattServices() { |
97 NOTIMPLEMENTED(); | 120 NOTIMPLEMENTED(); |
98 return std::vector<BluetoothLocalGattService*>(); | 121 return std::vector<BluetoothLocalGattService*>(); |
99 } | 122 } |
100 | 123 |
101 void BluetoothTestBase::DeleteDevice(BluetoothDevice* device) { | 124 void BluetoothTestBase::DeleteDevice(BluetoothDevice* device) { |
102 adapter_->DeleteDeviceForTesting(device->GetAddress()); | 125 adapter_->DeleteDeviceForTesting(device->GetAddress()); |
103 } | 126 } |
104 | 127 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
367 weak_factory_.GetWeakPtr(), expected, characteristic, error_in_reentrant); | 390 weak_factory_.GetWeakPtr(), expected, characteristic, error_in_reentrant); |
368 } | 391 } |
369 | 392 |
370 void BluetoothTestBase::ResetEventCounts() { | 393 void BluetoothTestBase::ResetEventCounts() { |
371 last_connect_error_code_ = BluetoothDevice::ERROR_UNKNOWN; | 394 last_connect_error_code_ = BluetoothDevice::ERROR_UNKNOWN; |
372 callback_count_ = 0; | 395 callback_count_ = 0; |
373 error_callback_count_ = 0; | 396 error_callback_count_ = 0; |
374 gatt_connection_attempts_ = 0; | 397 gatt_connection_attempts_ = 0; |
375 gatt_disconnection_attempts_ = 0; | 398 gatt_disconnection_attempts_ = 0; |
376 gatt_discovery_attempts_ = 0; | 399 gatt_discovery_attempts_ = 0; |
377 gatt_notify_characteristic_attempts_ = 0; | |
ortuno
2017/02/22 03:26:21
Both android[1] and windows[2] have "StartNotifica
jlebel
2017/02/22 12:02:08
Sorry about that. I was a bit fast.
| |
378 gatt_read_characteristic_attempts_ = 0; | 400 gatt_read_characteristic_attempts_ = 0; |
379 gatt_write_characteristic_attempts_ = 0; | 401 gatt_write_characteristic_attempts_ = 0; |
380 gatt_read_descriptor_attempts_ = 0; | 402 gatt_read_descriptor_attempts_ = 0; |
381 gatt_write_descriptor_attempts_ = 0; | 403 gatt_write_descriptor_attempts_ = 0; |
382 } | 404 } |
383 | 405 |
384 void BluetoothTestBase::RemoveTimedOutDevices() { | 406 void BluetoothTestBase::RemoveTimedOutDevices() { |
385 adapter_->RemoveTimedOutDevices(); | 407 adapter_->RemoveTimedOutDevices(); |
386 } | 408 } |
387 | 409 |
388 } // namespace device | 410 } // namespace device |
OLD | NEW |