Revision 2877f572684541d6cd2f301d72f4114dd35ce885 authored by Robert Ma on 24 July 2018, 22:40:00 UTC, committed by Philip Jägenstedt on 25 July 2018, 09:01:10 UTC
The suite was broken by PR #11976 where the config class was changed. The suite uses a hack to get the default config of wptserve. This commit fixes the hack, but unfortunately does not find a less hacky way to get the default config.
1 parent 0589266
nfc_watch.https.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>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...