blob: c9757604167986e67fad96449d57b38217f09149 (
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
|
<!doctype html>
<title>error</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/media.js"></script>
<div id="log"></div>
<script>
function error_test(tagName, src) {
test(function() {
assert_equals(document.createElement(tagName).error, null);
}, tagName + '.error initial value');
async_test(function(t) {
var e = document.createElement(tagName);
e.src = src;
e.onloadeddata = t.step_func(function() {
assert_equals(e.error, null);
t.done();
});
}, tagName + '.error after successful load');
// TODO: MEDIA_ERR_ABORTED, MEDIA_ERR_NETWORK, MEDIA_ERR_DECODE
async_test(function(t) {
var e = document.createElement(tagName);
e.src = '';
e.onerror = t.step_func(function() {
assert_true(e.error instanceof MediaError);
assert_equals(e.error.code, 4);
assert_equals(e.error.code, e.error.MEDIA_ERR_SRC_NOT_SUPPORTED);
t.done();
});
}, tagName + '.error after setting src to the empty string');
}
error_test('audio', getAudioURI('/media/sound_5'));
error_test('video', getVideoURI('/media/movie_5'));
</script>
|