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

Unified Diff: third_party/WebKit/LayoutTests/bluetooth/script-tests/service-get-different-service-after-reconnection.js

Issue 2478013002: bluetooth: Invalidate services upon disconnection (Closed)
Patch Set: Address scheib's comments Created 4 years, 1 month 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: third_party/WebKit/LayoutTests/bluetooth/script-tests/service-get-different-service-after-reconnection.js
diff --git a/third_party/WebKit/LayoutTests/bluetooth/script-tests/service-get-different-service-after-reconnection.js b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service-get-different-service-after-reconnection.js
new file mode 100644
index 0000000000000000000000000000000000000000..26ca8da14ace5a5c9e84e6cab59a69c00765c3af
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/bluetooth/script-tests/service-get-different-service-after-reconnection.js
@@ -0,0 +1,37 @@
+'use strict';
+promise_test(() => {
+ return setBluetoothFakeAdapter('TwoHeartRateServicesAdapter')
+ .then(() => requestDeviceWithKeyDown({
+ filters: [{services: ['heart_rate']}],
+ optionalServices: ['generic_access']}))
+ .then(device => device.gatt.connect())
+ .then(gattServer => {
+ let services1;
+ return gattServer
+ .CALLS([
+ getPrimaryService('heart_rate')|
+ getPrimaryServices()|
+ getPrimaryServices('heart_rate')[UUID]])
+ .then(services => services1 = services)
+ .then(() => gattServer.disconnect())
+ .then(() => gattServer.connect())
+ .then(() => gattServer.PREVIOUS_CALL)
+ .then(services2 => [services1, services2])
+ })
+ .then(services_arrays => {
+ // Convert to arrays if necessary.
+ for (let i = 0; i < services_arrays.length; i++) {
+ services_arrays[i] = [].concat(services_arrays[i]);
+ }
+
+ for (let i = 1; i < services_arrays.length; i++) {
+ assert_equals(services_arrays[0].length, services_arrays[i].length);
+ }
+
+ let base_set = new Set(services_arrays.shift());
+ for (let services of services_arrays) {
+ services.forEach(service => assert_false(base_set.has(service)));
+ }
+ });
+}, 'Calls to FUNCTION_NAME after a disconnection should return a ' +
+ 'different object.');

Powered by Google App Engine
This is Rietveld 408576698