summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_bug463162.xhtml
blob: 3d1dde405e2e8682bdd768a7792a38a9a5414ce3 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:html="http://www.w3.org/1999/xhtml"
      xmlns:svg="http://www.w3.org/2000/svg">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=463162
-->
<head>
  <title>Test for Bug 463162</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>        
  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"/>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  <script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=463162">Mozilla Bug 463162</a>

<script class="testbody" type="text/javascript">
<![CDATA[

var gExpectedResult = {
  'a1' : 'error',
  'a2' : 'loaded',
  'a3' : 'loaded',
  'a4' : 'error',
};

var gResultCount = 0;

function onError(event, id) {
  is('error', gExpectedResult[id], 'unexpected error loading ' + id);
  gResultCount++;
  dump('error('+id+') expected ' + gExpectedResult[id] + ' gResultCount=' + gResultCount + '\n');
  if (gResultCount == 4)
    SimpleTest.finish();
}

function onMetaData(id) {
  is('loaded', gExpectedResult[id], 'unexpected loadedmetadata loading ' + id);
  gResultCount++;
  dump('onMetaData('+id+') expected ' + gExpectedResult[id] + ' gResultCount=' + gResultCount + '\n');
  if (gResultCount == 4)
    SimpleTest.finish();
}

]]>
</script>

<video id="a1" preload="metadata" onloadedmetadata="onMetaData('a1');"><sauce/><source type="bad" src="404" onerror="onError(event, 'a1');"/></video>
<video id="a2" preload="metadata" onloadedmetadata="onMetaData('a2');"><source onerror="onError(event, 'a2');"/></video>
<video id="a3" preload="metadata" onloadedmetadata="onMetaData('a3');"><html:source onerror="onError(event, 'a3');"/></video>
<video id="a4" preload="metadata" onloadedmetadata="onMetaData('a4');"><svg:source/><source onerror="onError(event, 'a4');" type="bad" src="404"/></video>

<script class="testbody" type="text/javascript">
<![CDATA[

function setSource(id, res) {
  var v = document.getElementById(id);
  v.firstChild.src = res.name;
  v.firstChild.type = res.type;
}

var t = getPlayableVideo(gSmallTests);

setSource('a1', t);
setSource('a2', t);
setSource('a3', t);
setSource('a4', t);

SimpleTest.waitForExplicitFinish();

]]>
</script>

<pre id="test">

</pre>
</body>
</html>