servo/tests/wpt/web-platform-tests/web-nfc
2019-08-30 14:43:51 +00:00
..
resources Update web-platform-tests to revision fb898b46adaf656c9807ed0b8adb39d84162cb98 2019-08-30 14:43:51 +00:00
idlharness.https.window.js Update web-platform-tests to revision 4100d1d51b885185c50902397f7d203d89efc24c 2019-06-16 14:45:58 +00:00
META.yml Update web-platform-tests to revision d8b8e0b8efe993a37404d6c6fc75e16fdc16b7d8 2018-10-25 23:09:38 -04:00
NDEFMessage_constructor.https.html Update web-platform-tests to revision 33c263fb308d1c3f6ac6d2590d7292317262819d 2019-08-23 13:55:23 +00:00
NDEFRecord_constructor.https.html Update web-platform-tests to revision 33c263fb308d1c3f6ac6d2590d7292317262819d 2019-08-23 13:55:23 +00:00
nfc_insecure_context.html Update web-platform-tests to revision 936827a6527f1c53051d3bc5bc79304c88c0737f 2019-08-16 14:22:21 +00:00
NFCErrorEvent_constructor.https.html Update web-platform-tests to revision 4100d1d51b885185c50902397f7d203d89efc24c 2019-06-16 14:45:58 +00:00
NFCReader.https.html Update web-platform-tests to revision fb898b46adaf656c9807ed0b8adb39d84162cb98 2019-08-30 14:43:51 +00:00
NFCReader_options.https.html Update web-platform-tests to revision fb898b46adaf656c9807ed0b8adb39d84162cb98 2019-08-30 14:43:51 +00:00
NFCReadingEvent_constructor.https.html Update web-platform-tests to revision 82b73b315ce7ed1554e7a9b7bced66a5831e4ee5 2019-08-19 14:01:14 +00:00
NFCWriter_push.https.html Update web-platform-tests to revision 936827a6527f1c53051d3bc5bc79304c88c0737f 2019-08-16 14:22:21 +00:00
README.md Update web-platform-tests to revision 936827a6527f1c53051d3bc5bc79304c88c0737f 2019-08-16 14:22:21 +00:00

The nfc-helpers.js requires an implementation of the WebNFCTest interfaces, which should emulate platform Web NFC backends.

The WebNFCTest interface is defined as:

  class NFCTestChromium {
    initialize();  // Sets up the testing environment.
    async reset(); // Frees the resources.
    getMockNFC(); // Returns `MockNFC` interface.
  };

  class MockNFC {
    setHWStatus(number status); // Sets the hardware status.
    setCompatibility(NDEFCompatibility compatibility); // Sets NDEF accepted compatible devices
    setReadingMessage(NDEFMessageInit message, NDEFCompatibility compatibility); // Sets message that is used to deliver NFC reading updates with a specific NDEFCompatibility.
    setPendingPushCompleted(boolean result); // Sets if the pending push is completed.
    setPushShouldTimeout(boolean result); // Sets flag to trigger the pending push to timeout.
    pushedMessage(); // Gets the pushed `NDEFMessageSource`.
    pushOptions(); // Gets the pushed `NFCPushOptions`.
  };

The Chromium implementation of the WebNFCTest interface is located in nfc-mock.js.

Other browser vendors should provide their own implementations of the WebNFCTest interfaces.