Skip to content

Commit

Permalink
[WebNFC] Rename push NDEFWriter method to write
Browse files Browse the repository at this point in the history
Following spec change at w3c/web-nfc#526, this
CL renames NDEFWriter.push to NDEFWriter.write and NDEFPushOptions to
NDEFWriteOptions.

BUG=520391

Change-Id: Icfaec0609e8cb6145eef4f344519e2ff7b04159c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1993805
Reviewed-by: Rijubrata Bhaumik <rijubrata.bhaumik@intel.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Leon Han <leon.han@intel.com>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Cr-Commit-Position: refs/heads/master@{#731890}
  • Loading branch information
beaufortfrancois authored and chromium-wpt-export-bot committed Jan 15, 2020
1 parent 841671e commit 30d5270
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 90 deletions.
2 changes: 1 addition & 1 deletion lint.whitelist
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ LAYOUTTESTS APIS: resources/chromium/nfc-mock.js
LAYOUTTESTS APIS: resources/chromium/webxr-test.js
LAYOUTTESTS APIS: web-nfc/NDEFReader-document-hidden-manual.https.html
LAYOUTTESTS APIS: web-nfc/NDEFReader_scan.https.html
LAYOUTTESTS APIS: web-nfc/NDEFWriter_push.https.html
LAYOUTTESTS APIS: web-nfc/NDEFWriter_write.https.html

# Signed Exchange files have hard-coded URLs in the certUrl field
WEB-PLATFORM.TEST:signed-exchange/resources/*.sxg
Expand Down
18 changes: 9 additions & 9 deletions resources/chromium/nfc-mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ function compareNDEFRecords(providedRecord, receivedRecord) {
new Uint8Array(receivedRecord.data));
}

// Compares NDEFPushOptions structures that were provided to API and
// Compares NDEFWriteOptions structures that were provided to API and
// received by the mock mojo service.
function assertNDEFPushOptionsEqual(provided, received) {
function assertNDEFWriteOptionsEqual(provided, received) {
if (provided.ignoreRead !== undefined)
assert_equals(provided.ignoreRead, !!received.ignoreRead);
else
Expand Down Expand Up @@ -149,7 +149,7 @@ var WebNFCTest = (() => {

this.hw_status_ = NFCHWStatus.ENABLED;
this.pushed_message_ = null;
this.pending_push_options_ = null;
this.pending_write_options_ = null;
this.pending_promise_func_ = null;
this.push_completed_ = true;
this.client_ = null;
Expand All @@ -171,7 +171,7 @@ var WebNFCTest = (() => {
}

this.pushed_message_ = message;
this.pending_push_options_ = options;
this.pending_write_options_ = options;
return new Promise(resolve => {
if (this.operations_suspended_ || !this.push_completed_) {
// Leaves the push pending.
Expand Down Expand Up @@ -256,8 +256,8 @@ var WebNFCTest = (() => {
return this.pushed_message_;
}

pushOptions() {
return this.pending_push_options_;
writeOptions() {
return this.pending_write_options_;
}

watchOptions() {
Expand Down Expand Up @@ -287,7 +287,7 @@ var WebNFCTest = (() => {
}

this.pushed_message_ = null;
this.pending_push_options_ = null;
this.pending_write_options_ = null;
this.push_completed_ = true;
}

Expand All @@ -296,8 +296,8 @@ var WebNFCTest = (() => {
this.reading_messages_.push(message);
// Ignores reading if NFC operation is suspended.
if(this.operations_suspended_) return;
// Ignores reading if NDEFPushOptions.ignoreRead is true.
if (this.pending_push_options_ && this.pending_push_options_.ignoreRead)
// Ignores reading if NDEFWriteOptions.ignoreRead is true.
if (this.pending_write_options_ && this.pending_write_options_.ignoreRead)
return;
// Triggers onWatch if the new message matches existing watchers.
for (let watcher of this.watchers_) {
Expand Down
6 changes: 3 additions & 3 deletions web-nfc/NDEFWriter-document-hidden-manual.https.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="timeout" content="long">
<title>NDEFWriter.push respect page visibility changes</title>
<title>NDEFWriter.write respect page visibility changes</title>
<link rel="help" href="https://w3c.github.io/web-nfc/#visible-document">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
Expand All @@ -10,7 +10,7 @@

promise_test(async t => {
const writer = new NDEFWriter();
const p1 = writer.push(test_text_data);
const p1 = writer.write(test_text_data);

return await new Promise((resolve, reject) => {
p1.then(() => {
Expand All @@ -20,7 +20,7 @@
reject();
});
});
}, "Test NDEFWriter.push operation should be suspend when document is not visible");
}, "Test NDEFWriter.write operation should be suspend when document is not visible");

</script>

Expand Down

0 comments on commit 30d5270

Please sign in to comment.