Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / security / local-video-src-from-remote.html
1 <html lang="en">
2     <head>
3         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4         <title>remote &lt;video&gt; with local src</title>
5
6         <script>
7
8             var video = null;
9             var console = null;
10             var testEnded = false;
11
12             function endTest()
13             {
14                 consoleWrite("<br>END OF TEST");
15                 testEnded = true;
16                 if (window.testRunner)
17                     testRunner.notifyDone();     
18             }
19             function hanged()
20             {
21                 consoleWrite("FAIL: timed out");
22                 if (window.testRunner)
23                     testRunner.notifyDone();  
24             }
25
26             function logConsole()
27             {
28                 if (!console && document.body) {
29                     console = document.createElement('div');
30                     document.body.appendChild(console);
31                 }
32                 return console;
33             }
34             
35             function consoleWrite(text)
36             {
37                 if (testEnded)
38                     return;
39                 logConsole().innerHTML += text + "<br>";
40             }
41
42             function logEvent(evt)
43             {
44                 consoleWrite("EVENT(" + evt.type + ")");
45             }
46
47             function error(evt)
48             {
49                 logEvent(evt)
50                 consoleWrite("");
51                 consoleWrite("<span style='color:green'>SUCCESS: local movie failed to load</span>");
52                 endTest();
53             }
54
55             function loadedmetadata(evt) 
56             { 
57                 logEvent(evt);
58                 consoleWrite("");
59                 consoleWrite("<span style='color:red'>FAIL: local movie loaded successfully</span>");
60                 endTest();
61             }
62
63             var localMovie = "file:///tmp/LayoutTests/media/content/test.mp4";
64             if (window.testRunner) {
65                 localMovie = testRunner.pathToLocalResource(localMovie);
66                 testRunner.dumpAsText();
67                 testRunner.waitUntilDone();
68             }
69             setTimeout(hanged, 10000);
70
71             function test() {
72
73                 video = document.getElementById("vid");
74
75                 video.addEventListener("error", error);
76
77                 video.addEventListener('loadedmetadata', loadedmetadata);
78
79                 video.src=localMovie;
80             }
81         </script>
82     
83     </head>
84
85     <body onLoad="test()">
86
87         <video id='vid' controls></video>
88
89         <p>Test that a remote video element can not use a local 'src'</p>
90         <p>This test only works in DRT</p>
91
92     </body>
93 </html>