summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/presentation-api/receiving-ua/support/idlharness_receiving-ua.html
blob: 2d5a5b17f14eb658d0254b175f6bbf9aa5f29578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<meta charset="utf-8">
<title>Presentation API IDL tests for Receiving User Agent</title>
<link rel="author" title="Louay Bassbouss" href="http://www.fokus.fraunhofer.de">
<link rel="author" title="Tomoyuki Shimizu" href="https://github.com/tomoyukilabs">
<link rel="help" href="http://w3c.github.io/presentation-api/#dfn-receiving-user-agent">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
<script src="../common.js"></script>
<script src="stash.js"></script>

<script>
    'use strict';
    (async () => {
        const srcs = ['presentation-api', 'dom', 'html'];
        const [idl, dom, html] = await Promise.all(
            srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));

        const idl_array = new IdlArray();
        idl_array.add_idls(idl, {
            except: [
                'PresentationRequest',
                'PresentationAvailability',
            ]
        });
        idl_array.add_dependency_idls(dom);
        idl_array.add_dependency_idls(html);
        idl_array.add_objects({
            Presentation: ['navigator.presentation'],
            PresentationReceiver: ['navigator.presentation.receiver']
        });
        add_completion_callback((tests, status) => {
            const stash = new Stash(stashIds.toReceiver, stashIds.toController);
            const log = document.getElementById('log');
            stash.send(JSON.stringify({ tests: tests, status: status, log: log.innerHTML }));
        });
        idl_array.test();
    })();
</script>