Bug 1450313 [wpt PR 10255] - bluetooth: SetNextUnsubscribeFromNotifications, a=testonly
authorOvidio Henriquez <odejesush@chromium.org>
Mon, 09 Apr 2018 22:18:42 +0000
changeset 467298 11a52ef07c42a4eb79965d1669bf235045f5538f
parent 467297 089cec1a8dd1929f56de03624824eaa18991013f
child 467299 70a68ef1022db7a54765dcaf665776f60534d69b
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1450313, 10255, 569709, 988223, 548544
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1450313 [wpt PR 10255] - bluetooth: SetNextUnsubscribeFromNotifications, a=testonly Automatic update from web-platform-testsbluetooth: SetNextUnsubscribeFromNotifications This change implements the SetNextUnsubscribeFromNotifications function for fake characteristics. BUG=569709 Change-Id: I99c59a4caffd524e727921fcb54f48cc868d545f Reviewed-on: https://chromium-review.googlesource.com/988223 Commit-Queue: Ovidio Henriquez <odejesush@chromium.org> Reviewed-by: Oliver Chang <ochang@chromium.org> Reviewed-by: Giovanni Ortuño Urquidi <ortuno@chromium.org> Cr-Commit-Position: refs/heads/master@{#548544} wpt-commits: 15428c11650245510eaa51a6ea596db90c767487 wpt-pr: 10255 wpt-commits: 15428c11650245510eaa51a6ea596db90c767487 wpt-pr: 10255
testing/web-platform/tests/resources/chromium/fake_bluetooth.mojom.js
testing/web-platform/tests/resources/chromium/web-bluetooth-test.js
--- a/testing/web-platform/tests/resources/chromium/fake_bluetooth.mojom.js
+++ b/testing/web-platform/tests/resources/chromium/fake_bluetooth.mojom.js
@@ -2891,16 +2891,316 @@
     encoder.skip(1);
     encoder.skip(1);
     encoder.skip(1);
     encoder.skip(1);
     encoder.skip(1);
     encoder.skip(1);
     encoder.skip(1);
   };
