| 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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 static_cast<BluetoothRemoteGattServiceMac*>(service); | 460 static_cast<BluetoothRemoteGattServiceMac*>(service); |
| 461 CBService* cb_service = mac_gatt_service->GetService(); | 461 CBService* cb_service = mac_gatt_service->GetService(); |
| 462 MockCBService* service_mock = ObjCCast<MockCBService>(cb_service); | 462 MockCBService* service_mock = ObjCCast<MockCBService>(cb_service); |
| 463 BluetoothRemoteGattCharacteristicMac* characteristic_mac = | 463 BluetoothRemoteGattCharacteristicMac* characteristic_mac = |
| 464 static_cast<BluetoothRemoteGattCharacteristicMac*>(characteristic); | 464 static_cast<BluetoothRemoteGattCharacteristicMac*>(characteristic); |
| 465 CBCharacteristic* cb_characteristic = | 465 CBCharacteristic* cb_characteristic = |
| 466 characteristic_mac->GetCBCharacteristic(); | 466 characteristic_mac->GetCBCharacteristic(); |
| 467 MockCBCharacteristic* characteristic_mock = | 467 MockCBCharacteristic* characteristic_mock = |
| 468 ObjCCast<MockCBCharacteristic>(cb_characteristic); | 468 ObjCCast<MockCBCharacteristic>(cb_characteristic); |
| 469 [service_mock removeCharacteristicMock:characteristic_mock]; | 469 [service_mock removeCharacteristicMock:characteristic_mock]; |
| 470 [peripheral_mock didModifyServices:@[]]; |
| 470 [peripheral_mock mockDidDiscoverEvents]; | 471 [peripheral_mock mockDidDiscoverEvents]; |
| 471 } | 472 } |
| 472 | 473 |
| 473 void BluetoothTestMac::ExpectedChangeNotifyValueAttempts(int attempts) { | 474 void BluetoothTestMac::ExpectedChangeNotifyValueAttempts(int attempts) { |
| 474 EXPECT_EQ(attempts, gatt_notify_characteristic_attempts_); | 475 EXPECT_EQ(attempts, gatt_notify_characteristic_attempts_); |
| 475 } | 476 } |
| 476 | 477 |
| 477 void BluetoothTestMac::ExpectedNotifyValue( | 478 void BluetoothTestMac::ExpectedNotifyValue( |
| 478 NotifyValueState expected_value_state) { | 479 NotifyValueState expected_value_state) { |
| 479 switch (expected_value_state) { | 480 switch (expected_value_state) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 492 } | 493 } |
| 493 | 494 |
| 494 void BluetoothTestMac::OnFakeBluetoothGattDisconnect() { | 495 void BluetoothTestMac::OnFakeBluetoothGattDisconnect() { |
| 495 gatt_disconnection_attempts_++; | 496 gatt_disconnection_attempts_++; |
| 496 } | 497 } |
| 497 | 498 |
| 498 void BluetoothTestMac::OnFakeBluetoothServiceDiscovery() { | 499 void BluetoothTestMac::OnFakeBluetoothServiceDiscovery() { |
| 499 gatt_discovery_attempts_++; | 500 gatt_discovery_attempts_++; |
| 500 } | 501 } |
| 501 | 502 |
| 503 void BluetoothTestMac::OnFakeBluetoothCharacteristicDiscovery() { |
| 504 gatt_characteristic_discovery_attempts_++; |
| 505 } |
| 506 |
| 502 void BluetoothTest::OnFakeBluetoothCharacteristicReadValue() { | 507 void BluetoothTest::OnFakeBluetoothCharacteristicReadValue() { |
| 503 gatt_read_characteristic_attempts_++; | 508 gatt_read_characteristic_attempts_++; |
| 504 } | 509 } |
| 505 | 510 |
| 506 void BluetoothTest::OnFakeBluetoothCharacteristicWriteValue( | 511 void BluetoothTest::OnFakeBluetoothCharacteristicWriteValue( |
| 507 std::vector<uint8_t> value) { | 512 std::vector<uint8_t> value) { |
| 508 last_write_value_ = value; | 513 last_write_value_ = value; |
| 509 gatt_write_characteristic_attempts_++; | 514 gatt_write_characteristic_attempts_++; |
| 510 } | 515 } |
| 511 | 516 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 // crypto::SHA256HashString(input_str, raw, sizeof(raw)); | 587 // crypto::SHA256HashString(input_str, raw, sizeof(raw)); |
| 583 // if (base::HexEncode(raw, sizeof(raw)) == target) { | 588 // if (base::HexEncode(raw, sizeof(raw)) == target) { |
| 584 // return input_str; | 589 // return input_str; |
| 585 // } | 590 // } |
| 586 // ++input[0]; | 591 // ++input[0]; |
| 587 // } | 592 // } |
| 588 // return ""; | 593 // return ""; |
| 589 // } | 594 // } |
| 590 | 595 |
| 591 } // namespace device | 596 } // namespace device |
| OLD | NEW |