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

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

Issue 308553002: Integrate browser tests with new EME player. (Closed) Base URL: http://git.chromium.org/chromium/src.git@eme_player
Patch Set: Add support for FileIO and LoadSession test cases Created 6 years, 6 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 // Global test configuration used by media players. On each test run call 5 // Global test configuration used by media players. On each test run call
6 // TestConfig.init() to load new test configuration from the test page. 6 // TestConfig.init() to load new test configuration from the test page.
7 var TestConfig = new function() { 7 var TestConfig = new function() {
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.licenseServer = null; 11 this.licenseServerURL = null;
12 this.useSRC = false; 12 this.useSRC = false;
13 this.usePrefixedEME = false; 13 this.usePrefixedEME = false;
14 this.runFPS = false
14 } 15 }
15 16
16 TestConfig.updateDocument = function() { 17 TestConfig.loadQueryParams = function() {
17 Utils.addOptions(KEYSYSTEM_ELEMENT_ID, KEY_SYSTEMS);
18 Utils.addOptions(MEDIA_TYPE_ELEMENT_ID, MEDIA_TYPES);
19 Utils.addOptions(USE_PREFIXED_EME_ID, EME_VERSIONS_OPTIONS);
20
21 // Load query parameters and set default values. 18 // Load query parameters and set default values.
22 var r = /([^&=]+)=?([^&]*)/g; 19 var r = /([^&=]+)=?([^&]*)/g;
23 // Lambda function for decoding extracted match values. Replaces '+' with 20 // Lambda function for decoding extracted match values. Replaces '+' with
24 // space so decodeURIComponent functions properly. 21 // space so decodeURIComponent functions properly.
25 var decodeURI = function decodeURI(s) { 22 var decodeURI = function decodeURI(s) {
26 return decodeURIComponent(s.replace(/\+/g, ' ')); 23 return decodeURIComponent(s.replace(/\+/g, ' '));
27 }; 24 };
28 var match; 25 var match;
29 var params = {};
30 while (match = r.exec(window.location.search.substring(1))) 26 while (match = r.exec(window.location.search.substring(1)))
31 params[decodeURI(match[1])] = decodeURI(match[2]); 27 this[decodeURI(match[1])] = decodeURI(match[2]);
28
29 this.useSRC = this.useSRC == '1' || this.useSRC == 'true';
30 this.usePrefixedEME =
31 this.usePrefixedEME == '1' || this.usePrefixedEME == 'true';
32 };
33
34 TestConfig.updateDocument = function() {
35 this.loadQueryParams();
36 Utils.addOptions(KEYSYSTEM_ELEMENT_ID, KEY_SYSTEMS);
37 Utils.addOptions(MEDIA_TYPE_ELEMENT_ID, MEDIA_TYPES);
38 Utils.addOptions(USE_PREFIXED_EME_ID, EME_VERSIONS_OPTIONS);
32 39
33 document.getElementById(MEDIA_FILE_ELEMENT_ID).value = 40 document.getElementById(MEDIA_FILE_ELEMENT_ID).value =
34 params.mediaFile || DEFAULT_MEDIA_FILE; 41 this.mediaFile || DEFAULT_MEDIA_FILE;
35 42
36 document.getElementById(LICENSE_SERVER_ELEMENT_ID).value = 43 document.getElementById(LICENSE_SERVER_ELEMENT_ID).value =
37 params.licenseServer || DEFAULT_LICENSE_SERVER; 44 this.licenseServerURL || DEFAULT_LICENSE_SERVER;
38 45
39 if (params.keySystem) 46 if (this.keySystem)
40 document.getElementById(KEYSYSTEM_ELEMENT_ID).value = params.keySystem; 47 Utils.ensureOptionInList(KEYSYSTEM_ELEMENT_ID, this.keySystem);
41 if (params.mediaType) 48 // document.getElementById(KEYSYSTEM_ELEMENT_ID).value = this.keySystem;
42 document.getElementById(MEDIA_TYPE_ELEMENT_ID).value = params.mediaType; 49 if (this.mediaType)
43 if (params.useSRC) { 50 Utils.ensureOptionInList(MEDIA_TYPE_ELEMENT_ID, this.mediaType);
44 params.useSRC = params.useSRC == '1' || params.useSRC == 'true'; 51 //document.getElementById(MEDIA_TYPE_ELEMENT_ID).value = this.mediaType;
45 document.getElementById(USE_SRC_ELEMENT_ID).value = params.useSRC; 52 document.getElementById(USE_SRC_ELEMENT_ID).value = this.useSRC;
46 } 53 document.getElementById(USE_PREFIXED_EME_ID).value = this.usePrefixedEME;
47 if (params.usePrefixedEME) {
48 params.usePrefixedEME =
49 params.usePrefixedEME == '1' || params.usePrefixedEME == 'true';
50 document.getElementById(USE_PREFIXED_EME_ID).value = params.usePrefixedEME;
51 }
52 }; 54 };
53 55
54 TestConfig.init = function() { 56 TestConfig.init = function() {
55 // Reload test configuration from document. 57 // Reload test configuration from document.
56 this.mediaFile = document.getElementById(MEDIA_FILE_ELEMENT_ID).value; 58 this.mediaFile = document.getElementById(MEDIA_FILE_ELEMENT_ID).value;
57 this.keySystem = document.getElementById(KEYSYSTEM_ELEMENT_ID).value; 59 this.keySystem = document.getElementById(KEYSYSTEM_ELEMENT_ID).value;
58 this.mediaType = document.getElementById(MEDIA_TYPE_ELEMENT_ID).value; 60 this.mediaType = document.getElementById(MEDIA_TYPE_ELEMENT_ID).value;
59 this.useSRC = document.getElementById(USE_SRC_ELEMENT_ID).value == 'true'; 61 this.useSRC = document.getElementById(USE_SRC_ELEMENT_ID).value == 'true';
60 this.usePrefixedEME = 62 this.usePrefixedEME =
61 document.getElementById(USE_PREFIXED_EME_ID).value == 'true'; 63 document.getElementById(USE_PREFIXED_EME_ID).value == 'true';
62 this.licenseServer = document.getElementById(LICENSE_SERVER_ELEMENT_ID).value; 64 this.licenseServerURL =
65 document.getElementById(LICENSE_SERVER_ELEMENT_ID).value;
63 }; 66 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698