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

Side by Side Diff: chrome/test/data/media/eme_player_js/eme_app.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // EMEApp is responsible for starting playback on the eme_player.html page.
6 // It selects the suitable player based on key system and other test options.
7 function EMEApp(testConfig) {
8 this.video_ = null;
9 this.testConfig_ = testConfig;
10 this.updateDocument(testConfig);
11 }
12
13 EMEApp.prototype.createPlayer = function() {
14 // Load document test configuration.
15 this.updateTestConfig();
16 if (this.video_) {
17 Utils.timeLog('Delete old video tag.');
18 this.video_.pause();
19 this.video_.remove();
20 delete(this.video_);
21 }
22
23 this.video_ = document.createElement('video');
24 this.video_.controls = true;
25 this.video_.preload = true;
26 this.video_.width = 848;
27 this.video_.height = 480;
28 var videoSpan = document.getElementById(VIDEO_ELEMENT_ID);
29 if (videoSpan)
30 videoSpan.appendChild(this.video_);
31 else
32 document.body.appendChild(this.video_);
33
34 var videoPlayer = PlayerUtils.createPlayer(this.video_, this.testConfig_);
35 if (!videoPlayer) {
36 Utils.timeLog('Cannot create a media player.');
37 return;
38 }
39 Utils.timeLog('Using ' + videoPlayer.constructor.name);
40 if (this.testConfig_.runFPS)
41 FPSObserver.observe(this.video_);
42
43 videoPlayer.init();
44 return videoPlayer;
45 };
46
47 EMEApp.prototype.updateDocument = function(testConfig) {
48 // Update document lists with test configuration values.
49 Utils.addOptions(KEYSYSTEM_ELEMENT_ID, KEY_SYSTEMS);
50 Utils.addOptions(MEDIA_TYPE_ELEMENT_ID, MEDIA_TYPES);
51 Utils.addOptions(USE_PREFIXED_EME_ID, EME_VERSIONS_OPTIONS,
52 EME_DISABLED_OPTIONS);
53 document.getElementById(MEDIA_FILE_ELEMENT_ID).value =
54 testConfig.mediaFile || DEFAULT_MEDIA_FILE;
55 document.getElementById(LICENSE_SERVER_ELEMENT_ID).value =
56 testConfig.licenseServerURL || DEFAULT_LICENSE_SERVER;
57 if (testConfig.keySystem)
58 Utils.ensureOptionInList(KEYSYSTEM_ELEMENT_ID, testConfig.keySystem);
59 if (testConfig.mediaType)
60 Utils.ensureOptionInList(MEDIA_TYPE_ELEMENT_ID, testConfig.mediaType);
61 document.getElementById(USE_MSE_ELEMENT_ID).value = testConfig.useMSE;
62 if (testConfig.usePrefixedEME)
63 document.getElementById(USE_PREFIXED_EME_ID).value = EME_PREFIXED_VERSION;
64 };
65
66 EMEApp.prototype.updateTestConfig = function() {
67 // Reload test configuration from document.
68 this.testConfig_.mediaFile =
69 document.getElementById(MEDIA_FILE_ELEMENT_ID).value;
70 this.testConfig_.keySystem =
71 document.getElementById(KEYSYSTEM_ELEMENT_ID).value;
72 this.testConfig_.mediaType =
73 document.getElementById(MEDIA_TYPE_ELEMENT_ID).value;
74 this.testConfig_.useMSE =
75 document.getElementById(USE_MSE_ELEMENT_ID).value == 'true';
76 this.testConfig_.usePrefixedEME = (
77 document.getElementById(USE_PREFIXED_EME_ID).value ==
78 EME_PREFIXED_VERSION);
79 this.testConfig_.licenseServerURL =
80 document.getElementById(LICENSE_SERVER_ELEMENT_ID).value;
81 };
OLDNEW
« no previous file with comments | « chrome/test/data/media/eme_player_js/clearkey_player.js ('k') | chrome/test/data/media/eme_player_js/file_io_test_player.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698