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

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

Issue 2861533004: Implement chrome.bluetoothLowEnergy.resetAdvertising(). (Closed)
Patch Set: Implement chrome.bluetoothLowEnergy.resetAllAdvertisements(). Created 3 years, 6 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/reset_all_advertisements/runtest.js
diff --git a/chrome/test/data/extensions/api_test/bluetooth_low_energy/reset_all_advertisements/runtest.js b/chrome/test/data/extensions/api_test/bluetooth_low_energy/reset_all_advertisements/runtest.js
new file mode 100644
index 0000000000000000000000000000000000000000..46925863a0cef84d483c521a9d5755d725df5178
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/bluetooth_low_energy/reset_all_advertisements/runtest.js
@@ -0,0 +1,48 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var kAdvertisement = {
+ type: 'broadcast',
+ serviceUuids: ['value1', 'value2'],
+ manufacturerData: [{id: 321, data: [1, 2, 3]},
tbarzic 2017/06/27 22:49:12 nit: manufacturerData: [ {}, {} ],
Sonny Sasaka 2017/06/27 23:14:01 The dummy fields are actually required fields.
tbarzic 2017/06/27 23:17:05 yes, I was just to lazy to write all of it down, t
Sonny Sasaka 2017/06/27 23:21:45 Done.
+ {id: 567, data: [8, 2, 3]}],
+ solicitUuids: ['value3', 'value4'],
+ serviceData: [{uuid: 'uuid8', data: [1, 2, 3]},
+ {uuid: 'uuid36', data: [8, 2, 3]}]
+};
+
+var registeredAdvertisements = [];
+
+chrome.test.runTests([
+ function registerFirstAdvertisement() {
+ chrome.bluetoothLowEnergy.registerAdvertisement(
+ kAdvertisement,
+ chrome.test.callbackPass(function(id) {
+ chrome.test.assertTrue(!!id);
+ registeredAdvertisements.push(id);
+ }));
+ },
+
+ function registerSecondAdvertisement() {
+ chrome.bluetoothLowEnergy.registerAdvertisement(
+ kAdvertisement,
+ chrome.test.callbackPass(function(id) {
+ chrome.test.assertTrue(!!id);
+ chrome.test.assertEq(-1, registeredAdvertisements.indexOf(id));
+ registeredAdvertisements.push(id);
+ }));
+ },
+
+ function resetAdvertising() {
+ chrome.bluetoothLowEnergy.resetAdvertising(chrome.test.callbackPass());
+ },
+
+ function unregisterFails() {
+ registeredAdvertisements.forEach(function(id) {
+ chrome.bluetoothLowEnergy.unregisterAdvertisement(
+ id,
+ chrome.test.callbackFail("This advertisement does not exist"));
+ });
+ }
+]);

Powered by Google App Engine
This is Rietveld 408576698