From 37d692b6196208ef389704a17435dec132dd790e Mon Sep 17 00:00:00 2001 From: Leon Han Date: Mon, 6 Jan 2020 16:09:23 +0000 Subject: [PATCH] Bug 1606282 [wpt PR 20935] - [webnfc] NDEFRecordInit#recordType should be a required field., a=testonly Automatic update from web-platform-tests [webnfc] NDEFRecordInit#recordType should be a required field. The spec issue and PR: https://github.com/w3c/web-nfc/issues/497 https://github.com/w3c/web-nfc/pull/498 BUG=520391 Change-Id: Ie6e3af86f0441bad03b7454b3b7285c6824d34fe Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1983433 Commit-Queue: Leon Han Reviewed-by: Rijubrata Bhaumik Cr-Commit-Position: refs/heads/master@{#728114} -- wpt-commits: 7fcc1993270df80a1081f3790418d97bc9c939b9 wpt-pr: 20935 --- .../web-nfc/NDEFRecord_constructor.https.html | 7 ++++++- .../tests/web-nfc/NDEFWriter_push.https.html | 14 -------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/testing/web-platform/tests/web-nfc/NDEFRecord_constructor.https.html b/testing/web-platform/tests/web-nfc/NDEFRecord_constructor.https.html index c62ea7b0d620..2da7ca91078a 100644 --- a/testing/web-platform/tests/web-nfc/NDEFRecord_constructor.https.html +++ b/testing/web-platform/tests/web-nfc/NDEFRecord_constructor.https.html @@ -13,9 +13,14 @@ test(() => { assert_throws(new TypeError, () => new NDEFRecord(null), - 'The record has neither type nor data.'); + 'NDEFRecordInit#recordType is a required field.'); }, 'NDEFRecord constructor with null init dict'); + test(() => { + assert_throws(new TypeError, () => new NDEFRecord({id: test_record_id, data: test_text_data}), + 'NDEFRecordInit#recordType is a required field.'); + }, 'NDEFRecord constructor without NDEFRecordInit#recordType field'); + test(() => { assert_throws(new TypeError, () => new NDEFRecord( createRecord('empty', test_text_data, test_record_id)), diff --git a/testing/web-platform/tests/web-nfc/NDEFWriter_push.https.html b/testing/web-platform/tests/web-nfc/NDEFWriter_push.https.html index 1bdbf0bb50b3..4ff0af8fb0b3 100644 --- a/testing/web-platform/tests/web-nfc/NDEFWriter_push.https.html +++ b/testing/web-platform/tests/web-nfc/NDEFWriter_push.https.html @@ -386,20 +386,6 @@ nfc_test(async (t, mockNFC) => { }); }, "NDEFWriter.push should replace all previously configured push operations."); -nfc_test(async (t, mockNFC) => { - 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 NDEFWriter(); - await writer.push({ records: [{ data: test_buffer_data}] }); - assertNDEFMessagesEqual(test_buffer_data, mockNFC.pushedMessage()); -}, "Test that recordType should be set to 'mime' if NDEFRecordInit.record's \ -recordType is undefined and NDEFRecordInit.record's data is not DOMString."); - nfc_test(async (t, mockNFC) => { const writer = new NDEFWriter(); await writer.push({ records: [{ recordType: "mime", data: test_buffer_data }] });