Revision 4038be686e4912ac1779f73f9fca8d9cbfbb1ec0 authored by Ovidio Henriquez on 07 March 2018, 21:13:41 UTC, committed by Blink WPT Bot on 08 March 2018, 10:10:32 UTC
This change refactors the Web Bluetooth test API to use the
DeviceUUIDs helper class defined in BluetoothDevice. Additionally,
this change finishes the implementation of SimulateGATTServicesChanged,
and as a result, tests are updated to set the next discovery response
before calling this interface.

BUG=719826

Change-Id: I0f986eb7afe6fbf7ebaa80ac4b633d46a027b80d
Reviewed-on: https://chromium-review.googlesource.com/939984
Commit-Queue: Ovidio Henriquez <odejesush@chromium.org>
Reviewed-by: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541577}
1 parent 08d063d
Raw File
interfaces.html
<!doctype html>
<meta charset=utf-8>
<title>DOM IDL tests</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>

<h1>DOM IDL tests</h1>
<div id=log></div>
<script>
"use strict";
var xmlDoc = document.implementation.createDocument(null, "", null);
var detachedRange = document.createRange();
detachedRange.detach();
var element = xmlDoc.createElementNS(null, "test");
element.setAttribute("bar", "baz");

var idlArray = new IdlArray();

function doTest([html, dom]) {
  // HTML is needed for EventHandler. Provide a dummy interface for
  // LinkStyle which HTML depends on but we're not testing.
  idlArray.add_untested_idls('interface LinkStyle {};');
  idlArray.add_untested_idls(html);
  idlArray.add_idls(dom);
  idlArray.add_objects({
    EventTarget: ['new EventTarget()'],
    Event: ['document.createEvent("Event")', 'new Event("foo")'],
    CustomEvent: ['new CustomEvent("foo")'],
    AbortController: ['new AbortController()'],
    AbortSignal: ['new AbortController().signal'],
    Document: ['new Document()'],
    XMLDocument: ['xmlDoc'],
    DOMImplementation: ['document.implementation'],
    DocumentFragment: ['document.createDocumentFragment()'],
    DocumentType: ['document.doctype'],
    Element: ['element'],
    Attr: ['document.querySelector("[id]").attributes[0]'],
    Text: ['document.createTextNode("abc")'],
    ProcessingInstruction: ['xmlDoc.createProcessingInstruction("abc", "def")'],
    Comment: ['document.createComment("abc")'],
    Range: ['document.createRange()', 'detachedRange'],
    NodeIterator: ['document.createNodeIterator(document.body, NodeFilter.SHOW_ALL, null, false)'],
    TreeWalker: ['document.createTreeWalker(document.body, NodeFilter.SHOW_ALL, null, false)'],
    NodeList: ['document.querySelectorAll("script")'],
    HTMLCollection: ['document.body.children'],
    DOMTokenList: ['document.body.classList'],
  });
  idlArray.test();
}

function fetchText(url) {
  return fetch(url).then((response) => response.text());
}

promise_test(function() {
  return Promise.all(['/interfaces/html.idl',
                      '/interfaces/dom.idl'].map(fetchText))
                .then(doTest);
}, "Test driver");
</script>
back to top