From e348e88e0180673108f2b490b731c27bab717a3a Mon Sep 17 00:00:00 2001 From: Stephen McGruer Date: Tue, 22 Oct 2019 17:48:00 +0000 Subject: [PATCH] Bug 1590079 [wpt PR 19805] - s/NFC/NDEF/g in NFC interfaces and dictionaries, a=testonly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automatic update from web-platform-tests s/NFC/NDEF/g in NFC interfaces and dictionaries (#19805) This CL renames NFCReader to NDEFReader, NFCWriter to NDEFWriter, NFCReadingEvent to NDEFReadingEvent, NFCScanOptions to NDEFScanOptions, NFCPushOptions to NDEFPushOptions, and NFCError to NDEFError as suggested in Web NFC spec at https://github.com/w3c/web-nfc/pull/392 Bug: 520391 Change-Id: Ifc7d26d68b76bbf771a83cba94fc275819c28cfb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1869227 Reviewed-by: Mike West Reviewed-by: Rijubrata Bhaumik Commit-Queue: François Beaufort Cr-Commit-Position: refs/heads/master@{#707736} -- wpt-commits: 9f8e5f67582ccdef98faa436aa5996f2b6ffe207 wpt-pr: 19805 --- .../tests/resources/chromium/nfc-mock.js | 54 +++---- .../NDEFErrorEvent_constructor.https.html | 20 +++ ...FReader-document-hidden-manual.https.html} | 6 +- ...tps.html => NDEFReader_options.https.html} | 48 +++--- ....https.html => NDEFReader_scan.https.html} | 70 ++++----- ...html => NDEFReader_scan_iframe.https.html} | 8 +- ...> NDEFReadingEvent_constructor.https.html} | 26 ++-- ...FWriter-document-hidden-manual.https.html} | 6 +- ....https.html => NDEFWriter_push.https.html} | 138 +++++++++--------- .../NFCErrorEvent_constructor.https.html | 20 --- testing/web-platform/tests/web-nfc/README.md | 2 +- .../tests/web-nfc/idlharness.https.window.js | 8 +- .../tests/web-nfc/nfc_insecure_context.html | 8 +- .../tests/web-nfc/resources/nfc-helpers.js | 18 +-- 14 files changed, 216 insertions(+), 216 deletions(-) create mode 100644 testing/web-platform/tests/web-nfc/NDEFErrorEvent_constructor.https.html rename testing/web-platform/tests/web-nfc/{NFCReader-document-hidden-manual.https.html => NDEFReader-document-hidden-manual.https.html} (80%) rename testing/web-platform/tests/web-nfc/{NFCReader_options.https.html => NDEFReader_options.https.html} (76%) rename testing/web-platform/tests/web-nfc/{NFCReader_scan.https.html => NDEFReader_scan.https.html} (72%) rename testing/web-platform/tests/web-nfc/{NFCReader_scan_iframe.https.html => NDEFReader_scan_iframe.https.html} (86%) rename testing/web-platform/tests/web-nfc/{NFCReadingEvent_constructor.https.html => NDEFReadingEvent_constructor.https.html} (51%) rename testing/web-platform/tests/web-nfc/{NFCWriter-document-hidden-manual.https.html => NDEFWriter-document-hidden-manual.https.html} (79%) rename testing/web-platform/tests/web-nfc/{NFCWriter_push.https.html => NDEFWriter_push.https.html} (80%) delete mode 100644 testing/web-platform/tests/web-nfc/NFCErrorEvent_constructor.https.html diff --git a/testing/web-platform/tests/resources/chromium/nfc-mock.js b/testing/web-platform/tests/resources/chromium/nfc-mock.js index 6ef03b390d8d..d279fcf40d82 100644 --- a/testing/web-platform/tests/resources/chromium/nfc-mock.js +++ b/testing/web-platform/tests/resources/chromium/nfc-mock.js @@ -1,14 +1,14 @@ 'use strict'; -function toMojoNFCPushTarget(target) { +function toMojoNDEFPushTarget(target) { switch (target) { case 'peer': - return device.mojom.NFCPushTarget.PEER; + return device.mojom.NDEFPushTarget.PEER; case 'tag': - return device.mojom.NFCPushTarget.TAG; + return device.mojom.NDEFPushTarget.TAG; } - return device.mojom.NFCPushTarget.ANY; + return device.mojom.NDEFPushTarget.ANY; } // Converts between NDEFMessageInit https://w3c.github.io/web-nfc/#dom-ndefmessage @@ -65,9 +65,9 @@ function compareNDEFRecords(providedRecord, receivedRecord) { new Uint8Array(receivedRecord.data)); } -// Compares NFCPushOptions structures that were provided to API and +// Compares NDEFPushOptions structures that were provided to API and // received by the mock mojo service. -function assertNFCPushOptionsEqual(provided, received) { +function assertNDEFPushOptionsEqual(provided, received) { if (provided.ignoreRead !== undefined) assert_equals(provided.ignoreRead, !!received.ignoreRead); else @@ -79,14 +79,14 @@ function assertNFCPushOptionsEqual(provided, received) { assert_equals(received.timeout, Infinity); if (provided.target !== undefined) - assert_equals(toMojoNFCPushTarget(provided.target), received.target); + assert_equals(toMojoNDEFPushTarget(provided.target), received.target); else - assert_equals(received.target, device.mojom.NFCPushTarget.ANY); + assert_equals(received.target, device.mojom.NDEFPushTarget.ANY); } -// Compares NFCReaderOptions structures that were provided to API and +// Compares NDEFReaderOptions structures that were provided to API and // received by the mock mojo service. -function assertNFCReaderOptionsEqual(provided, received) { +function assertNDEFReaderOptionsEqual(provided, received) { if (provided.url !== undefined) assert_equals(provided.url, received.url); else @@ -103,7 +103,7 @@ function assertNFCReaderOptionsEqual(provided, received) { } } -// Checks whether NFCReaderOptions are matched with given message. +// Checks whether NDEFReaderOptions are matched with given message. function matchesWatchOptions(message, options) { // Filter by Web NFC id. if (!matchesWebNfcId(message.url, options.url)) return false; @@ -150,9 +150,9 @@ function matchesWebNfcId(id, pattern) { return true; } -function createNFCError(type) { +function createNDEFError(type) { return { error: type ? - new device.mojom.NFCError({ errorType: type }) : null }; + new device.mojom.NDEFError({ errorType: type }) : null }; } var WebNFCTest = (() => { @@ -201,21 +201,21 @@ var WebNFCTest = (() => { // Resolve with TimeoutError, else pend push operation. if (this.push_should_timeout_) { resolve( - createNFCError(device.mojom.NFCErrorType.TIMER_EXPIRED)); + createNDEFError(device.mojom.NDEFErrorType.TIMER_EXPIRED)); } } else { - resolve(createNFCError(null)); + resolve(createNDEFError(null)); } }); } async cancelPush(target) { - if (this.push_options_ && ((target === device.mojom.NFCPushTarget.ANY) || + if (this.push_options_ && ((target === device.mojom.NDEFPushTarget.ANY) || (this.push_options_.target === target))) { this.cancelPendingPushOperation(); } - return createNFCError(null); + return createNDEFError(null); } setClient(client) { @@ -241,33 +241,33 @@ var WebNFCTest = (() => { } } - return createNFCError(null); + return createNDEFError(null); } async cancelWatch(id) { let index = this.watchers_.findIndex(value => value.id === id); if (index === -1) { - return createNFCError(device.mojom.NFCErrorType.NOT_FOUND); + return createNDEFError(device.mojom.NDEFErrorType.NOT_FOUND); } this.watchers_.splice(index, 1); - return createNFCError(null); + return createNDEFError(null); } async cancelAllWatches() { if (this.watchers_.length === 0) { - return createNFCError(device.mojom.NFCErrorType.NOT_FOUND); + return createNDEFError(device.mojom.NDEFErrorType.NOT_FOUND); } this.watchers_.splice(0, this.watchers_.length); - return createNFCError(null); + return createNDEFError(null); } getHWError() { if (this.hw_status_ === NFCHWStatus.DISABLED) - return createNFCError(device.mojom.NFCErrorType.NOT_READABLE); + return createNDEFError(device.mojom.NDEFErrorType.NOT_READABLE); if (this.hw_status_ === NFCHWStatus.NOT_SUPPORTED) - return createNFCError(device.mojom.NFCErrorType.NOT_SUPPORTED); + return createNDEFError(device.mojom.NDEFErrorType.NOT_SUPPORTED); return null; } @@ -306,7 +306,7 @@ var WebNFCTest = (() => { cancelPendingPushOperation() { if (this.pending_promise_func_) { this.pending_promise_func_( - createNFCError(device.mojom.NFCErrorType.OPERATION_CANCELLED)); + createNDEFError(device.mojom.NDEFErrorType.OPERATION_CANCELLED)); } this.pushed_message_ = null; @@ -321,7 +321,7 @@ var WebNFCTest = (() => { this.reading_messages_.push(message); // Ignore reading if NFC operation is suspended. if(this.operations_suspended_) return; - // Ignore reading if NFCPushOptions.ignoreRead is true. + // Ignore reading if NDEFPushOptions.ignoreRead is true. if(this.push_options_ && this.push_options_.ignoreRead) return; // Triggers onWatch if the new message matches existing watchers. @@ -359,7 +359,7 @@ var WebNFCTest = (() => { } // Resumes pending push operation. if (this.pending_promise_func_) { - this.pending_promise_func_(createNFCError(null)); + this.pending_promise_func_(createNDEFError(null)); } } } diff --git a/testing/web-platform/tests/web-nfc/NDEFErrorEvent_constructor.https.html b/testing/web-platform/tests/web-nfc/NDEFErrorEvent_constructor.https.html new file mode 100644 index 000000000000..243893620c64 --- /dev/null +++ b/testing/web-platform/tests/web-nfc/NDEFErrorEvent_constructor.https.html @@ -0,0 +1,20 @@ + +NDEFErrorEvent constructor + + + + diff --git a/testing/web-platform/tests/web-nfc/NFCReader-document-hidden-manual.https.html b/testing/web-platform/tests/web-nfc/NDEFReader-document-hidden-manual.https.html similarity index 80% rename from testing/web-platform/tests/web-nfc/NFCReader-document-hidden-manual.https.html rename to testing/web-platform/tests/web-nfc/NDEFReader-document-hidden-manual.https.html index 6d9a52c1ecf5..868cf1a968be 100644 --- a/testing/web-platform/tests/web-nfc/NFCReader-document-hidden-manual.https.html +++ b/testing/web-platform/tests/web-nfc/NDEFReader-document-hidden-manual.https.html @@ -1,14 +1,14 @@ -NFCReader.onreading respect page visibility changes +NDEFReader.onreading respect page visibility changes diff --git a/testing/web-platform/tests/web-nfc/NFCReader_options.https.html b/testing/web-platform/tests/web-nfc/NDEFReader_options.https.html similarity index 76% rename from testing/web-platform/tests/web-nfc/NFCReader_options.https.html rename to testing/web-platform/tests/web-nfc/NDEFReader_options.https.html index 5761747f907f..b9015dc2a57a 100644 --- a/testing/web-platform/tests/web-nfc/NFCReader_options.https.html +++ b/testing/web-platform/tests/web-nfc/NDEFReader_options.https.html @@ -1,6 +1,6 @@ -Web NFC: NFCReader option tests +Web NFC: NDEFReader option tests @@ -10,45 +10,45 @@ 'use strict'; -const NFCReaderOptionTests = +const NDEFReaderOptionTests = [ { - desc: "Test that reading data succeed when NFCScanOptions'" + + desc: "Test that reading data succeed when NDEFScanOptions'" + " recordType is set to 'empty'.", scanOptions: {recordType: "empty"}, unmatchedScanOptions: {recordType: "json"}, message: createMessage([createRecord('empty', '')]) }, { - desc: "Test that reading data succeed when NFCScanOptions'" + + desc: "Test that reading data succeed when NDEFScanOptions'" + " recordType is set to 'json'.", scanOptions: {recordType: "json"}, unmatchedScanOptions: {recordType: "url"}, message: createMessage([createJsonRecord(test_json_data)]) }, { - desc: "Test that reading data succeed when NFCScanOptions'" + + desc: "Test that reading data succeed when NDEFScanOptions'" + " recordType is set to 'opaque'.", scanOptions: {recordType: "opaque"}, unmatchedScanOptions: {recordType: "json"}, message: createMessage([createOpaqueRecord(test_buffer_data)]) }, { - desc: "Test that reading data succeed when NFCScanOptions'" + + desc: "Test that reading data succeed when NDEFScanOptions'" + " recordType is set to 'text'.", scanOptions: {recordType: "text"}, unmatchedScanOptions: {recordType: "json"}, message: createMessage([createTextRecord(test_text_data)]) }, { - desc: "Test that reading data succeed when NFCScanOptions'" + + desc: "Test that reading data succeed when NDEFScanOptions'" + " recordType is set to 'url'.", scanOptions: {recordType: "url"}, unmatchedScanOptions: {recordType: "json"}, message: createMessage([createUrlRecord(test_url_data)]) }, { - desc: "Test that reading data succeed when NFCScanOptions'" + + desc: "Test that reading data succeed when NDEFScanOptions'" + " recordType is set to a custom type for external type records.", scanOptions: {recordType: "w3.org:xyz"}, unmatchedScanOptions: {recordType: "opaque"}, @@ -56,7 +56,7 @@ const NFCReaderOptionTests = test_buffer_data)]) }, { - desc: "Test that the url of NFCScanOptions filters relevant data" + + desc: "Test that the url of NDEFScanOptions filters relevant data" + " sources correctly.", scanOptions: {url: `${location.origin}/custom/path`}, unmatchedScanOptions: {url: `${location.origin}/custom/invalid`}, @@ -64,7 +64,7 @@ const NFCReaderOptionTests = records: [createTextRecord(test_text_data)]} }, { - desc: "Test that the mediaType of NFCScanOptions filters relevant data" + + desc: "Test that the mediaType of NDEFScanOptions filters relevant data" + " sources correctly.", scanOptions: {mediaType: "application/octet-stream"}, unmatchedScanOptions: {mediaType: "application/json"}, @@ -76,42 +76,42 @@ const ReadMultiMessagesTests = [ { desc: "Test that filtering 'empty' record from different messages" + - " correctly with NFCScanOptions' recordType is set to 'empty'.", + " correctly with NDEFScanOptions' recordType is set to 'empty'.", scanOptions: {recordType: "empty"}, message: createMessage([createRecord('empty', '')]), unmatchedMessage: createMessage([createJsonRecord(test_json_data)]), }, { desc: "Test that filtering 'json' record from different messages" + - " correctly with NFCScanOptions' recordType is set to 'json'.", + " correctly with NDEFScanOptions' recordType is set to 'json'.", scanOptions: {recordType: "json"}, message: createMessage([createJsonRecord(test_json_data)]), unmatchedMessage: createMessage([createUrlRecord(test_url_data)]) }, { desc: "Test that filtering 'opaque' record from different messages" + - " correctly with NFCScanOptions' recordType is set to 'opaque'.", + " correctly with NDEFScanOptions' recordType is set to 'opaque'.", scanOptions: {recordType: "opaque"}, message: createMessage([createOpaqueRecord(test_buffer_data)]), unmatchedMessage: createMessage([createJsonRecord(test_json_data)]) }, { desc: "Test that filtering 'text' record from different messages" + - " correctly with NFCScanOptions' recordType is set to 'text'.", + " correctly with NDEFScanOptions' recordType is set to 'text'.", scanOptions: {recordType: "text"}, message: createMessage([createTextRecord(test_text_data)]), unmatchedMessage: createMessage([createUrlRecord(test_url_data)]) }, { desc: "Test that filtering 'url' record from different messages" + - " correctly with NFCScanOptions' recordType is set to 'url'.", + " correctly with NDEFScanOptions' recordType is set to 'url'.", scanOptions: {recordType: "url"}, message: createMessage([createUrlRecord(test_url_data)]), unmatchedMessage: createMessage([createTextRecord(test_text_data)]) }, { desc: "Test that filtering external record from different messages" + - " correctly with NFCScanOptions' recordType is set to the custom type.", + " correctly with NDEFScanOptions' recordType is set to the custom type.", scanOptions: {recordType: "w3.org:xyz"}, message: createMessage([createRecord('w3.org:xyz', 'application/octet-stream', test_buffer_data)]), @@ -119,7 +119,7 @@ const ReadMultiMessagesTests = }, { desc: "Test that filtering 'text' record from different messages" + - " correctly with NFCScanOptions' url set.", + " correctly with NDEFScanOptions' url set.", scanOptions: {url: `${location.origin}/custom/path`}, message: {url: `${location.origin}/custom/path/update`, records: [createTextRecord(test_text_data)]}, @@ -128,19 +128,19 @@ const ReadMultiMessagesTests = }, { desc: "Test that filtering 'opaque' record from different messages" + - " correctly with NFCScanOptions' mediaType set.", + " correctly with NDEFScanOptions' mediaType set.", scanOptions: {mediaType: "application/octet-stream"}, message: createMessage([createOpaqueRecord(test_buffer_data)]), unmatchedMessage: createMessage([createJsonRecord(test_json_data)]) } ]; -for (let NFCReaderOptionTest of NFCReaderOptionTests) { - testNFCScanOptions( - NFCReaderOptionTest.message, - NFCReaderOptionTest.scanOptions, - NFCReaderOptionTest.unmatchedScanOptions, - NFCReaderOptionTest.desc +for (let NDEFReaderOptionTest of NDEFReaderOptionTests) { + testNDEFScanOptions( + NDEFReaderOptionTest.message, + NDEFReaderOptionTest.scanOptions, + NDEFReaderOptionTest.unmatchedScanOptions, + NDEFReaderOptionTest.desc ); } diff --git a/testing/web-platform/tests/web-nfc/NFCReader_scan.https.html b/testing/web-platform/tests/web-nfc/NDEFReader_scan.https.html similarity index 72% rename from testing/web-platform/tests/web-nfc/NFCReader_scan.https.html rename to testing/web-platform/tests/web-nfc/NDEFReader_scan.https.html index 638d0c5a1d1b..0a3610099486 100644 --- a/testing/web-platform/tests/web-nfc/NFCReader_scan.https.html +++ b/testing/web-platform/tests/web-nfc/NDEFReader_scan.https.html @@ -1,6 +1,6 @@ -Web NFC: NFCReader.scan tests +Web NFC: NDEFReader.scan tests @@ -21,128 +21,128 @@ const invalid_signals = [ ]; function waitSyntaxErrorPromise(t, scan_options) { - const reader = new NFCReader(); + const reader = new NDEFReader(); const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); const promise = readerWatcher.wait_for("error").then(event => { assert_equals(event.error.name, 'SyntaxError'); }); - // NFCReader#scan() asynchronously dispatches the syntax error event. + // NDEFReader#scan() asynchronously dispatches the syntax error event. reader.scan(scan_options); return promise; } promise_test(async t => { await waitSyntaxErrorPromise(t, {url: "www.a.com"}); -}, "Test that NFCReader.scan fails if NFCScanOptions.url is missing \ +}, "Test that NDEFReader.scan fails if NDEFScanOptions.url is missing \ components."); promise_test(async t => { await waitSyntaxErrorPromise(t, {url: "invalid"}); -}, "Test that NFCReader.scan fails if NFCScanOptions.url is invalid."); +}, "Test that NDEFReader.scan fails if NDEFScanOptions.url is invalid."); promise_test(async t => { await waitSyntaxErrorPromise(t, {url: "http://a.com"}); -}, "Test that NFCReader.scan fails if NFCScanOptions.url has wrong \ +}, "Test that NDEFReader.scan fails if NDEFScanOptions.url has wrong \ protocol."); nfc_test(async (t, mockNFC) => { - const reader = new NFCReader(); + const reader = new NDEFReader(); const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); reader.scan(); mockNFC.setHWStatus(NFCHWStatus.DISABLED); const event = await readerWatcher.wait_for("error"); assert_equals(event.error.name, 'NotReadableError'); -}, "NFCReader.scan should fail if NFC HW is disabled."); +}, "NDEFReader.scan should fail if NFC HW is disabled."); nfc_test(async (t, mockNFC) => { - const reader = new NFCReader(); + const reader = new NDEFReader(); const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); reader.scan(); mockNFC.setHWStatus(NFCHWStatus.NOT_SUPPORTED); const event = await readerWatcher.wait_for("error"); assert_equals(event.error.name, 'NotSupportedError'); -}, "NFCReader.scan should fail if NFC HW is not supported."); +}, "NDEFReader.scan should fail if NFC HW is not supported."); nfc_test(async (t, mockNFC) => { - const reader = new NFCReader(); + const reader = new NDEFReader(); const controller = new AbortController(); const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)])); const promise = readerWatcher.wait_for("reading").then(event => { - assert_true(event instanceof NFCReadingEvent); + assert_true(event instanceof NDEFReadingEvent); controller.abort(); }); - // NFCReader#scan() asynchronously dispatches the reading event. + // NDEFReader#scan() asynchronously dispatches the reading event. reader.scan({signal : controller.signal}); await promise; }, "Test that nfc watch success if NFC HW is enabled."); nfc_test(async (t, mockNFC) => { - const reader = new NFCReader(); + const reader = new NDEFReader(); const controller = new AbortController(); const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)])); const promise = readerWatcher.wait_for("reading").then(event => { - assert_true(event instanceof NFCReadingEvent); + assert_true(event instanceof NDEFReadingEvent); controller.abort(); }); - // NFCReader#scan() asynchronously dispatches the reading event. + // NDEFReader#scan() asynchronously dispatches the reading event. reader.scan({signal : controller.signal, url: "https://a.com"}); await promise; -}, "Test that NFCReader.scan succeeds if NFCScanOptions.url is valid URL."); +}, "Test that NDEFReader.scan succeeds if NDEFScanOptions.url is valid URL."); nfc_test(async (t, mockNFC) => { - const reader = new NFCReader(); + const reader = new NDEFReader(); const controller = new AbortController(); const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)])); const promise = readerWatcher.wait_for("reading").then(event => { - assert_true(event instanceof NFCReadingEvent); + assert_true(event instanceof NDEFReadingEvent); controller.abort(); }); - // NFCReader#scan() asynchronously dispatches the reading event. + // NDEFReader#scan() asynchronously dispatches the reading event. reader.scan({signal : controller.signal, url: "https://a.com/*"}); await promise; -}, "Test that NFCReader.scan succeeds if NFCScanOptions.url is valid URL \ +}, "Test that NDEFReader.scan succeeds if NDEFScanOptions.url is valid URL \ with '*' wildcard character in path."); nfc_test(async (t, mockNFC) => { - const reader = new NFCReader(); + const reader = new NDEFReader(); const controller = new AbortController(); const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)])); const promise = readerWatcher.wait_for("reading").then(event => { - assert_true(event instanceof NFCReadingEvent); + assert_true(event instanceof NDEFReadingEvent); controller.abort(); }); - // NFCReader#scan() asynchronously dispatches the reading event. + // NDEFReader#scan() asynchronously dispatches the reading event. reader.scan({signal : controller.signal, url: "https://a.com/*/bar"}); await promise; -}, "Test that NFCReader.scan succeeds if NFCScanOptions.url is valid URL \ +}, "Test that NDEFReader.scan succeeds if NDEFScanOptions.url is valid URL \ with '*' wildcard character in the beginning of path component followed by \ subpath."); nfc_test(async (t, mockNFC) => { - const reader = new NFCReader(); + const reader = new NDEFReader(); const controller = new AbortController(); const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)])); const promise = readerWatcher.wait_for("reading").then(event => { - assert_true(event instanceof NFCReadingEvent); + assert_true(event instanceof NDEFReadingEvent); controller.abort(); }); - // NFCReader#scan() asynchronously dispatches the reading event. + // NDEFReader#scan() asynchronously dispatches the reading event. reader.scan({signal : controller.signal, url: ""}); await promise; -}, "Test that NFCReader.scan succeeds if NFCScanOptions.url is empty."); +}, "Test that NDEFReader.scan succeeds if NDEFScanOptions.url is empty."); nfc_test(async (t, mockNFC) => { - const reader = new NFCReader(); + const reader = new NDEFReader(); const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)])); @@ -157,11 +157,11 @@ nfc_test(async (t, mockNFC) => { t.step_timeout(resolve, 100); }); -}, "Test that NFCReader.onreading should not be fired if NFCScanOptions.signal \ +}, "Test that NDEFReader.onreading should not be fired if NDEFScanOptions.signal \ is aborted."); nfc_test(async (t, mockNFC) => { - const reader = new NFCReader(); + const reader = new NDEFReader(); const controller = new AbortController(); const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); const message = createMessage([createTextRecord(test_text_data)]); @@ -170,7 +170,7 @@ nfc_test(async (t, mockNFC) => { reader.scan({signal: controller.signal}); const event = await readerWatcher.wait_for("reading"); - assert_true(event instanceof NFCReadingEvent); + assert_true(event instanceof NDEFReadingEvent); mockNFC.setReadingMessage(message); controller.abort(); @@ -184,11 +184,11 @@ nfc_test(async (t, mockNFC) => { }, "Synchronously signaled abort."); test(() => { - const reader = new NFCReader(); + const reader = new NDEFReader(); invalid_signals.forEach(invalid_signal => { assert_throws(new TypeError(), () => { reader.scan({ signal: invalid_signal }); }); }); -}, "NFCReader.scan should fail if signal is not an AbortSignal."); +}, "NDEFReader.scan should fail if signal is not an AbortSignal."); diff --git a/testing/web-platform/tests/web-nfc/NFCReader_scan_iframe.https.html b/testing/web-platform/tests/web-nfc/NDEFReader_scan_iframe.https.html similarity index 86% rename from testing/web-platform/tests/web-nfc/NFCReader_scan_iframe.https.html rename to testing/web-platform/tests/web-nfc/NDEFReader_scan_iframe.https.html index 31e79b0388aa..e9720e98ef65 100644 --- a/testing/web-platform/tests/web-nfc/NFCReader_scan_iframe.https.html +++ b/testing/web-platform/tests/web-nfc/NDEFReader_scan_iframe.https.html @@ -1,6 +1,6 @@ -NFCWriter.scan with an focused iframe +NDEFWriter.scan with an focused iframe @@ -9,12 +9,12 @@ \ No newline at end of file diff --git a/testing/web-platform/tests/web-nfc/NFCReadingEvent_constructor.https.html b/testing/web-platform/tests/web-nfc/NDEFReadingEvent_constructor.https.html similarity index 51% rename from testing/web-platform/tests/web-nfc/NFCReadingEvent_constructor.https.html rename to testing/web-platform/tests/web-nfc/NDEFReadingEvent_constructor.https.html index 20585176b7f8..c23a68a2f79e 100644 --- a/testing/web-platform/tests/web-nfc/NFCReadingEvent_constructor.https.html +++ b/testing/web-platform/tests/web-nfc/NDEFReadingEvent_constructor.https.html @@ -1,40 +1,40 @@ -NFCReadingEvent constructor - +NDEFReadingEvent constructor + diff --git a/testing/web-platform/tests/web-nfc/NFCWriter-document-hidden-manual.https.html b/testing/web-platform/tests/web-nfc/NDEFWriter-document-hidden-manual.https.html similarity index 79% rename from testing/web-platform/tests/web-nfc/NFCWriter-document-hidden-manual.https.html rename to testing/web-platform/tests/web-nfc/NDEFWriter-document-hidden-manual.https.html index 72d8c8143cd9..2f291e51412f 100644 --- a/testing/web-platform/tests/web-nfc/NFCWriter-document-hidden-manual.https.html +++ b/testing/web-platform/tests/web-nfc/NDEFWriter-document-hidden-manual.https.html @@ -1,7 +1,7 @@ -NFCWriter.push respect page visibility changes +NDEFWriter.push respect page visibility changes @@ -9,7 +9,7 @@ diff --git a/testing/web-platform/tests/web-nfc/NFCWriter_push.https.html b/testing/web-platform/tests/web-nfc/NDEFWriter_push.https.html similarity index 80% rename from testing/web-platform/tests/web-nfc/NFCWriter_push.https.html rename to testing/web-platform/tests/web-nfc/NDEFWriter_push.https.html index 6b4034fccc29..b909bee3171d 100644 --- a/testing/web-platform/tests/web-nfc/NFCWriter_push.https.html +++ b/testing/web-platform/tests/web-nfc/NDEFWriter_push.https.html @@ -1,6 +1,6 @@ -Web NFC: NFCWriter.push Tests +Web NFC: NDEFWriter.push Tests @@ -92,7 +92,7 @@ const invalid_signals = [ ]; promise_test(async t => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); const promises = []; invalid_type_messages.forEach(message => { promises.push( @@ -102,7 +102,7 @@ promise_test(async t => { }, "Test that promise is rejected with TypeError if NDEFMessageSource is invalid."); promise_test(async t => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); const promises = []; invalid_syntax_messages.forEach(message => { promises.push( @@ -113,7 +113,7 @@ promise_test(async t => { invalid records."); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); const controller = new AbortController(); //Make sure push is pending @@ -131,31 +131,31 @@ nfc_test(async (t, mockNFC) => { }); await rejected; assert_true(callback_called, 'timeout should have caused the abort'); -}, "NFCWriter.push should fail if abort push request before push happends."); +}, "NDEFWriter.push should fail if abort push request before push happends."); promise_test(async t => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); const controller = new AbortController(); assert_false(controller.signal.aborted); controller.abort(); assert_true(controller.signal.aborted); await promise_rejects(t, 'AbortError', writer.push(test_text_data, { signal: controller.signal })); -}, "NFCWriter.push should fail if signal's aborted flag is set."); +}, "NDEFWriter.push should fail if signal's aborted flag is set."); promise_test(async t => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); const promises = []; invalid_signals.forEach(invalid_signal => { promises.push(promise_rejects(t, new TypeError(), writer.push(test_text_data, { signal: invalid_signal }))); }); await Promise.all(promises); -}, "NFCWriter.push should fail if signal is not an AbortSignal."); +}, "NDEFWriter.push should fail if signal is not an AbortSignal."); nfc_test(async (t, mockNFC) => { - const writer1 = new NFCWriter(); - const writer2 = new NFCWriter(); + const writer1 = new NDEFWriter(); + const writer2 = new NDEFWriter(); const controller = new AbortController(); mockNFC.setPendingPushCompleted(false); const p1 = writer1.push(test_text_data, @@ -171,47 +171,47 @@ nfc_test(async (t, mockNFC) => { }, "Synchronously signaled abort."); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); mockNFC.setHWStatus(NFCHWStatus.DISABLED); await promise_rejects(t, 'NotReadableError', writer.push(test_text_data)); -}, "NFCWriter.push should fail when NFC HW is disabled."); +}, "NDEFWriter.push should fail when NFC HW is disabled."); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); mockNFC.setHWStatus(NFCHWStatus.NOT_SUPPORTED); await promise_rejects(t, 'NotSupportedError', writer.push(test_text_data)); -}, "NFCWriter.push should fail when NFC HW is not supported."); +}, "NDEFWriter.push should fail when NFC HW is not supported."); promise_test(async t => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await promise_rejects( t, new TypeError(), writer.push(test_text_data, { timeout: "invalid"})); -}, "NFCWriter.push should fail with TypeError when invalid timeout is \ +}, "NDEFWriter.push should fail with TypeError when invalid timeout is \ provided."); promise_test(async t => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await promise_rejects( t, new TypeError(), writer.push(test_text_data, { timeout: -1 })); -}, "NFCWriter.push should fail with TypeError when invalid negative timeout \ +}, "NDEFWriter.push should fail with TypeError when invalid negative timeout \ value is provided."); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); mockNFC.setPendingPushCompleted(false); const p = writer.push(test_text_data, { timeout: 1 }); mockNFC.setPushShouldTimeout(true); await promise_rejects(t, 'TimeoutError', p); -}, "NFCWriter.push should fail with TimeoutError when timer expires."); +}, "NDEFWriter.push should fail with TimeoutError when timer expires."); promise_test(async t => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await promise_rejects( t, 'NotSupportedError', writer.push(new ArrayBuffer(32 * 1024 + 1))); }, "Reject promise with NotSupportedError if NFC message size exceeds 32KB."); promise_test(async t => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); const message = createMessage([createTextRecord(test_text_data)]); message.url = '%00/invalid/ path'; await promise_rejects(t, 'SyntaxError', writer.push(message)); @@ -219,17 +219,17 @@ promise_test(async t => { provided URL."); promise_test(async t => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); const message = createMessage([createRecord('json','application/json', { get x(){ return this; } })]); await promise_rejects(t, new TypeError(), writer.push(message)); }, "Reject promise with exceptions thrown from serializing the 'json' record data."); promise_test(async t => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await promise_rejects( t, new TypeError(), writer.push(test_text_data, {target: "invalid"})); -}, "NFCWriter.push should fail with TypeError when invalid target value is \ +}, "NDEFWriter.push should fail with TypeError when invalid target value is \ provided."); promise_test(async () => { @@ -249,7 +249,7 @@ promise_test(async () => { } }; try { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); writer.push("Test").then(onSuccess, onError); } catch(e) { parent.postMessage("Failure", "*"); @@ -270,12 +270,12 @@ promise_test(async () => { }, 'Test that WebNFC API is not accessible from iframe context.'); nfc_test(async () => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await writer.push(test_text_data, { timeout: 1 }); -}, 'NFCWriter.push should succeed when NFC HW is enabled'); +}, 'NDEFWriter.push should succeed when NFC HW is enabled'); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); let message = createMessage([createTextRecord(test_text_data), createJsonRecord(test_json_data), createJsonRecord(test_number_data), @@ -285,42 +285,42 @@ nfc_test(async (t, mockNFC) => { test_message_origin); await writer.push(message); assertNDEFMessagesEqual(message, mockNFC.pushedMessage()); -}, "NFCWriter.push NDEFMessage containing text, json, opaque, url and external records \ -with default NFCPushOptions."); +}, "NDEFWriter.push NDEFMessage containing text, json, opaque, url and external records \ +with default NDEFPushOptions."); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await writer.push(test_text_data); assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage()); -}, "Test that NFCWriter.push succeeds when message is DOMString."); +}, "Test that NDEFWriter.push succeeds when message is DOMString."); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await writer.push(test_buffer_data); assertNDEFMessagesEqual(test_buffer_data, mockNFC.pushedMessage()); -}, "Test that NFCWriter.push succeeds when message is ArrayBuffer."); +}, "Test that NDEFWriter.push succeeds when message is ArrayBuffer."); nfc_test(async () => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await writer.push(createMessage([createRecord('empty')])); -}, "NFCWriter.push with 'empty' record should succeed."); +}, "NDEFWriter.push with 'empty' record should succeed."); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await writer.push(test_text_data); - assertNFCPushOptionsEqual(createNFCPushOptions('any', Infinity, true), + assertNDEFPushOptionsEqual(createNDEFPushOptions('any', Infinity, true), mockNFC.pushOptions()); -}, "Check that default NFCPushOptions values are correctly set."); +}, "Check that default NDEFPushOptions values are correctly set."); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); - let nfcPushOptions = createNFCPushOptions('tag', 1, false); - await writer.push(test_text_data, nfcPushOptions); - assertNFCPushOptionsEqual(nfcPushOptions, mockNFC.pushOptions()); -}, "Check that provided NFCPushOptions values are correctly converted."); + const writer = new NDEFWriter(); + let ndefPushOptions = createNDEFPushOptions('tag', 1, false); + await writer.push(test_text_data, ndefPushOptions); + assertNDEFPushOptionsEqual(ndefPushOptions, mockNFC.pushOptions()); +}, "Check that provided NDEFPushOptions values are correctly converted."); nfc_test(async (t, mockNFC) => { - const reader = new NFCReader(); + const reader = new NDEFReader(); const message = createMessage([createTextRecord(test_text_data)]); const controller = new AbortController(); const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); @@ -331,34 +331,34 @@ nfc_test(async (t, mockNFC) => { reader.scan({ signal: controller.signal }); - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await writer.push(test_text_data, { ignoreRead: false }); mockNFC.setReadingMessage(message); assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage()); await promise; -}, "NFCWriter.push should read data when ignoreRead is false."); +}, "NDEFWriter.push should read data when ignoreRead is false."); nfc_test(async (t, mockNFC) => { - const reader = new NFCReader(); + const reader = new NDEFReader(); const message = createMessage([createTextRecord(test_text_data)]); - // Ignore reading if NFCPushOptions.ignoreRead is true + // Ignore reading if NDEFPushOptions.ignoreRead is true reader.onreading = t.unreached_func("reading event should not be fired."); reader.scan(); - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await writer.push(test_text_data, { ignoreRead: true }); mockNFC.setReadingMessage(message); assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage()); -}, "NFCWriter.push should ignore reading data when ignoreRead is true."); +}, "NDEFWriter.push should ignore reading data when ignoreRead is true."); nfc_test(async (t, mockNFC) => { - const writer1 = new NFCWriter(); - const writer2 = new NFCWriter(); + const writer1 = new NDEFWriter(); + const writer2 = new NDEFWriter(); - const nfcPushOptions1 = createNFCPushOptions('tag', 1000, false); - const nfcPushOptions2 = createNFCPushOptions('tag', Infinity, true); - const p1 = writer1.push(test_text_data, nfcPushOptions1); - const p2 = writer2.push(test_url_data, nfcPushOptions2); + const ndefPushOptions1 = createNDEFPushOptions('tag', 1000, false); + const ndefPushOptions2 = createNDEFPushOptions('tag', Infinity, true); + const p1 = writer1.push(test_text_data, ndefPushOptions1); + const p2 = writer2.push(test_url_data, ndefPushOptions2); await new Promise((resolve, reject) => { // Make first push pending @@ -371,29 +371,29 @@ nfc_test(async (t, mockNFC) => { }); p2.then(() => { assertNDEFMessagesEqual(test_url_data, mockNFC.pushedMessage()); - assertNFCPushOptionsEqual(nfcPushOptions2, mockNFC.pushOptions()); + assertNDEFPushOptionsEqual(ndefPushOptions2, mockNFC.pushOptions()); assert_equals(err, "AbortError", "the pending push should be aborted"); resolve(); }); }); -}, "NFCWriter.push should replace all previously configured push operations."); +}, "NDEFWriter.push should replace all previously configured push operations."); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await writer.push({ records: [{ data: test_text_data}] }); assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage()); }, "Test that recordType should be set to 'text' if NDEFRecordInit.record's \ recordType is undefined and NDEFRecordInit.record's data is DOMString."); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await writer.push({ records: [{ data: test_buffer_data}] }); assertNDEFMessagesEqual(test_buffer_data, mockNFC.pushedMessage()); }, "Test that recordType should be set to 'opaque' if NDEFRecordInit.record's \ recordType is undefined and NDEFRecordInit.record's data is ArrayBuffer."); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await writer.push({ records: [{ data: test_json_data }] }); const message = createMessage([createJsonRecord(test_json_data)]); assertNDEFMessagesEqual(message, mockNFC.pushedMessage()); @@ -402,14 +402,14 @@ recordType is undefined and NDEFRecordInit.record's data is not DOMString or \ ArrayBuffer."); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await writer.push({ records: [{ recordType: "text", data: test_text_data }] }); assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage()); }, "Test that mediaType should be set to 'text/plain' if NDEFRecordInit.record's \ recordType is 'text' and NDEFRecordInit.record's mediaType is undefined."); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await writer.push({ records: [{ recordType: "opaque", data: test_buffer_data }] }); assertNDEFMessagesEqual(test_buffer_data, mockNFC.pushedMessage()); }, "Test that mediaType should be set to 'application/octet-stream' if \ @@ -417,7 +417,7 @@ NDEFRecordInit.record's recordType is 'opaque' and NDEFRecordInit.record's \ mediaType is undefined."); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await writer.push({ records: [{ recordType: "json", data: test_json_data }] }); const message = createMessage([createJsonRecord(test_json_data)]); assertNDEFMessagesEqual(message, mockNFC.pushedMessage()); @@ -426,7 +426,7 @@ NDEFRecordInit.record's recordType is 'json' and NDEFRecordInit.record's \ mediaType is undefined."); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await writer.push({ records: [{ recordType: "url", data: test_url_data }] }); const message = createMessage([createUrlRecord(test_url_data)]); assertNDEFMessagesEqual(message, mockNFC.pushedMessage()); @@ -434,7 +434,7 @@ nfc_test(async (t, mockNFC) => { recordType is 'url' and NDEFRecordInit.record's mediaType is undefined."); nfc_test(async (t, mockNFC) => { - const writer = new NFCWriter(); + const writer = new NDEFWriter(); await writer.push({ records: [{ recordType: "w3.org:xyz", data: test_buffer_data }] }); const message = createMessage([createRecord('w3.org:xyz', 'application/octet-stream', test_buffer_data)]); diff --git a/testing/web-platform/tests/web-nfc/NFCErrorEvent_constructor.https.html b/testing/web-platform/tests/web-nfc/NFCErrorEvent_constructor.https.html deleted file mode 100644 index 1cc9ce160be4..000000000000 --- a/testing/web-platform/tests/web-nfc/NFCErrorEvent_constructor.https.html +++ /dev/null @@ -1,20 +0,0 @@ - -NFCErrorEvent constructor - - - - diff --git a/testing/web-platform/tests/web-nfc/README.md b/testing/web-platform/tests/web-nfc/README.md index dd072174e056..87145b0e3ec0 100644 --- a/testing/web-platform/tests/web-nfc/README.md +++ b/testing/web-platform/tests/web-nfc/README.md @@ -16,7 +16,7 @@ The `WebNFCTest` interface is defined as: setPendingPushCompleted(boolean result); // Sets if the pending push is completed. setPushShouldTimeout(boolean result); // Sets flag to trigger the pending push to timeout. pushedMessage(); // Gets the pushed `NDEFMessageSource`. - pushOptions(); // Gets the pushed `NFCPushOptions`. + pushOptions(); // Gets the pushed `NDEFPushOptions`. }; ``` diff --git a/testing/web-platform/tests/web-nfc/idlharness.https.window.js b/testing/web-platform/tests/web-nfc/idlharness.https.window.js index 869433d2ff5a..f59ad9b512ed 100644 --- a/testing/web-platform/tests/web-nfc/idlharness.https.window.js +++ b/testing/web-platform/tests/web-nfc/idlharness.https.window.js @@ -21,12 +21,12 @@ idl_test( ['html', 'dom', 'WebIDL'], idl_array => { idl_array.add_objects({ - NFCWriter: ['new NFCWriter();'], - NFCReader: ['new NFCReader();'], + NDEFWriter: ['new NDEFWriter();'], + NDEFReader: ['new NDEFReader();'], NDEFRecord: [`new NDEFRecord(${JSON.stringify(record)});`], NDEFMessage: [`new NDEFMessage(${JSON.stringify(message)});`], - NFCReadingEvent: [`new NFCReadingEvent("reading", { message: ${JSON.stringify(message)} })`], - NFCErrorEvent: ['new NFCErrorEvent("error", { error: new DOMException() });'], + NDEFReadingEvent: [`new NDEFReadingEvent("reading", { message: ${JSON.stringify(message)} })`], + NDEFErrorEvent: ['new NDEFErrorEvent("error", { error: new DOMException() });'], }); } ); diff --git a/testing/web-platform/tests/web-nfc/nfc_insecure_context.html b/testing/web-platform/tests/web-nfc/nfc_insecure_context.html index f883f0473b7c..9a8e58cf802f 100644 --- a/testing/web-platform/tests/web-nfc/nfc_insecure_context.html +++ b/testing/web-platform/tests/web-nfc/nfc_insecure_context.html @@ -17,12 +17,12 @@ test(t => { assert_false(isSecureContext); - assert_false('NFCWriter' in window); -}, 'NFCWriter requires a secure context'); + assert_false('NDEFWriter' in window); +}, 'NDEFWriter requires a secure context'); test(t => { assert_false(isSecureContext); - assert_false('NFCReader' in window); -}, 'NFCReader requires a secure context'); + assert_false('NDEFReader' in window); +}, 'NDEFReader requires a secure context'); diff --git a/testing/web-platform/tests/web-nfc/resources/nfc-helpers.js b/testing/web-platform/tests/web-nfc/resources/nfc-helpers.js index ed5cc9c9718d..ce4079ae8a69 100644 --- a/testing/web-platform/tests/web-nfc/resources/nfc-helpers.js +++ b/testing/web-platform/tests/web-nfc/resources/nfc-helpers.js @@ -111,12 +111,12 @@ function createUrlRecord(url) { return createRecord('url', 'text/plain', url); } -function createNFCPushOptions(target, timeout, ignoreRead) { +function createNDEFPushOptions(target, timeout, ignoreRead) { return {target, timeout, ignoreRead}; } // Compares NDEFMessageSource that was provided to the API -// (e.g. NFCWriter.push), and NDEFMessage that was received by the +// (e.g. NDEFWriter.push), and NDEFMessage that was received by the // mock NFC service. function assertNDEFMessagesEqual(providedMessage, receivedMessage) { // If simple data type is passed, e.g. String or ArrayBuffer, convert it @@ -137,7 +137,7 @@ function assertNDEFMessagesEqual(providedMessage, receivedMessage) { } // Used to compare two NDEFMessage, one that is received from -// NFCWriter.onreading() EventHandler and another that is provided to mock NFC +// NDEFWriter.onreading() EventHandler and another that is provided to mock NFC // service. function assertWebNDEFMessagesEqual(message, expectedMessage) { if (expectedMessage.url) @@ -172,10 +172,10 @@ function assertWebNDEFMessagesEqual(message, expectedMessage) { } } -function testNFCScanOptions(message, scanOptions, unmatchedScanOptions, desc) { +function testNDEFScanOptions(message, scanOptions, unmatchedScanOptions, desc) { nfc_test(async (t, mockNFC) => { - const reader1 = new NFCReader(); - const reader2 = new NFCReader(); + const reader1 = new NDEFReader(); + const reader2 = new NDEFReader(); const controller = new AbortController(); mockNFC.setReadingMessage(message); @@ -191,7 +191,7 @@ function testNFCScanOptions(message, scanOptions, unmatchedScanOptions, desc) { controller.abort(); assertWebNDEFMessagesEqual(event.message, new NDEFMessage(message)); }); - // NFCReader#scan() asynchronously dispatches the onreading event. + // NDEFReader#scan() asynchronously dispatches the onreading event. scanOptions.signal = controller.signal; reader2.scan(scanOptions); await promise; @@ -201,7 +201,7 @@ function testNFCScanOptions(message, scanOptions, unmatchedScanOptions, desc) { function testReadingMultiMessages( message, scanOptions, unmatchedMessage, desc) { nfc_test(async (t, mockNFC) => { - const reader = new NFCReader(); + const reader = new NDEFReader(); const controller = new AbortController(); const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]); @@ -209,7 +209,7 @@ function testReadingMultiMessages( controller.abort(); assertWebNDEFMessagesEqual(event.message, new NDEFMessage(message)); }); - // NFCReader#scan() asynchronously dispatches the onreading event. + // NDEFReader#scan() asynchronously dispatches the onreading event. scanOptions.signal = controller.signal; reader.scan(scanOptions);