summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css/fontface-constructor-error.html
blob: b5bdcd38353f7db62aeeacb4c22ef99819c11a58 (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
<!doctype html>
<script src="../../resources/js-test.js"></script>
<script>
description('Test FontFace constructor with invalid parameters');

window.jsTestIsAsync = true;

function step1() {
    faceWithWrongSrc = new FontFace('test', 'invalid_src');
    shouldBeEqualToString('faceWithWrongSrc.status', 'error');
    faceWithWrongSrc.loaded.catch(function(e) {
        rejectionValue = e;
        shouldBeEqualToString('rejectionValue.name', 'SyntaxError');
        step2();
    });
}

function step2() {
    faceWithWrongDescriptors = new FontFace('test', 'local(Arial)', {
        'style': 'x',
        'weight': 'x',
        'unicodeRange': 'x',
        'variant': 'x',
        'featureSettings': 'x'
    });
    shouldBeEqualToString('faceWithWrongDescriptors.status', 'error');
    shouldBeEqualToString('faceWithWrongDescriptors.style', 'normal');
    shouldBeEqualToString('faceWithWrongDescriptors.weight', 'normal');
    shouldBeEqualToString('faceWithWrongDescriptors.unicodeRange', 'U+0-10FFFF');
    shouldBeEqualToString('faceWithWrongDescriptors.variant', 'normal');
    shouldBeEqualToString('faceWithWrongDescriptors.featureSettings', 'normal');
    faceWithWrongDescriptors.loaded.catch(function(e) {
        rejectionValue = e;
        shouldBeEqualToString('rejectionValue.name', 'SyntaxError');
        finishJSTest();
    });
}

step1();
</script>