+  function FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params(values) {
+    this.initDefaults_();
+    this.initFields_(values);
+  }
+
+
+  FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params.prototype.initDefaults_ = function() {
+    this.gattCode = 0;
+    this.characteristicId = null;
+    this.serviceId = null;
+    this.peripheralAddress = null;
+  };
+  FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params.prototype.initFields_ = function(fields) {
+    for(var field in fields) {
+        if (this.hasOwnProperty(field))
+          this[field] = fields[field];
+    }
+  };
+
+  FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params.validate = function(messageValidator, offset) {
+    var err;
+    err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
+    if (err !== validator.validationError.NONE)
+        return err;
+
+    var kVersionSizes = [
+      {version: 0, numBytes: 40}
+    ];
+    err = messageValidator.validateStructVersion(offset, kVersionSizes);
+    if (err !== validator.validationError.NONE)
+        return err;
+
+
+
+    // validate FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params.characteristicId
+    err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 8, false)
+    if (err !== validator.validationError.NONE)
+        return err;
+
+
+    // validate FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params.serviceId
+    err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 16, false)
+    if (err !== validator.validationError.NONE)
+        return err;
+
+
+    // validate FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params.peripheralAddress
+    err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 24, false)
+    if (err !== validator.validationError.NONE)
+        return err;
+
+    return validator.validationError.NONE;
+  };
+
+  FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params.encodedSize = codec.kStructHeaderSize + 32;
+
+  FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params.decode = function(decoder) {
+    var packed;
+    var val = new FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params();
+    var numberOfBytes = decoder.readUint32();
+    var version = decoder.readUint32();
+    val.gattCode = decoder.decodeStruct(codec.Uint16);
+    decoder.skip(1);
+    decoder.skip(1);
+    decoder.skip(1);
+    decoder.skip(1);
+    decoder.skip(1);
+    decoder.skip(1);
+    val.characteristicId = decoder.decodeStruct(codec.String);
+    val.serviceId = decoder.decodeStruct(codec.String);
+    val.peripheralAddress = decoder.decodeStruct(codec.String);
+    return val;
+  };
+
+  FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params.encode = function(encoder, val) {
+    var packed;
+    encoder.writeUint32(FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params.encodedSize);
+    encoder.writeUint32(0);
+    encoder.encodeStruct(codec.Uint16, val.gattCode);
+    encoder.skip(1);
+    encoder.skip(1);
+    encoder.skip(1);
+    encoder.skip(1);
+    encoder.skip(1);
+    encoder.skip(1);
+    encoder.encodeStruct(codec.String, val.characteristicId);
+    encoder.encodeStruct(codec.String, val.serviceId);
+    encoder.encodeStruct(codec.String, val.peripheralAddress);
+  };
+  function FakeCentral_SetNextUnsubscribeFromNotificationsResponse_ResponseParams(values) {
+    this.initDefaults_();
+    this.initFields_(values);
+  }
+
+
+  FakeCentral_SetNextUnsubscribeFromNotificationsResponse_ResponseParams.prototype.initDefaults_ = function() {
+    this.success = false;
+  };
+  FakeCentral_SetNextUnsubscribeFromNotificationsResponse_ResponseParams.prototype.initFields_ = function(fields) {
+    for(var field in fields) {
+        if (this.hasOwnProperty(field))
+          this[field] = fields[field];
+    }
+  };
+
+  FakeCentral_SetNextUnsubscribeFromNotificationsResponse_ResponseParams.validate = function(messageValidator, offset) {
+    var err;
+    err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
+    if (err !== validator.validationError.NONE)
+        return err;
+
+    var kVersionSizes = [
+      {version: 0, numBytes: 16}
+    ];
+    err = messageValidator.validateStructVersion(offset, kVersionSizes);
+    if (err !== validator.validationError.NONE)
+        return err;
+
+
+    return validator.validationError.NONE;
+  };
+
+  FakeCentral_SetNextUnsubscribeFromNotificationsResponse_ResponseParams.encodedSize = codec.kStructHeaderSize + 8;
+
+  FakeCentral_SetNextUnsubscribeFromNotificationsResponse_ResponseParams.decode = function(decoder) {
+    var packed;
+    var val = new FakeCentral_SetNextUnsubscribeFromNotificationsResponse_ResponseParams();
+    var numberOfBytes = decoder.readUint32();
+    var version = decoder.readUint32();
+    packed = decoder.readUint8();
+    val.success = (packed >> 0) & 1 ? true : false;
+    decoder.skip(1);
+    decoder.skip(1);
+    decoder.skip(1);
+    decoder.skip(1);
+    decoder.skip(1);
+    decoder.skip(1);
+    decoder.skip(1);
+    return val;
+  };
+
+  FakeCentral_SetNextUnsubscribeFromNotificationsResponse_ResponseParams.encode = function(encoder, val) {
+    var packed;
+    encoder.writeUint32(FakeCentral_SetNextUnsubscribeFromNotificationsResponse_ResponseParams.encodedSize);
+    encoder.writeUint32(0);
+    packed = 0;
+    packed |= (val.success & 1) << 0
+    encoder.writeUint8(packed);
+    encoder.skip(1);
+    encoder.skip(1);
+    encoder.skip(1);
+    encoder.skip(1);
+    encoder.skip(1);
+    encoder.skip(1);
+    encoder.skip(1);
+  };
+  function FakeCentral_IsNotifying_Params(values) {
+    this.initDefaults_();
+    this.initFields_(values);
+  }
+
+
+  FakeCentral_IsNotifying_Params.prototype.initDefaults_ = function() {
+    this.characteristicId = null;
+    this.serviceId = null;
+    this.peripheralAddress = null;
+  };
+  FakeCentral_IsNotifying_Params.prototype.initFields_ = function(fields) {
+    for(var field in fields) {
+        if (this.hasOwnProperty(field))
+          this[field] = fields[field];
+    }
+  };
+
+  FakeCentral_IsNotifying_Params.validate = function(messageValidator, offset) {
+    var err;
+    err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
+    if (err !== validator.validationError.NONE)
+        return err;
+
+    var kVersionSizes = [
+      {version: 0, numBytes: 32}
+    ];
+    err = messageValidator.validateStructVersion(offset, kVersionSizes);
+    if (err !== validator.validationError.NONE)
+        return err;
+
+
+    // validate FakeCentral_IsNotifying_Params.characteristicId
+    err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 0, false)
+    if (err !== validator.validationError.NONE)
+        return err;
+
+
+    // validate FakeCentral_IsNotifying_Params.serviceId
+    err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 8, false)
+    if (err !== validator.validationError.NONE)
+        return err;
+
+
+    // validate FakeCentral_IsNotifying_Params.peripheralAddress
+    err = messageValidator.validateStringPointer(offset + codec.kStructHeaderSize + 16, false)
+    if (err !== validator.validationError.NONE)
+        return err;
+
+    return validator.validationError.NONE;
+  };
+
+  FakeCentral_IsNotifying_Params.encodedSize = codec.kStructHeaderSize + 24;
+
+  FakeCentral_IsNotifying_Params.decode = function(decoder) {
+    var packed;
+    var val = new FakeCentral_IsNotifying_Params();
+    var numberOfBytes = decoder.readUint32();
+    var version = decoder.readUint32();
+    val.characteristicId = decoder.decodeStruct(codec.String);
+    val.serviceId = decoder.decodeStruct(codec.String);
+    val.peripheralAddress = decoder.decodeStruct(codec.String);
+    return val;
+  };
+
+  FakeCentral_IsNotifying_Params.encode = function(encoder, val) {
+    var packed;
+    encoder.writeUint32(FakeCentral_IsNotifying_Params.encodedSize);
+    encoder.writeUint32(0);
+    encoder.encodeStruct(codec.String, val.characteristicId);
+    encoder.encodeStruct(codec.String, val.serviceId);
+    encoder.encodeStruct(codec.String, val.peripheralAddress);
+  };
+  function FakeCentral_IsNotifying_ResponseParams(values) {
+    this.initDefaults_();
+    this.initFields_(values);
+  }
+
+
+  FakeCentral_IsNotifying_ResponseParams.prototype.initDefaults_ = function() {
+    this.success = false;
+    this.isNotifying = false;
+  };
+  FakeCentral_IsNotifying_ResponseParams.prototype.initFields_ = function(fields) {
+    for(var field in fields) {
+        if (this.hasOwnProperty(field))
+          this[field] = fields[field];
+    }
+  };
+
+  FakeCentral_IsNotifying_ResponseParams.validate = function(messageValidator, offset) {
+    var err;
+    err = messageValidator.validateStructHeader(offset, codec.kStructHeaderSize);
+    if (err !== validator.validationError.NONE)
+        return err;
+
+    var kVersionSizes = [
+      {version: 0, numBytes: 16}
+    ];
+    err = messageValidator.validateStructVersion(offset, kVersionSizes);
+    if (err !== validator.validationError.NONE)
+        return err;
+
+
+
+    return validator.validationError.NONE;
+  };
+
+  FakeCentral_IsNotifying_ResponseParams.encodedSize = codec.kStructHeaderSize + 8;
+
+  FakeCentral_IsNotifying_ResponseParams.decode = function(decoder) {
+    var packed;
+    var val = new FakeCentral_IsNotifying_ResponseParams();
+    var numberOfBytes = decoder.readUint32();
+    var version = decoder.readUint32();
+    packed = decoder.readUint8();
+    val.success = (packed >> 0) & 1 ? true : false;
+    val.isNotifying = (packed >> 1) & 1 ? true : false;
+    decoder.skip(1);
+    decoder.skip(1);
+    decoder.skip(1);
+    decoder.skip(1);
+    decoder.skip(1);
+    decoder.skip(1);
+    decoder.skip(1);
+    return val;
+  };
+
+  FakeCentral_IsNotifying_ResponseParams.encode = function(encoder, val) {
+    var packed;
+    encoder.writeUint32(FakeCentral_IsNotifying_ResponseParams.encodedSize);
+    encoder.writeUint32(0);
+    packed = 0;
+    packed |= (val.success & 1) << 0
+    packed |= (val.isNotifying & 1) << 1
+    encoder.writeUint8(packed);
+    encoder.skip(1);
+    encoder.skip(1);
+    encoder.skip(1);
+    encoder.skip(1);
+    encoder.skip(1);
+    encoder.skip(1);
+    encoder.skip(1);
+  };
   function FakeCentral_GetLastWrittenCharacteristicValue_Params(values) {
     this.initDefaults_();
     this.initFields_(values);
   }
 
 
   FakeCentral_GetLastWrittenCharacteristicValue_Params.prototype.initDefaults_ = function() {
     this.characteristicId = null;
@@ -3781,20 +4081,22 @@
   var kFakeCentral_RemoveFakeService_Name = 7;
   var kFakeCentral_AddFakeCharacteristic_Name = 8;
   var kFakeCentral_RemoveFakeCharacteristic_Name = 9;
   var kFakeCentral_AddFakeDescriptor_Name = 10;
   var kFakeCentral_RemoveFakeDescriptor_Name = 11;
   var kFakeCentral_SetNextReadCharacteristicResponse_Name = 12;
   var kFakeCentral_SetNextWriteCharacteristicResponse_Name = 13;
   var kFakeCentral_SetNextSubscribeToNotificationsResponse_Name = 14;
-  var kFakeCentral_GetLastWrittenCharacteristicValue_Name = 15;
-  var kFakeCentral_SetNextReadDescriptorResponse_Name = 16;
-  var kFakeCentral_SetNextWriteDescriptorResponse_Name = 17;
-  var kFakeCentral_GetLastWrittenDescriptorValue_Name = 18;
+  var kFakeCentral_SetNextUnsubscribeFromNotificationsResponse_Name = 15;
+  var kFakeCentral_IsNotifying_Name = 16;
+  var kFakeCentral_GetLastWrittenCharacteristicValue_Name = 17;
+  var kFakeCentral_SetNextReadDescriptorResponse_Name = 18;
+  var kFakeCentral_SetNextWriteDescriptorResponse_Name = 19;
+  var kFakeCentral_GetLastWrittenDescriptorValue_Name = 20;
 
   function FakeCentralPtr(handleOrPtrInfo) {
     this.ptr = new bindings.InterfacePtrController(FakeCentral,
                                                    handleOrPtrInfo);
   }
 
   function FakeCentralAssociatedPtr(associatedInterfacePtrInfo) {
     this.ptr = new associatedBindings.AssociatedInterfacePtrController(
@@ -4206,16 +4508,71 @@
         var responseParams =
             reader.decodeStruct(FakeCentral_SetNextSubscribeToNotificationsResponse_ResponseParams);
         resolve(responseParams);
       }).catch(function(result) {
         reject(Error("Connection error: " + result));
       });
     }.bind(this));
   };
