Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1761)

Unified Diff: content/test/data/media/player.html

Issue 408993002: Have media content and chrome browser tests load data from media/test/data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/test/data/media/mse_config_change.html ('k') | media/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/data/media/player.html
diff --git a/content/test/data/media/player.html b/content/test/data/media/player.html
deleted file mode 100644
index e954cf8e938d53707a9df3b71a9db74433f010a9..0000000000000000000000000000000000000000
--- a/content/test/data/media/player.html
+++ /dev/null
@@ -1,77 +0,0 @@
-<html>
-<body onload="RunTest();">
-<div id="player_container"></div>
-</body>
-
-<script type="text/javascript">
-// <audio> or <video> player element.
-var player;
-
-// Listen for |event| from |element|, set document.title = |event| upon event.
-function InstallTitleEventHandler(element, event) {
- element.addEventListener(event, function(e) {
- document.title = event.toUpperCase();
- }, false);
-}
-
-function Failed() {
- document.title = 'FAILED';
- return false;
-}
-
-function SeekTestStep(e) {
- player.removeEventListener('ended', SeekTestStep, false);
-
- // Test completes on the next ended event.
- InstallTitleEventHandler(player, 'ended');
-
- player.currentTime = 0.9 * player.duration;
- player.play();
-}
-
-function SeekTestTimeoutSetup() {
- if (player.currentTime < 2)
- return;
-
- player.removeEventListener('timeupdate', SeekTestTimeoutSetup, false);
- SeekTestStep();
-}
-
-// 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.
-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')
- return Failed();
-
- // Create player and insert into DOM.
- player = document.createElement(tag);
- player.controls = true;
- document.getElementById('player_container').appendChild(player);
-
- // Transition to the seek test after X seconds of playback or when the ended
- // event occurs, whichever happens first.
- player.addEventListener('ended', SeekTestStep, false);
- player.addEventListener('timeupdate', SeekTestTimeoutSetup, false);
-
- // Ensure we percolate up any error events.
- InstallTitleEventHandler(player, 'error');
-
- // Starts the player.
- player.src = media_url;
- player.play();
-}
-</script>
-</html>
« no previous file with comments | « content/test/data/media/mse_config_change.html ('k') | media/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698