mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-20 14:10:09 +00:00
Bug 1301426 part 2 - test case 1; r=jwwang
Case: invoke play() on an element that doesn't have enough data Expected result: resolve the promise MozReview-Commit-ID: 7bUs8cy5Fkv --HG-- extra : rebase_source : 02b18756f2c70f02ea4bb3c204b58cc6ede71a20 extra : source : dddcd63380f0f5c0cac5fe22e0af0ffcdef07a09
This commit is contained in:
parent
8d9b83ffee
commit
58664d3167
dom/media/test
@ -798,6 +798,8 @@ tags=msg
|
||||
[test_paused_after_ended.html]
|
||||
[test_play_events.html]
|
||||
[test_play_events_2.html]
|
||||
[test_play_promise_1.html]
|
||||
tags=promise-play
|
||||
[test_play_twice.html]
|
||||
# Seamonkey: Bug 598252
|
||||
skip-if = appname == "seamonkey"
|
||||
|
42
dom/media/test/test_play_promise_1.html
Normal file
42
dom/media/test/test_play_promise_1.html
Normal file
@ -0,0 +1,42 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Media test: promise-based play() method</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
|
||||
<script>
|
||||
// Name: playBeforeCanPlay
|
||||
// Case: invoke play() on an element that doesn't have enough data
|
||||
// Expected result: resolve the promise
|
||||
|
||||
let manager = new MediaTestManager;
|
||||
|
||||
function initTest(test, token) {
|
||||
manager.started(token);
|
||||
|
||||
let element = document.createElement(getMajorMimeType(test.type));
|
||||
element.src = test.name;
|
||||
ok(element.readyState == HTMLMediaElement.HAVE_NOTHING);
|
||||
|
||||
element.play().then(
|
||||
(result) => {
|
||||
if (result == undefined) {
|
||||
ok(true, `${token} is resolved with ${result}.`);
|
||||
} else {
|
||||
ok(false, `${token} is resolved with ${result}.`);
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
ok(false, `${token} is rejected with ${error.name}.`);
|
||||
}
|
||||
).then( () => { manager.finished(token); } );
|
||||
}
|
||||
|
||||
manager.runTests(gSmallTests, initTest);
|
||||
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user