Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(845)

Side by Side Diff: device/bluetooth/test/bluetooth_test_mac.mm

Issue 2695573002: Adding BluetoothTestBase::CheckNotifySessionValue() method (Closed)
Patch Set: Fixing tests Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« device/bluetooth/test/bluetooth_test.cc ('K') | « device/bluetooth/test/bluetooth_test_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698