Files
tubestation/testing/web-platform/tests/web-nfc/NDEFReader-write-document-hidden-manual.https.html
Francois Beaufort 28468682f3 Bug 1679943 [wpt PR 26094] - web-nfc: Merge NDEFWriter in NDEFReader, a=testonly
Automatic update from web-platform-tests
web-nfc: Merge NDEFWriter in NDEFReader

NDEFWriter and NDEFReader share a lot of similar
features and a writing device, will also read.

Therefore it was decided to simplify NDEF functionality,
and to have only one class called NDEFReader,
which can read and write.

refers to https://github.com/w3c/web-nfc/pull/601

Because kWebNfcNdefReaderScan and kWebNfcNdefWriterWrite are now
used in idl extended attributes, their usages
may be higher now as they were fired after user granted permission.

Bug: 1131141
Change-Id: I8cc2ce053e5bb43c0fa5b299bdaf5cb5317bf859
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2424208
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: François Beaufort <beaufort.francois@gmail.com>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Cr-Commit-Position: refs/heads/master@{#832236}

--

wpt-commits: 77f3f1533681dedef98a4c94c2abdb562d097002
wpt-pr: 26094
2020-12-07 09:25:49 +00:00

29 lines
890 B
HTML

<!DOCTYPE html>
<meta charset="utf-8">
<meta name="timeout" content="long">
<title>NDEFReader.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>
<script src="resources/nfc-helpers.js"></script>
<script>
promise_test(async t => {
const writer = new NDEFReader();
const p1 = writer.write(test_text_data);
return await new Promise((resolve, reject) => {
p1.then(() => {
assert_false(document.hidden);
resolve();
}).catch(e => {
reject();
});
});
}, "Test NDEFReader.write operation should be suspended when document is not visible");
</script>
<p>Step1: switch the page to the background, then tap an NFC tag.</p>
<p>Step2: switch back to the page, then tap the tag again.</p>