Chromium Code Reviews| Index: media/test/data/player.html |
| diff --git a/media/test/data/player.html b/media/test/data/player.html |
| index fa50d731e1a3610e1f9db825f5cb6f104bb072df..732aef5cbceffc5d6b6ea58ab097fad647c145b2 100644 |
| --- a/media/test/data/player.html |
| +++ b/media/test/data/player.html |
| @@ -38,23 +38,44 @@ function SeekTestTimeoutSetup() { |
| } |
| // Uses URL query parameters to create an audio or video element using a given |
| -// source. URL must be of the form "player.html?[tag]=[media_url]". Plays the |
| -// media and waits for X seconds of playback or the ended event, at which point |
| -// the test seeks near the end of the file and resumes playback. Test completes |
| -// when the second ended event occurs or an error event occurs at any time. |
| +// source. URL format must be "player.html?[tag]=[media_url](&extra_params)". |
| +// Plays the media and waits for X seconds of playback or the ended event, at |
| +// which point the test seeks near the end of the file and resumes playback. |
| +// Test completes when the second ended event occurs or an error event occurs at |
| +// any time. |
| +// There is an optional loop query parameter which when set to true, will cause |
| +// the created audio element to loop. |
|
xhwang
2016/09/21 22:37:41
Can you actually expand the "extra_params" since w
derekjchow1
2016/09/22 20:32:43
Added loop in explicitly and changed the "audio" e
|
| function RunTest() { |
| var url_parts = window.location.href.split('?'); |
| if (url_parts.length != 2) |
| return Failed(); |
| - var query_parts = url_parts[1].split('='); |
| - if (query_parts.length != 2) |
| - return Failed(); |
| - |
| - var tag = query_parts[0]; |
| - var media_url = query_parts[1]; |
| - if (tag != 'audio' && tag != 'video') |
| + var tag = ''; |
| + var media_url = ''; |
| + var loop = false; |
| + |
| + var query_params = url_parts[1].split('&'); |
| + for (var query_param in query_params) { |
| + var query_parts = query_params[query_param].split('='); |
| + if (query_parts.length != 2) { |
| + return Failed(); |
| + } |
| + |
| + if (query_parts[0] == 'audio' || query_parts[0] == 'video') { |
| + tag = query_parts[0]; |
| + media_url = query_parts[1]; |
| + continue; |
| + } |
| + |
| + if (query_parts[0] == 'loop') { |
| + loop = (query_parts[1] == 'true'); |
| + continue; |
| + } |
| + } |
| + |
| + if (tag != 'audio' && tag != 'video') { |
| return Failed(); |
| + } |
| // Create player and insert into DOM. |
| player = document.createElement(tag); |
| @@ -74,6 +95,7 @@ function RunTest() { |
| InstallTitleEventHandler(player, 'error'); |
| // Starts the player. |
| + player.loop = loop; |
| player.src = media_url; |
| player.play(); |
| } |