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_mac.h" | 5 #include "device/bluetooth/test/bluetooth_test_mac.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 BluetoothRemoteGattCharacteristicMac* characteristic_mac = | 458 BluetoothRemoteGattCharacteristicMac* characteristic_mac = |
459 static_cast<BluetoothRemoteGattCharacteristicMac*>(characteristic); | 459 static_cast<BluetoothRemoteGattCharacteristicMac*>(characteristic); |
460 CBCharacteristic* cb_characteristic = | 460 CBCharacteristic* cb_characteristic = |
461 characteristic_mac->GetCBCharacteristic(); | 461 characteristic_mac->GetCBCharacteristic(); |
462 MockCBCharacteristic* characteristic_mock = | 462 MockCBCharacteristic* characteristic_mock = |
463 ObjCCast<MockCBCharacteristic>(cb_characteristic); | 463 ObjCCast<MockCBCharacteristic>(cb_characteristic); |
464 [service_mock removeCharacteristicMock:characteristic_mock]; | 464 [service_mock removeCharacteristicMock:characteristic_mock]; |
465 [peripheral_mock mockDidDiscoverEvents]; | 465 [peripheral_mock mockDidDiscoverEvents]; |
466 } | 466 } |
467 | 467 |
| 468 void BluetoothTestMac::CheckNotifySessionValue( |
| 469 uint16_t expected_config_descriptor_value, |
| 470 int attempts) { |
| 471 EXPECT_EQ(attempts, gatt_notify_characteristic_attempts_); |
| 472 if (expected_config_descriptor_value == 0) { |
| 473 EXPECT_TRUE(last_notify_value); |
| 474 } else if (expected_config_descriptor_value == 1 || |
| 475 expected_config_descriptor_value == 2) { |
| 476 EXPECT_FALSE(last_notify_value); |
| 477 } |
| 478 } |
| 479 |
468 void BluetoothTestMac::OnFakeBluetoothDeviceConnectGattCalled() { | 480 void BluetoothTestMac::OnFakeBluetoothDeviceConnectGattCalled() { |
469 gatt_connection_attempts_++; | 481 gatt_connection_attempts_++; |
470 } | 482 } |
471 | 483 |
472 void BluetoothTestMac::OnFakeBluetoothGattDisconnect() { | 484 void BluetoothTestMac::OnFakeBluetoothGattDisconnect() { |
473 gatt_disconnection_attempts_++; | 485 gatt_disconnection_attempts_++; |
474 } | 486 } |
475 | 487 |
476 void BluetoothTestMac::OnFakeBluetoothServiceDiscovery() { | 488 void BluetoothTestMac::OnFakeBluetoothServiceDiscovery() { |
477 gatt_discovery_attempts_++; | 489 gatt_discovery_attempts_++; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 // crypto::SHA256HashString(input_str, raw, sizeof(raw)); | 572 // crypto::SHA256HashString(input_str, raw, sizeof(raw)); |
561 // if (base::HexEncode(raw, sizeof(raw)) == target) { | 573 // if (base::HexEncode(raw, sizeof(raw)) == target) { |
562 // return input_str; | 574 // return input_str; |
563 // } | 575 // } |
564 // ++input[0]; | 576 // ++input[0]; |
565 // } | 577 // } |
566 // return ""; | 578 // return ""; |
567 // } | 579 // } |
568 | 580 |
569 } // namespace device | 581 } // namespace device |
OLD | NEW |