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

Unified Diff: chrome/test/data/media/eme_player_js/media_source_utils.js

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
Index: chrome/test/data/media/eme_player_js/media_source_utils.js
diff --git a/chrome/test/data/media/eme_player_js/media_source_utils.js b/chrome/test/data/media/eme_player_js/media_source_utils.js
deleted file mode 100644
index d75f31c694b09d3754f2e1a2deb64bbe4221d15c..0000000000000000000000000000000000000000
--- a/chrome/test/data/media/eme_player_js/media_source_utils.js
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// MediaSourceUtils provides basic functionality to load content using MSE API.
-var MediaSourceUtils = new function() {
-}
-
-MediaSourceUtils.loadMediaSourceFromTestConfig = function(testConfig,
- appendCallbackFn) {
- return this.loadMediaSource(testConfig.mediaFile,
- testConfig.mediaType,
- appendCallbackFn);
-};
-
-MediaSourceUtils.loadMediaSource = function(mediaFiles,
- mediaTypes,
- appendCallbackFn) {
- if (!mediaFiles || !mediaTypes)
- Utils.failTest('Missing parameters in loadMediaSource().');
-
- var mediaFiles = Utils.convertToArray(mediaFiles);
- var mediaTypes = Utils.convertToArray(mediaTypes);
- var totalAppended = 0;
- function onSourceOpen(e) {
- Utils.timeLog('onSourceOpen', e);
- // We can load multiple media files using the same media type. However, if
- // more than one media type is used, we expect to have a media type entry
- // for each corresponding media file.
- var srcBuffer = null;
- for (var i = 0; i < mediaFiles.length; i++) {
- if (i == 0 || mediaFiles.length == mediaTypes.length) {
- Utils.timeLog('Creating a source buffer for type ' + mediaTypes[i]);
- try {
- srcBuffer = mediaSource.addSourceBuffer(mediaTypes[i]);
- } catch (e) {
- Utils.failTest('Exception adding source buffer: ' + e.message);
- return;
- }
- }
- doAppend(mediaFiles[i], srcBuffer);
- }
- }
-
- function doAppend(mediaFile, srcBuffer) {
- var xhr = new XMLHttpRequest();
- xhr.open('GET', mediaFile);
- xhr.responseType = 'arraybuffer';
- xhr.addEventListener('load', function(e) {
- var onUpdateEnd = function(e) {
- Utils.timeLog('End of appending buffer from ' + mediaFile);
- srcBuffer.removeEventListener('updateend', onUpdateEnd);
- totalAppended++;
- if (totalAppended == mediaFiles.length) {
- if (appendCallbackFn)
- appendCallbackFn(mediaSource);
- else
- mediaSource.endOfStream();
- }
- };
- srcBuffer.addEventListener('updateend', onUpdateEnd);
- srcBuffer.appendBuffer(new Uint8Array(e.target.response));
- });
- xhr.send();
- }
-
- var mediaSource = new MediaSource();
- mediaSource.addEventListener('sourceopen', onSourceOpen);
- return mediaSource;
-};
« no previous file with comments | « chrome/test/data/media/eme_player_js/globals.js ('k') | chrome/test/data/media/eme_player_js/player_utils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698