| Index: third_party/WebKit/LayoutTests/nfc/resources/nfc-helpers.js
|
| diff --git a/third_party/WebKit/LayoutTests/nfc/resources/nfc-helpers.js b/third_party/WebKit/LayoutTests/nfc/resources/nfc-helpers.js
|
| index f9dcca236cb27840b1cf5d32dc95a36fee2c5147..ff8f03ebc150f3917f11acdef311b02fd0f01446 100644
|
| --- a/third_party/WebKit/LayoutTests/nfc/resources/nfc-helpers.js
|
| +++ b/third_party/WebKit/LayoutTests/nfc/resources/nfc-helpers.js
|
| @@ -70,9 +70,8 @@ function createUrlRecord(url) {
|
| function nfc_mocks(mojo) {
|
| return define('NFC mocks', [
|
| 'mojo/public/js/bindings',
|
| - 'mojo/public/js/connection',
|
| 'device/nfc/nfc.mojom',
|
| - ], (bindings, connection, nfc) => {
|
| + ], (bindings, nfc) => {
|
|
|
| function toMojoNFCRecordType(type) {
|
| switch (type) {
|
| @@ -259,6 +258,8 @@ function nfc_mocks(mojo) {
|
|
|
| class MockNFC {
|
| constructor() {
|
| + this.bindingSet = new bindings.BindingSet(nfc.NFC);
|
| +
|
| this.hw_status_ = NFCHWStatus.ENABLED;
|
| this.pushed_message_ = null;
|
| this.push_options_ = null;
|
| @@ -270,7 +271,7 @@ function nfc_mocks(mojo) {
|
| this.watchers_ = [];
|
| }
|
|
|
| - // NFC.stubClass delegate functions
|
| + // NFC delegate functions
|
| push(message, options) {
|
| let error = this.isReady();
|
| if (error)
|
| @@ -338,14 +339,6 @@ function nfc_mocks(mojo) {
|
| return Promise.resolve(createNFCError(null));
|
| }
|
|
|
| -
|
| - // Mock utility functions
|
| - bindToPipe(pipe) {
|
| - this.stub_ = connection.bindHandleToStub(
|
| - pipe, nfc.NFC);
|
| - bindings.StubBindings(this.stub_).delegate = this;
|
| - }
|
| -
|
| isReady() {
|
| if (this.hw_status_ === NFCHWStatus.DISABLED)
|
| return createNFCError(nfc.NFCErrorType.DEVICE_DISABLED);
|
| @@ -408,8 +401,8 @@ function nfc_mocks(mojo) {
|
| let mockNFC = new MockNFC;
|
| mojo.frameInterfaces.addInterfaceOverrideForTesting(
|
| nfc.NFC.name,
|
| - pipe => {
|
| - mockNFC.bindToPipe(pipe);
|
| + handle => {
|
| + mockNFC.bindingSet.addBinding(mockNFC, handle);
|
| });
|
|
|
| return Promise.resolve({
|
|
|