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

Side by Side Diff: content/test/data/media/media_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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 var QueryString = function() {
6 // Allows access to query parameters on the URL; e.g., given a URL like:
7 // http://<server>/my.html?test=123&bob=123
8 // Parameters can then be accessed via QueryString.test or QueryString.bob.
9 var params = {};
10 // RegEx to split out values by &.
11 var r = /([^&=]+)=?([^&]*)/g;
12 // Lambda function for decoding extracted match values. Replaces '+' with
13 // space so decodeURIComponent functions properly.
14 function d(s) { return decodeURIComponent(s.replace(/\+/g, ' ')); }
15 var match;
16 while (match = r.exec(window.location.search.substring(1)))
17 params[d(match[1])] = d(match[2]);
18 return params;
19 }();
20
21 function failTest(msg) {
22 var failMessage = msg;
23 if (msg instanceof Event)
24 failMessage = msg.target + '.' + msg.type;
25 console.log("FAILED TEST: " + msg);
26 setResultInTitle('FAILED');
27 }
28
29 var titleChanged = false;
30 function setResultInTitle(title) {
31 // If document title is 'ENDED', then update it with new title to possibly
32 // mark a test as failure. Otherwise, keep the first title change in place.
33 if (!titleChanged || document.title.toUpperCase() == 'ENDED')
34 document.title = title.toUpperCase();
35 console.log('Set document title to: ' + title + ', updated title: ' +
36 document.title);
37 titleChanged = true;
38 }
39
40 function installTitleEventHandler(element, event) {
41 element.addEventListener(event, function(e) {
42 setResultInTitle(event.toString());
43 }, false);
44 }
45
46 function convertToArray(input) {
47 if (Array.isArray(input))
48 return input;
49 return [input];
50 }
OLDNEW
« no previous file with comments | « content/test/data/media/media_source_utils.js ('k') | content/test/data/media/mse_config_change.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698