+  FakeCentralPtr.prototype.setNextUnsubscribeFromNotificationsResponse = function() {
+    return FakeCentralProxy.prototype.setNextUnsubscribeFromNotificationsResponse
+        .apply(this.ptr.getProxy(), arguments);
+  };
+
+  FakeCentralProxy.prototype.setNextUnsubscribeFromNotificationsResponse = function(gattCode, characteristicId, serviceId, peripheralAddress) {
+    var params = new FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params();
+    params.gattCode = gattCode;
+    params.characteristicId = characteristicId;
+    params.serviceId = serviceId;
+    params.peripheralAddress = peripheralAddress;
+    return new Promise(function(resolve, reject) {
+      var builder = new codec.MessageV1Builder(
+          kFakeCentral_SetNextUnsubscribeFromNotificationsResponse_Name,
+          codec.align(FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params.encodedSize),
+          codec.kMessageExpectsResponse, 0);
+      builder.encodeStruct(FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params, params);
+      var message = builder.finish();
+      this.receiver_.acceptAndExpectResponse(message).then(function(message) {
+        var reader = new codec.MessageReader(message);
+        var responseParams =
+            reader.decodeStruct(FakeCentral_SetNextUnsubscribeFromNotificationsResponse_ResponseParams);
+        resolve(responseParams);
+      }).catch(function(result) {
+        reject(Error("Connection error: " + result));
+      });
+    }.bind(this));
+  };
+  FakeCentralPtr.prototype.isNotifying = function() {
+    return FakeCentralProxy.prototype.isNotifying
+        .apply(this.ptr.getProxy(), arguments);
+  };
+
+  FakeCentralProxy.prototype.isNotifying = function(characteristicId, serviceId, peripheralAddress) {
+    var params = new FakeCentral_IsNotifying_Params();
+    params.characteristicId = characteristicId;
+    params.serviceId = serviceId;
+    params.peripheralAddress = peripheralAddress;
+    return new Promise(function(resolve, reject) {
+      var builder = new codec.MessageV1Builder(
+          kFakeCentral_IsNotifying_Name,
+          codec.align(FakeCentral_IsNotifying_Params.encodedSize),
+          codec.kMessageExpectsResponse, 0);
+      builder.encodeStruct(FakeCentral_IsNotifying_Params, params);
+      var message = builder.finish();
+      this.receiver_.acceptAndExpectResponse(message).then(function(message) {
+        var reader = new codec.MessageReader(message);
+        var responseParams =
+            reader.decodeStruct(FakeCentral_IsNotifying_ResponseParams);
+        resolve(responseParams);
+      }).catch(function(result) {
+        reject(Error("Connection error: " + result));
+      });
+    }.bind(this));
+  };
   FakeCentralPtr.prototype.getLastWrittenCharacteristicValue = function() {
     return FakeCentralProxy.prototype.getLastWrittenCharacteristicValue
         .apply(this.ptr.getProxy(), arguments);
   };
 
   FakeCentralProxy.prototype.getLastWrittenCharacteristicValue = function(characteristicId, serviceId, peripheralAddress) {
     var params = new FakeCentral_GetLastWrittenCharacteristicValue_Params();
     params.characteristicId = characteristicId;
@@ -4369,16 +4726,22 @@
     return this.delegate_ && this.delegate_.setNextReadCharacteristicResponse && this.delegate_.setNextReadCharacteristicResponse(gattCode, value, characteristicId, serviceId, peripheralAddress);
   }
   FakeCentralStub.prototype.setNextWriteCharacteristicResponse = function(gattCode, characteristicId, serviceId, peripheralAddress) {
     return this.delegate_ && this.delegate_.setNextWriteCharacteristicResponse && this.delegate_.setNextWriteCharacteristicResponse(gattCode, characteristicId, serviceId, peripheralAddress);
   }
   FakeCentralStub.prototype.setNextSubscribeToNotificationsResponse = function(gattCode, characteristicId, serviceId, peripheralAddress) {
     return this.delegate_ && this.delegate_.setNextSubscribeToNotificationsResponse && this.delegate_.setNextSubscribeToNotificationsResponse(gattCode, characteristicId, serviceId, peripheralAddress);
   }
