forked from mirrors/gecko-dev
MozReview-Commit-ID: 3HXcvTYpAkA --HG-- rename : testing/web-platform/tests/fonts/matching/README.md => testing/web-platform/tests/css-fonts/matching/README.md rename : testing/web-platform/tests/fonts/matching/fixed-stretch-style-over-weight-ref.html => testing/web-platform/tests/css-fonts/matching/fixed-stretch-style-over-weight-ref.html rename : testing/web-platform/tests/fonts/matching/fixed-stretch-style-over-weight.html => testing/web-platform/tests/css-fonts/matching/fixed-stretch-style-over-weight.html rename : testing/web-platform/tests/fonts/matching/font-matching.css => testing/web-platform/tests/css-fonts/matching/font-matching.css rename : testing/web-platform/tests/fonts/matching/resources/variabletest_matching.ttf => testing/web-platform/tests/css-fonts/matching/resources/variabletest_matching.ttf rename : testing/web-platform/tests/fonts/matching/stretch-distance-over-weight-distance-ref.html => testing/web-platform/tests/css-fonts/matching/stretch-distance-over-weight-distance-ref.html rename : testing/web-platform/tests/fonts/matching/stretch-distance-over-weight-distance.html => testing/web-platform/tests/css-fonts/matching/stretch-distance-over-weight-distance.html rename : testing/web-platform/tests/fonts/matching/style-ranges-over-weight-direction-ref.html => testing/web-platform/tests/css-fonts/matching/style-ranges-over-weight-direction-ref.html rename : testing/web-platform/tests/fonts/matching/style-ranges-over-weight-direction.html => testing/web-platform/tests/css-fonts/matching/style-ranges-over-weight-direction.html rename : testing/web-platform/tests/payment-request/OWNERS => testing/web-platform/tests/payment-method-id/OWNERS rename : testing/web-platform/tests/storage/interfaces.worker.js => testing/web-platform/tests/storage/interfaces.https.worker.js rename : testing/web-platform/tests/tools/browserutils/requirements.txt => testing/web-platform/tests/tools/wpt/requirements.txt rename : testing/web-platform/tests/tools/browserutils/utils.py => testing/web-platform/tests/tools/wpt/utils.py rename : testing/web-platform/tests/tools/wptrunner/wptrunner/executors/reftest-wait.js => testing/web-platform/tests/tools/wptrunner/wptrunner/executors/reftest-wait_marionette.js rename : testing/web-platform/tests/uievents/keyboard/key-manual.css => testing/web-platform/tests/uievents/keyboard/key.css rename : testing/web-platform/tests/uievents/keyboard/key-manual.js => testing/web-platform/tests/uievents/keyboard/key.js
73 lines
2.6 KiB
HTML
73 lines
2.6 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset=utf-8>
|
|
<title>Web NFC: nfc.watch tests</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>
|
|
|
|
<div id="log"></div>
|
|
|
|
<script>
|
|
|
|
"use strict";
|
|
|
|
promise_test(t => {
|
|
return promise_rejects(t, 'NotFoundError', navigator.nfc.cancelWatch(1));
|
|
}, "Test that nfc.cancelWatch fails if invalid watch ID is provided.");
|
|
|
|
promise_test(t => {
|
|
return promise_rejects(t, 'NotFoundError', navigator.nfc.cancelWatch());
|
|
}, "Test that nfc.cancelWatch fails if there are no active watchers.");
|
|
|
|
promise_test(t => {
|
|
return navigator.nfc.watch(noop).then(id => {
|
|
assert_equals(typeof(id), "number");
|
|
assert_greater_than(id, 0, "greater than zero");
|
|
});
|
|
}, "Test that nfc watch success if NFC HW is enable.");
|
|
|
|
promise_test(t => {
|
|
return navigator.nfc.watch(noop).
|
|
then(id => navigator.nfc.cancelWatch(id));
|
|
}, "Test that nfc.cancelWatch succeeds if correct watch id is provided.");
|
|
|
|
promise_test(t => {
|
|
return navigator.nfc.watch(noop).then(() => {
|
|
navigator.nfc.cancelWatch();
|
|
});
|
|
}, "Test that nfc.cancelWatch succeeds if there are active watchers.");
|
|
|
|
promise_test(t => {
|
|
return promise_rejects(t, 'SyntaxError', navigator.nfc.watch(noop, {url:"www.a.com"}));
|
|
}, 'Test that nfc.watch fails if NFCWatchOptions.url is missing components.');
|
|
|
|
promise_test(t => {
|
|
return promise_rejects(t, 'SyntaxError', navigator.nfc.watch(noop, {url:"invalid"}));
|
|
}, 'Test that nfc.watch fails if NFCWatchOptions.url is invalid.');
|
|
|
|
promise_test(t => {
|
|
return promise_rejects(t, 'SyntaxError', navigator.nfc.watch(noop, {url:"http://a.com"}));
|
|
}, 'Test that nfc.watch fails if NFCWatchOptions.url has wrong protocol.');
|
|
|
|
promise_test(t => {
|
|
return navigator.nfc.watch(noop, {url:"https://a.com"});
|
|
}, 'Test that nfc.watch succeeds if NFCWatchOptions.url is valid URL.');
|
|
|
|
promise_test(t => {
|
|
return navigator.nfc.watch(noop, {url:"https://a.com/*"});
|
|
}, 'Test that nfc.watch succeeds if NFCWatchOptions.url is valid URL with "*"' +
|
|
' wildcard character in path.');
|
|
|
|
promise_test(t => {
|
|
return navigator.nfc.watch(noop, {url:"https://a.com/*/bar"});
|
|
}, 'Test that nfc.watch succeeds if NFCWatchOptions.url is valid URL with "*"' +
|
|
' wildcard character in the beginning of path component followed by' +
|
|
' subpath.');
|
|
|
|
promise_test(t => {
|
|
return navigator.nfc.watch(noop, {url:""});
|
|
}, 'Test that nfc.watch succeeds if NFCWatchOptions.url is empty.');
|
|
|
|
</script>
|