Revision 5cddf5d5dabdadf78da597c02f23905b8f4c2265 authored by Rouslan Solomakhin on 06 March 2018, 14:25:18 UTC, committed by Rouslan Solomakhin on 06 March 2018, 14:25:18 UTC
1 parent cee6896
Raw File
idlharness.https.html
<!DOCTYPE html>
<meta charset=utf-8>
<title>Web NFC IDL 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/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
<style>
  pre {
    display: none;
  }
</style>
<div id='log'></div>

<pre id="idl">
interface Navigator {
};
</pre>

<pre id="web-nfc">
dictionary NFCMessage {
    sequence<NFCRecord> records;
    USVString           url;
};

typedef (DOMString or unrestricted double or ArrayBuffer or Dictionary) NFCRecordData;

dictionary NFCRecord {
    NFCRecordType recordType;
    USVString     mediaType;
    NFCRecordData data;
};

enum NFCRecordType {
    "empty",
    "text",
    "url",
    "json",
    "opaque"
};

partial interface Navigator {
    readonly attribute NFC nfc;
};

typedef (DOMString or ArrayBuffer or NFCMessage) NFCPushMessage;

interface NFC {
    Promise<void> push(NFCPushMessage message, optional NFCPushOptions options);
    Promise<void> cancelPush(optional NFCPushTarget target = "any");
    Promise<long> watch(MessageCallback callback,
                        optional NFCWatchOptions options);
    Promise<void> cancelWatch(optional long id);
};

callback MessageCallback = void (NFCMessage message);

dictionary NFCPushOptions {
    NFCPushTarget       target = "any";
    unrestricted double timeout = Infinity;
    boolean             ignoreRead = true;
};

enum NFCPushTarget {
    "tag",
    "peer",
    "any"
};

dictionary NFCWatchOptions {
    USVString      url = "";
    NFCRecordType? recordType;
    USVString      mediaType = "";
    NFCWatchMode   mode = "web-nfc-only";
};

enum NFCWatchMode {
    "web-nfc-only",
    "any"
};
</pre>

<script>
setup(() => {
  "use strict";
  const idl_array = new IdlArray();
  idl_array.add_untested_idls(document.getElementById('idl').textContent);
  idl_array.add_idls(document.getElementById('web-nfc').textContent);
  idl_array.add_objects({ NFC: ["navigator.nfc"] });
  idl_array.test();
  done();
}, { explicit_done: true });
</script>
back to top