+  FakeCentralStub.prototype.setNextUnsubscribeFromNotificationsResponse = function(gattCode, characteristicId, serviceId, peripheralAddress) {
+    return this.delegate_ && this.delegate_.setNextUnsubscribeFromNotificationsResponse && this.delegate_.setNextUnsubscribeFromNotificationsResponse(gattCode, characteristicId, serviceId, peripheralAddress);
+  }
+  FakeCentralStub.prototype.isNotifying = function(characteristicId, serviceId, peripheralAddress) {
+    return this.delegate_ && this.delegate_.isNotifying && this.delegate_.isNotifying(characteristicId, serviceId, peripheralAddress);
+  }
   FakeCentralStub.prototype.getLastWrittenCharacteristicValue = function(characteristicId, serviceId, peripheralAddress) {
     return this.delegate_ && this.delegate_.getLastWrittenCharacteristicValue && this.delegate_.getLastWrittenCharacteristicValue(characteristicId, serviceId, peripheralAddress);
   }
   FakeCentralStub.prototype.setNextReadDescriptorResponse = function(gattCode, value, descriptorId, characteristicId, serviceId, peripheralAddress) {
     return this.delegate_ && this.delegate_.setNextReadDescriptorResponse && this.delegate_.setNextReadDescriptorResponse(gattCode, value, descriptorId, characteristicId, serviceId, peripheralAddress);
   }
   FakeCentralStub.prototype.setNextWriteDescriptorResponse = function(gattCode, descriptorId, characteristicId, serviceId, peripheralAddress) {
     return this.delegate_ && this.delegate_.setNextWriteDescriptorResponse && this.delegate_.setNextWriteDescriptorResponse(gattCode, descriptorId, characteristicId, serviceId, peripheralAddress);
@@ -4632,16 +4995,49 @@
             codec.align(FakeCentral_SetNextSubscribeToNotificationsResponse_ResponseParams.encodedSize),
             codec.kMessageIsResponse, reader.requestID);
         builder.encodeStruct(FakeCentral_SetNextSubscribeToNotificationsResponse_ResponseParams,
                              responseParams);
         var message = builder.finish();
         responder.accept(message);
       });
       return true;
