Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / media / track / track-cue-mutable.html
1 <!DOCTYPE html>
2 <html>
3     <head>
4         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
6         <script src=../media-file.js></script>
7         <script src=../video-test.js></script>
8         <script>           
9
10             var cues;
11             
12             function logSpecURL(url, description)
13             {
14                 consoleWrite("<br><i>" + description + "</i>");
15                 consoleWrite("<a href=" + url + ">" + url + "<" + "/a>");
16             }
17
18             function trackLoaded()
19             {
20                 track = document.getElementById('captions');
21                 cues = track.track.cues;
22
23                 consoleWrite("** Test initial values.");
24                 run("textCue = cues.getCueById('1')");
25
26                 testExpected("textCue.startTime", 0);
27                 testExpected("textCue.endTime", 1.0);
28                 testExpected("textCue.pauseOnExit", false);
29                 testExpected("textCue.vertical", "");
30                 testExpected("textCue.snapToLines", true);
31                 testExpected("textCue.line", -1);
32                 testExpected("textCue.position", 50);
33                 testExpected("textCue.size", 100);
34                 testExpected("textCue.align", "middle");
35
36                 consoleWrite("<br>** Modify cue values.");
37
38                 run("textCue.startTime = 1.1");
39                 testExpected("textCue.startTime", 1.1);
40
41                 consoleWrite("");
42                 run("textCue.endTime = 3.9");
43                 testExpected("textCue.endTime", 3.9);
44
45                 consoleWrite("");
46                 run("textCue.pauseOnExit = true");
47                 testExpected("textCue.pauseOnExit", true);
48
49                 logSpecURL("http://dev.w3.org/html5/webvtt/#dfn-dom-vttcue-vertical",
50                            "On setting, the text track cue writing direction must be set to the value given in the first cell of the row in the table above whose second cell is a case-sensitive match for the new value.");
51                 run("textCue.vertical = 'RL'");
52                 testExpected("textCue.vertical", "");
53                 run("textCue.vertical = 'rl'");
54                 testExpected("textCue.vertical", "rl");
55
56                 consoleWrite("");
57                 run("textCue.snapToLines = false");
58                 testExpected("textCue.snapToLines", false);
59
60                 logSpecURL("http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-line",
61                             "On setting, if the text track cue snap-to-lines flag is not set, and the new value is negative or greater than 100, then throw an IndexSizeError exception.");
62                 testDOMException("textCue.line = -2", "DOMException.INDEX_SIZE_ERR");
63                 testDOMException("textCue.line = 102", "DOMException.INDEX_SIZE_ERR");
64                 testExpected("textCue.line", -1);
65                 run("textCue.line = 42");
66                 testExpected("textCue.line", 42);
67                 run("textCue.snapToLines = true");
68                 run("textCue.line = -2");
69                 testExpected("textCue.line", -2);
70                 run("textCue.line = 102");
71                 testExpected("textCue.line", 102);
72
73                 logSpecURL("http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-line", 
74                            "On setting, if the new value is negative or greater than 100, then throw an IndexSizeError exception. Otherwise, set the text track cue text position to the new value.");
75                 testDOMException("textCue.position = -200", "DOMException.INDEX_SIZE_ERR");
76                 testDOMException("textCue.position = 110", "DOMException.INDEX_SIZE_ERR");
77                 run("textCue.position = 11");
78                 testExpected("textCue.position", 11);
79
80                 logSpecURL("http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-size",
81                            "On setting, if the new value is negative or greater than 100, then throw an IndexSizeError exception. Otherwise, set the text track cue size to the new value.");
82                 testDOMException("textCue.size = -200", "DOMException.INDEX_SIZE_ERR");
83                 testDOMException("textCue.size = 110", "DOMException.INDEX_SIZE_ERR");
84                 run("textCue.size = 57");
85                 testExpected("textCue.size", 57);
86
87                 logSpecURL("http://dev.w3.org/html5/webvtt/#dfn-dom-vttcue-align",
88                            "On setting, the text track cue text alignment must be set to the value given in the first cell of the row in the table above whose second cell is a case-sensitive match for the new value.");
89                 run("textCue.align = 'End'");
90                 testExpected("textCue.align", "middle");
91                 run("textCue.align = 'end'");
92                 testExpected("textCue.align", "end");
93
94                 consoleWrite("");
95                 endTest();
96             }
97
98         </script>
99     </head>
100     <body>
101         <p>Tests modifying attributes of a VTTCue</p>
102         <video controls>
103             <track id="captions" src="captions-webvtt/captions.vtt" kind="captions" onload="trackLoaded()" default>
104         </video>
105     </body>
106 </html>