mirror of
https://github.com/servo/servo.git
synced 2025-07-13 02:13:40 +01:00
37 lines
1.1 KiB
HTML
37 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset=utf-8>
|
|
<title>Web NFC Test: NFC HW Disabled</title>
|
|
<link rel="author" title="Intel" href="http://www.intel.com"/>
|
|
<link rel="help" href="https://w3c.github.io/web-nfc/"/>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="resources/nfc_help.js"></script>
|
|
<meta name="flags" content="interact">
|
|
|
|
<h2>Precondition</h2>
|
|
<ol>
|
|
<li>
|
|
Disable the NFC module or run test on a device without NFC module.
|
|
</li>
|
|
</ol>
|
|
|
|
<div id="log"></div>
|
|
|
|
<script>
|
|
|
|
"use strict";
|
|
|
|
promise_test(async t => {
|
|
const reader = new NFCReader();
|
|
const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
|
|
reader.start();
|
|
const event = await readerWatcher.wait_for("error");
|
|
assert_equals(event.error.name, 'NotReadableError');
|
|
}, "NFCReader.start should fail if NFC HW is disabled.");
|
|
|
|
promise_test(t => {
|
|
const writer = new NFCWriter();
|
|
return promise_rejects(t, 'NotReadableError', writer.push(test_text_data));
|
|
}, "NFCWriter.push should fail when NFC HW is disabled.");
|
|
|
|
</script>
|