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

Side by Side Diff: device/bluetooth/test/bluetooth_test.h

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 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ 5 #ifndef DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_
6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ 6 #define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // - Services: [ kTestUUIDGenericAccess ] 49 // - Services: [ kTestUUIDGenericAccess ]
50 // HEART_RATE_DEVICE: 50 // HEART_RATE_DEVICE:
51 // - Name: kTestDeviceName 51 // - Name: kTestDeviceName
52 // - Address: kTestPeripheralUUID2 52 // - Address: kTestPeripheralUUID2
53 // - Services: [ kTestUUIDGenericAccess, kTestUUIDHeartRate] 53 // - Services: [ kTestUUIDGenericAccess, kTestUUIDHeartRate]
54 enum class ConnectedDeviceType { 54 enum class ConnectedDeviceType {
55 GENERIC_DEVICE, 55 GENERIC_DEVICE,
56 HEART_RATE_DEVICE, 56 HEART_RATE_DEVICE,
57 }; 57 };
58 58
59 enum class NotifyValueState {
60 NONE,
61 NOTIFY,
62 INDICATE,
63 };
64
59 static const std::string kTestAdapterName; 65 static const std::string kTestAdapterName;
60 static const std::string kTestAdapterAddress; 66 static const std::string kTestAdapterAddress;
61 67
62 static const std::string kTestDeviceName; 68 static const std::string kTestDeviceName;
63 static const std::string kTestDeviceNameEmpty; 69 static const std::string kTestDeviceNameEmpty;
64 70
65 static const std::string kTestDeviceAddress1; 71 static const std::string kTestDeviceAddress1;
66 static const std::string kTestDeviceAddress2; 72 static const std::string kTestDeviceAddress2;
67 static const std::string kTestDeviceAddress3; 73 static const std::string kTestDeviceAddress3;
68 74
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 // Simulates a Descriptor Write operation failing with a GattErrorCode. 400 // Simulates a Descriptor Write operation failing with a GattErrorCode.
395 virtual void SimulateGattDescriptorWriteError( 401 virtual void SimulateGattDescriptorWriteError(
396 BluetoothRemoteGattDescriptor* descriptor, 402 BluetoothRemoteGattDescriptor* descriptor,
397 BluetoothRemoteGattService::GattErrorCode) {} 403 BluetoothRemoteGattService::GattErrorCode) {}
398 404
399 // Simulates a Descriptor Write operation failing synchronously once for 405 // Simulates a Descriptor Write operation failing synchronously once for
400 // an unknown reason. 406 // an unknown reason.
401 virtual void SimulateGattDescriptorWriteWillFailSynchronouslyOnce( 407 virtual void SimulateGattDescriptorWriteWillFailSynchronouslyOnce(
402 BluetoothRemoteGattDescriptor* descriptor) {} 408 BluetoothRemoteGattDescriptor* descriptor) {}
403 409
410 // Tests if the notify value attemps.
ortuno 2017/02/23 05:56:00 Tests that functions to change the notify value ha
jlebel 2017/02/23 18:40:32 Done.
411 virtual void ExpectedChangeNotifyValueAttempts(int attempts);
412
413 // Tests if the notify session has been changed. The default implementation
ortuno 2017/02/23 05:56:00 Tests that the notify value is |expected_value_sta
jlebel 2017/02/23 18:40:32 Done.
414 // uses descriptors.
415 virtual void ExpectedNotifyValue(NotifyValueState expected_value_state);
416
404 // Returns a list of local GATT services registered with the adapter. 417 // Returns a list of local GATT services registered with the adapter.
405 virtual std::vector<BluetoothLocalGattService*> RegisteredGattServices(); 418 virtual std::vector<BluetoothLocalGattService*> RegisteredGattServices();
406 419
407 // Removes the device from the adapter and deletes it. 420 // Removes the device from the adapter and deletes it.
408 virtual void DeleteDevice(BluetoothDevice* device); 421 virtual void DeleteDevice(BluetoothDevice* device);
409 422
410 // Callbacks that increment |callback_count_|, |error_callback_count_|: 423 // Callbacks that increment |callback_count_|, |error_callback_count_|:
411 void Callback(Call expected); 424 void Callback(Call expected);
412 void DiscoverySessionCallback(Call expected, 425 void DiscoverySessionCallback(Call expected,
413 std::unique_ptr<BluetoothDiscoverySession>); 426 std::unique_ptr<BluetoothDiscoverySession>);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 GetReentrantStartNotifySessionSuccessCallback( 471 GetReentrantStartNotifySessionSuccessCallback(
459 Call expected, 472 Call expected,
460 BluetoothRemoteGattCharacteristic* characteristic); 473 BluetoothRemoteGattCharacteristic* characteristic);
461 base::Callback<void(BluetoothGattService::GattErrorCode)> 474 base::Callback<void(BluetoothGattService::GattErrorCode)>
462 GetReentrantStartNotifySessionErrorCallback( 475 GetReentrantStartNotifySessionErrorCallback(
463 Call expected, 476 Call expected,
464 BluetoothRemoteGattCharacteristic* characteristic, 477 BluetoothRemoteGattCharacteristic* characteristic,
465 bool error_in_reentrant); 478 bool error_in_reentrant);
466 479
467 // Reset all event count members to 0. 480 // Reset all event count members to 0.
468 void ResetEventCounts(); 481 virtual void ResetEventCounts();
469 482
470 void RemoveTimedOutDevices(); 483 void RemoveTimedOutDevices();
471 484
472 // A Message loop is required by some implementations that will PostTasks and 485 // A Message loop is required by some implementations that will PostTasks and
473 // by base::RunLoop().RunUntilIdle() use in this fixture. 486 // by base::RunLoop().RunUntilIdle() use in this fixture.
474 base::MessageLoop message_loop_; 487 base::MessageLoop message_loop_;
475 488
476 scoped_refptr<BluetoothAdapter> adapter_; 489 scoped_refptr<BluetoothAdapter> adapter_;
477 std::vector<std::unique_ptr<BluetoothDiscoverySession>> discovery_sessions_; 490 std::vector<std::unique_ptr<BluetoothDiscoverySession>> discovery_sessions_;
478 std::vector<std::unique_ptr<BluetoothGattConnection>> gatt_connections_; 491 std::vector<std::unique_ptr<BluetoothGattConnection>> gatt_connections_;
(...skipping 23 matching lines...) Expand all
502 int actual_error_callback_calls_ = 0; 515 int actual_error_callback_calls_ = 0;
503 bool unexpected_success_callback_ = false; 516 bool unexpected_success_callback_ = false;
504 bool unexpected_error_callback_ = false; 517 bool unexpected_error_callback_ = false;
505 518
506 base::WeakPtrFactory<BluetoothTestBase> weak_factory_; 519 base::WeakPtrFactory<BluetoothTestBase> weak_factory_;
507 }; 520 };
508 521
509 } // namespace device 522 } // namespace device
510 523
511 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_ 524 #endif // DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698