summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/presentation-api/controlling-ua/PresentationRequest_error.html
blob: d6324ea56ba8e464af392fb4efe16b0bde08c911 (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
<!DOCTYPE html>
<meta charset="utf-8">
<title>Presentation API PresentationRequest for Controlling User Agent (Error)</title>
<link rel="author" title="Franck William Taffo" href="http://www.fokus.fraunhofer.de">
<link rel="help" href="http://w3c.github.io/presentation-api/#dfn-controlling-user-agent">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>

    test(function() {
        assert_throws(new TypeError(), function() {
            new PresentationRequest();
        });
    }, 'Call PresentationRequest() constructor without presentation URL. TypeError Exception expected.');

    test(function() {
        assert_throws('NotSupportedError', function() {
            new PresentationRequest([]);
        });
    }, 'Call PresentationRequest constructor with an empty sequence. NotSupportedError Exception expected.');

    test(function() {
        assert_throws('SyntaxError', function() {
            new PresentationRequest('http://@');
        });
    }, 'Call PresentationRequest constructor with an invalid URL. SyntaxError Exception expected.');

    test(function() {
        assert_throws('SyntaxError', function() {
            new PresentationRequest(['presentation.html', 'http://@']);
        });
    }, 'Call PresentationRequest constructor with a sequence of URLs, one of them invalid. SyntaxError Exception expected.');
</script>