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

Side by Side Diff: media/test/data/eme_player_js/test_config.js

Issue 1712903002: Remove prefixed EME. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove all prefixed-related code from the EME browser tests. Created 4 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Test configuration used by test page to configure the player app and other 5 // Test configuration used by test page to configure the player app and other
6 // test specific configurations. 6 // test specific configurations.
7 function TestConfig() { 7 function TestConfig() {
8 this.mediaFile = null; 8 this.mediaFile = null;
9 this.keySystem = null; 9 this.keySystem = null;
10 this.mediaType = null; 10 this.mediaType = null;
11 this.licenseServerURL = null; 11 this.licenseServerURL = null;
12 this.useMSE = false; 12 this.useMSE = false;
13 this.usePrefixedEME = false;
14 this.runFPS = false; 13 this.runFPS = false;
15 this.playTwice = false; 14 this.playTwice = false;
16 } 15 }
17 16
18 TestConfig.prototype.loadQueryParams = function() { 17 TestConfig.prototype.loadQueryParams = function() {
19 // Load query parameters and set default values. 18 // Load query parameters and set default values.
20 var r = /([^&=]+)=?([^&]*)/g; 19 var r = /([^&=]+)=?([^&]*)/g;
21 // Lambda function for decoding extracted match values. Replaces '+' with 20 // Lambda function for decoding extracted match values. Replaces '+' with
22 // space so decodeURIComponent functions properly. 21 // space so decodeURIComponent functions properly.
23 var decodeURI = function decodeURI(s) { 22 var decodeURI = function decodeURI(s) {
24 return decodeURIComponent(s.replace(/\+/g, ' ')); 23 return decodeURIComponent(s.replace(/\+/g, ' '));
25 }; 24 };
26 var match; 25 var match;
27 while (match = r.exec(window.location.search.substring(1))) 26 while (match = r.exec(window.location.search.substring(1)))
28 this[decodeURI(match[1])] = decodeURI(match[2]); 27 this[decodeURI(match[1])] = decodeURI(match[2]);
29 this.useMSE = this.useMSE == '1' || this.useMSE == 'true'; 28 this.useMSE = this.useMSE == '1' || this.useMSE == 'true';
30 this.usePrefixedEME =
31 this.usePrefixedEME == '1' || this.usePrefixedEME == 'true';
32 this.playTwice = this.playTwice == '1' || this.playTwice == 'true'; 29 this.playTwice = this.playTwice == '1' || this.playTwice == 'true';
33
34 // Validate that the prefixed/unprefixed EME is available.
35 if (this.usePrefixedEME) {
36 if (EME_DISABLED_OPTIONS.indexOf(EME_PREFIXED_VERSION) >= 0)
37 Utils.failTest('Prefixed EME not available.')
38 } else {
39 if (EME_DISABLED_OPTIONS.indexOf(EME_UNPREFIXED_VERSION) >= 0)
40 Utils.failTest('Unprefixed EME not available.')
41 }
42 }; 30 };
43 31
44 TestConfig.updateDocument = function() { 32 TestConfig.updateDocument = function() {
45 this.loadQueryParams(); 33 this.loadQueryParams();
46 Utils.addOptions(KEYSYSTEM_ELEMENT_ID, KEY_SYSTEMS); 34 Utils.addOptions(KEYSYSTEM_ELEMENT_ID, KEY_SYSTEMS);
47 Utils.addOptions(MEDIA_TYPE_ELEMENT_ID, MEDIA_TYPES); 35 Utils.addOptions(MEDIA_TYPE_ELEMENT_ID, MEDIA_TYPES);
48 Utils.addOptions(USE_PREFIXED_EME_ID, EME_VERSIONS_OPTIONS,
49 EME_DISABLED_OPTIONS);
50 36
51 document.getElementById(MEDIA_FILE_ELEMENT_ID).value = 37 document.getElementById(MEDIA_FILE_ELEMENT_ID).value =
52 this.mediaFile || DEFAULT_MEDIA_FILE; 38 this.mediaFile || DEFAULT_MEDIA_FILE;
53 39
54 document.getElementById(LICENSE_SERVER_ELEMENT_ID).value = 40 document.getElementById(LICENSE_SERVER_ELEMENT_ID).value =
55 this.licenseServerURL || DEFAULT_LICENSE_SERVER; 41 this.licenseServerURL || DEFAULT_LICENSE_SERVER;
56 42
57 if (this.keySystem) 43 if (this.keySystem)
58 Utils.ensureOptionInList(KEYSYSTEM_ELEMENT_ID, this.keySystem); 44 Utils.ensureOptionInList(KEYSYSTEM_ELEMENT_ID, this.keySystem);
59 if (this.mediaType) 45 if (this.mediaType)
60 Utils.ensureOptionInList(MEDIA_TYPE_ELEMENT_ID, this.mediaType); 46 Utils.ensureOptionInList(MEDIA_TYPE_ELEMENT_ID, this.mediaType);
61 document.getElementById(USE_MSE_ELEMENT_ID).value = this.useMSE; 47 document.getElementById(USE_MSE_ELEMENT_ID).value = this.useMSE;
62 if (this.usePrefixedEME)
63 document.getElementById(USE_PREFIXED_EME_ID).value = EME_PREFIXED_VERSION;
64 document.getElementById(USE_PLAY_TWICE_ELEMENT_ID).value = this.playTwice; 48 document.getElementById(USE_PLAY_TWICE_ELEMENT_ID).value = this.playTwice;
65 }; 49 };
66 50
67 TestConfig.init = function() { 51 TestConfig.init = function() {
68 // Reload test configuration from document. 52 // Reload test configuration from document.
69 this.mediaFile = document.getElementById(MEDIA_FILE_ELEMENT_ID).value; 53 this.mediaFile = document.getElementById(MEDIA_FILE_ELEMENT_ID).value;
70 this.keySystem = document.getElementById(KEYSYSTEM_ELEMENT_ID).value; 54 this.keySystem = document.getElementById(KEYSYSTEM_ELEMENT_ID).value;
71 this.mediaType = document.getElementById(MEDIA_TYPE_ELEMENT_ID).value; 55 this.mediaType = document.getElementById(MEDIA_TYPE_ELEMENT_ID).value;
72 this.useMSE = document.getElementById(USE_MSE_ELEMENT_ID).value == 'true'; 56 this.useMSE = document.getElementById(USE_MSE_ELEMENT_ID).value == 'true';
73 this.usePrefixedEME = document.getElementById(USE_PREFIXED_EME_ID).value ==
74 EME_PREFIXED_VERSION;
75 this.playTwice = 57 this.playTwice =
76 document.getElementById(USE_PLAY_TWICE_ELEMENT_ID).value == 'true'; 58 document.getElementById(USE_PLAY_TWICE_ELEMENT_ID).value == 'true';
77 this.licenseServerURL = 59 this.licenseServerURL =
78 document.getElementById(LICENSE_SERVER_ELEMENT_ID).value; 60 document.getElementById(LICENSE_SERVER_ELEMENT_ID).value;
79 }; 61 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698