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

Side by Side Diff: tools/perf/page_sets/tough_video_cases/video.html

Issue 91623004: Add media perf benchamrk under network simulations. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <body> 3 <body>
4 </body> 4 </body>
5 <script> 5 <script>
6 function getQueryStrings() { 6 function getQueryStrings() {
7 // Gets query parameters from the URL; e.g., given a URL like: 7 // Gets query parameters from the URL; e.g., given a URL like:
8 // 8 //
9 // http://<url>/my.html?test=123&bob=456 9 // http://<url>/my.html?test=123&bob=456
10 // 10 //
11 // returns params["test"] = 123, params["bob"]=456, etc. 11 // returns params["test"] = 123, params["bob"]=456, etc.
12 var params = {}; 12 var params = {};
13 // RegEx to split out values by &.
14 var r = /([^&=]+)=?([^&]*)/g;
15 // Lambda function for decoding extracted match values. Replaces '+' with
16 // space so decodeURIComponent functions properly.
17 function d(s) { return decodeURIComponent(s.replace(/\+/g, ' ')); }
18 var match;
19 while (match = r.exec(window.location.search.substring(1)))
20 params[d(match[1])] = d(match[2]);
21 return params;
22 }
23 // Each network config = [DOWNLOAD_BANDWIDTH_Kbit/s, LATENCY_MS]
24 // Numbers are chosen to be similar to webpagereplay/net_configs.py
25 var netConfig = {};
26 netConfig['cable'] = [5120, 28];
27 netConfig['dsl'] = [1536, 50];
28 netConfig['wifi'] = [1024, 60];
29 netConfig['none'] = null;
30 // Constrained network server URL.
31 var CNS_BASE_URL = 'http://cns.chrome:9000/ServeConstrained?';
13 32
14 // RegEx to split out values by &. 33 function getNetsimURL(net) {
15 var r = /([^&=]+)=?([^&]*)/g; 34 if (!netConfig[net])
35 return CNS_BASE_URL;
36 return CNS_BASE_URL + 'bandwidth=' + netConfig[net][0] +
37 '&latency=' + netConfig[net][1]
38 }
16 39
17 // Lambda function for decoding extracted match values. Replaces '+' with 40 function getMediaSRC() {
18 // space so decodeURIComponent functions properly. 41 var mediaSRC = qsParams['src']
19 function d(s) { return decodeURIComponent(s.replace(/\+/g, ' ')); } 42 if (qsParams['net'])
43 return getNetsimURL(qsParams['net']) + '&f=' + mediaSRC;
44 return mediaSRC;
45 }
20 46
21 var match;
22 while (match = r.exec(window.location.search.substring(1)))
23 params[d(match[1])] = d(match[2]);
24
25 return params;
26 }
27 qsParams = getQueryStrings(); 47 qsParams = getQueryStrings();
28 if (qsParams["type"]) { 48 var type = qsParams['type'] || 'video';
29 testElement = document.createElement(qsParams["type"]); 49 var testElement = document.createElement(type);
30 if (qsParams["id"]) 50 testElement.preload = 'none';
31 testElement.id = qsParams["id"]; 51 testElement.controls = true;
32 testElement.preload = "none"; 52 if (qsParams['id'])
33 testElement.src = qsParams["src"]; 53 testElement.id = qsParams['id'];
34 testElement.controls = true; 54 testElement.src = getMediaSRC();
35 document.body.appendChild(testElement); 55 document.body.appendChild(testElement);
36 }
37 </script> 56 </script>
38 </html> 57 </html>
OLDNEW
« tools/perf/metrics/media.py ('K') | « tools/perf/page_sets/tough_video_cases.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698