Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / css / fontface-constructor-error.html
1 <!doctype html>
2 <script src="../../resources/js-test.js"></script>
3 <script>
4 description('Test FontFace constructor with invalid parameters');
5
6 window.jsTestIsAsync = true;
7
8 function step1() {
9     faceWithWrongSrc = new FontFace('test', 'invalid_src');
10     shouldBeEqualToString('faceWithWrongSrc.status', 'error');
11     faceWithWrongSrc.loaded.catch(function(e) {
12         rejectionValue = e;
13         shouldBeEqualToString('rejectionValue.name', 'SyntaxError');
14         step2();
15     });
16 }
17
18 function step2() {
19     faceWithWrongDescriptors = new FontFace('test', 'local(Arial)', {
20         'style': 'x',
21         'weight': 'x',
22         'unicodeRange': 'x',
23         'variant': 'x',
24         'featureSettings': 'x'
25     });
26     shouldBeEqualToString('faceWithWrongDescriptors.status', 'error');
27     shouldBeEqualToString('faceWithWrongDescriptors.style', 'normal');
28     shouldBeEqualToString('faceWithWrongDescriptors.weight', 'normal');
29     shouldBeEqualToString('faceWithWrongDescriptors.unicodeRange', 'U+0-10FFFF');
30     shouldBeEqualToString('faceWithWrongDescriptors.variant', 'normal');
31     shouldBeEqualToString('faceWithWrongDescriptors.featureSettings', 'normal');
32     faceWithWrongDescriptors.loaded.catch(function(e) {
33         rejectionValue = e;
34         shouldBeEqualToString('rejectionValue.name', 'SyntaxError');
35         finishJSTest();
36     });
37 }
38
39 step1();
40 </script>