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

Unified Diff: chrome/test/data/extensions/api_test/bluetooth_low_energy/notify_characteristic_value_changed/runtest.js

Issue 1972353002: Implement the notifyCharacteristicValueChanged API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notifications_bluez
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/bluetooth_low_energy/notify_characteristic_value_changed/runtest.js
diff --git a/chrome/test/data/extensions/api_test/bluetooth_low_energy/create_descriptor/runtest.js b/chrome/test/data/extensions/api_test/bluetooth_low_energy/notify_characteristic_value_changed/runtest.js
similarity index 56%
copy from chrome/test/data/extensions/api_test/bluetooth_low_energy/create_descriptor/runtest.js
copy to chrome/test/data/extensions/api_test/bluetooth_low_energy/notify_characteristic_value_changed/runtest.js
index ff84148cca346c0e9ac889518827b2c7a3ab0520..31f7b2e207c5876b9e33065084bb72f7140243b1 100644
--- a/chrome/test/data/extensions/api_test/bluetooth_low_energy/create_descriptor/runtest.js
+++ b/chrome/test/data/extensions/api_test/bluetooth_low_energy/notify_characteristic_value_changed/runtest.js
@@ -24,27 +24,28 @@ chrome.bluetoothLowEnergy.createService(service, function(serviceId) {
return;
var characteristic = { uuid: '00001234-0000-1000-8000-00805f9b34fa',
- properties: ['read'] };
+ properties: ['notify']};
chrome.bluetoothLowEnergy.createCharacteristic(characteristic, serviceId,
- function(characteristicId) {
+ function(characteristicId) {
if (failOnError(characteristicId))
- return;
-
- var descriptor = { uuid: '00001234-0000-1000-8000-00805f9b34fc',
- permissions: ['read'] };
- // Invalid characteristic ID.
- chrome.bluetoothLowEnergy.createDescriptor(descriptor,
- 'invalidCharacteristicId', function(descriptorId) {
- if (failOnSuccess())
+ return;
+ chrome.bluetoothLowEnergy.registerService(serviceId, function() {
+ if (failOnError('result'))
return;
- // Valid characteristic ID.
- chrome.bluetoothLowEnergy.createDescriptor(descriptor, characteristicId,
- function(descriptorId) {
- if (failOnError(descriptorId))
+ var bytes = [0xBA, 0xAD, 0x72, 0xF0, 0x0D, 0x65];
+ var newValue = (new Uint8Array(bytes)).buffer;
+ chrome.bluetoothLowEnergy.notifyCharacteristicValueChanged(
+ 'invalid_id', {value: newValue, shouldIndicate: false}, function() {
+ if (failOnSuccess())
return;
-
- chrome.test.succeed();
+ chrome.bluetoothLowEnergy.notifyCharacteristicValueChanged(
+ characteristicId, {value: newValue, shouldIndicate: false},
+ function() {
+ if (failOnError('result'))
+ return;
+ chrome.test.succeed();
+ });
});
});
});

Powered by Google App Engine
This is Rietveld 408576698