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

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

Issue 2360443002: [Chromecast] Add CastMediaBlocker and BrowserTest (Closed)
Patch Set: use [] for optional query param Created 4 years, 3 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 | « chromecast/browser/test/chromecast_shell_media_blocking_browser_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/test/data/player.html
diff --git a/media/test/data/player.html b/media/test/data/player.html
index fa50d731e1a3610e1f9db825f5cb6f104bb072df..a1f46392928fc983cacc00579ae129b0ae7b3f35 100644
--- a/media/test/data/player.html
+++ b/media/test/data/player.html
@@ -38,23 +38,46 @@ 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 must be of the form:
+// "player.html?[tag]=[media_url][&loop=[true/false]]".
+//
+// 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 media element to loop.
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 +97,7 @@ function RunTest() {
InstallTitleEventHandler(player, 'error');
// Starts the player.
+ player.loop = loop;
player.src = media_url;
player.play();
}
« no previous file with comments | « chromecast/browser/test/chromecast_shell_media_blocking_browser_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698