+    case kFakeCentral_SetNextUnsubscribeFromNotificationsResponse_Name:
+      var params = reader.decodeStruct(FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params);
+      this.setNextUnsubscribeFromNotificationsResponse(params.gattCode, params.characteristicId, params.serviceId, params.peripheralAddress).then(function(response) {
+        var responseParams =
+            new FakeCentral_SetNextUnsubscribeFromNotificationsResponse_ResponseParams();
+        responseParams.success = response.success;
+        var builder = new codec.MessageV1Builder(
+            kFakeCentral_SetNextUnsubscribeFromNotificationsResponse_Name,
+            codec.align(FakeCentral_SetNextUnsubscribeFromNotificationsResponse_ResponseParams.encodedSize),
+            codec.kMessageIsResponse, reader.requestID);
+        builder.encodeStruct(FakeCentral_SetNextUnsubscribeFromNotificationsResponse_ResponseParams,
+                             responseParams);
+        var message = builder.finish();
+        responder.accept(message);
+      });
+      return true;
+    case kFakeCentral_IsNotifying_Name:
+      var params = reader.decodeStruct(FakeCentral_IsNotifying_Params);
+      this.isNotifying(params.characteristicId, params.serviceId, params.peripheralAddress).then(function(response) {
+        var responseParams =
+            new FakeCentral_IsNotifying_ResponseParams();
+        responseParams.success = response.success;
+        responseParams.isNotifying = response.isNotifying;
+        var builder = new codec.MessageV1Builder(
+            kFakeCentral_IsNotifying_Name,
+            codec.align(FakeCentral_IsNotifying_ResponseParams.encodedSize),
+            codec.kMessageIsResponse, reader.requestID);
+        builder.encodeStruct(FakeCentral_IsNotifying_ResponseParams,
+                             responseParams);
+        var message = builder.finish();
+        responder.accept(message);
+      });
+      return true;
     case kFakeCentral_GetLastWrittenCharacteristicValue_Name:
       var params = reader.decodeStruct(FakeCentral_GetLastWrittenCharacteristicValue_Params);
       this.getLastWrittenCharacteristicValue(params.characteristicId, params.serviceId, params.peripheralAddress).then(function(response) {
         var responseParams =
             new FakeCentral_GetLastWrittenCharacteristicValue_ResponseParams();
         responseParams.success = response.success;
         responseParams.value = response.value;
         var builder = new codec.MessageV1Builder(
@@ -4767,16 +5163,24 @@
       case kFakeCentral_SetNextWriteCharacteristicResponse_Name:
         if (message.expectsResponse())
           paramsClass = FakeCentral_SetNextWriteCharacteristicResponse_Params;
       break;
       case kFakeCentral_SetNextSubscribeToNotificationsResponse_Name:
         if (message.expectsResponse())
           paramsClass = FakeCentral_SetNextSubscribeToNotificationsResponse_Params;
       break;
+      case kFakeCentral_SetNextUnsubscribeFromNotificationsResponse_Name:
+        if (message.expectsResponse())
+          paramsClass = FakeCentral_SetNextUnsubscribeFromNotificationsResponse_Params;
+      break;
+      case kFakeCentral_IsNotifying_Name:
+        if (message.expectsResponse())
+          paramsClass = FakeCentral_IsNotifying_Params;
+      break;
       case kFakeCentral_GetLastWrittenCharacteristicValue_Name:
         if (message.expectsResponse())
           paramsClass = FakeCentral_GetLastWrittenCharacteristicValue_Params;
       break;
       case kFakeCentral_SetNextReadDescriptorResponse_Name:
         if (message.expectsResponse())
           paramsClass = FakeCentral_SetNextReadDescriptorResponse_Params;
       break;
@@ -4853,16 +5257,24 @@
       case kFakeCentral_SetNextWriteCharacteristicResponse_Name:
         if (message.isResponse())
           paramsClass = FakeCentral_SetNextWriteCharacteristicResponse_ResponseParams;
         break;
       case kFakeCentral_SetNextSubscribeToNotificationsResponse_Name:
         if (message.isResponse())
           paramsClass = FakeCentral_SetNextSubscribeToNotificationsResponse_ResponseParams;
         break;
+      case kFakeCentral_SetNextUnsubscribeFromNotificationsResponse_Name:
+        if (message.isResponse())
+          paramsClass = FakeCentral_SetNextUnsubscribeFromNotificationsResponse_ResponseParams;
+        break;
+      case kFakeCentral_IsNotifying_Name:
+        if (message.isResponse())
+          paramsClass = FakeCentral_IsNotifying_ResponseParams;
+        break;
       case kFakeCentral_GetLastWrittenCharacteristicValue_Name:
         if (message.isResponse())
           paramsClass = FakeCentral_GetLastWrittenCharacteristicValue_ResponseParams;
         break;
       case kFakeCentral_SetNextReadDescriptorResponse_Name:
         if (message.isResponse())
           paramsClass = FakeCentral_SetNextReadDescriptorResponse_ResponseParams;
         break;
--- a/testing/web-platform/tests/resources/chromium/web-bluetooth-test.js
+++ b/testing/web-platform/tests/resources/chromium/web-bluetooth-test.js
@@ -388,16 +388,40 @@ class FakeRemoteGATTCharacteristic {
   async setNextSubscribeToNotificationsResponse(gatt_code) {
     let {success} =
       await this.fake_central_ptr_.setNextSubscribeToNotificationsResponse(
         gatt_code, ...this.ids_);
 
     if (!success) throw 'setNextSubscribeToNotificationsResponse failed';
   }
 
+  // Sets the next unsubscribe to notifications response for characteristic with
+  // |characteristic_id| in |service_id| and in |peripheral_address| to
+  // |code|. |code| could be a GATT Error Response from BT 4.2 Vol 3 Part F
+  // 3.4.1.1 Error Response or a number outside that range returned by
+  // specific platforms e.g. Android returns 0x101 to signal a GATT failure.
+  async setNextUnsubscribeFromNotificationsResponse(gatt_code) {
+    let {success} =
+      await this.fake_central_ptr_.setNextUnsubscribeFromNotificationsResponse(
+        gatt_code, ...this.ids_);
+
+    if (!success) throw 'setNextUnsubscribeToNotificationsResponse failed';
+  }
+
+  // Returns true if notifications from the characteristic have been subscribed
+  // to.
+  async isNotifying() {
+    let {success, isNotifying} =
+        await this.fake_central_ptr_.isNotifying(...this.ids_);
+
+    if (!success) throw 'isNotifying failed';
+
+    return isNotifying;
+  }
+
   // Gets the last successfully written value to the characteristic.
   // Returns null if no value has yet been written to the characteristic.
   async getLastWrittenValue() {
     let {success, value} =
       await this.fake_central_ptr_.getLastWrittenCharacteristicValue(
           ...this.ids_);
 
     if (!success) throw 'getLastWrittenCharacteristicValue failed';