| Index: tools/perf/page_sets/tough_video_cases/video.html
|
| diff --git a/tools/perf/page_sets/tough_video_cases/video.html b/tools/perf/page_sets/tough_video_cases/video.html
|
| index 24d82ca5cbea893c4bc638fb04303c234eefc56e..641d82237a04d8ab5e054e09d56e9c7eb5a9f8f8 100644
|
| --- a/tools/perf/page_sets/tough_video_cases/video.html
|
| +++ b/tools/perf/page_sets/tough_video_cases/video.html
|
| @@ -4,35 +4,54 @@
|
| </body>
|
| <script>
|
| function getQueryStrings() {
|
| - // Gets query parameters from the URL; e.g., given a URL like:
|
| - //
|
| - // http://<url>/my.html?test=123&bob=456
|
| - //
|
| - // returns params["test"] = 123, params["bob"]=456, etc.
|
| - var params = {};
|
| -
|
| - // RegEx to split out values by &.
|
| - var r = /([^&=]+)=?([^&]*)/g;
|
| -
|
| - // Lambda function for decoding extracted match values. Replaces '+' with
|
| - // space so decodeURIComponent functions properly.
|
| - function d(s) { return decodeURIComponent(s.replace(/\+/g, ' ')); }
|
| -
|
| - var match;
|
| - while (match = r.exec(window.location.search.substring(1)))
|
| + // Gets query parameters from the URL; e.g., given a URL like:
|
| + //
|
| + // http://<url>/my.html?test=123&bob=456
|
| + //
|
| + // returns params["test"] = 123, params["bob"]=456, etc.
|
| + var params = {};
|
| + // RegEx to split out values by &.
|
| + var r = /([^&=]+)=?([^&]*)/g;
|
| + // Lambda function for decoding extracted match values. Replaces '+' with
|
| + // space so decodeURIComponent functions properly.
|
| + function d(s) { return decodeURIComponent(s.replace(/\+/g, ' ')); }
|
| + var match;
|
| + while (match = r.exec(window.location.search.substring(1)))
|
| params[d(match[1])] = d(match[2]);
|
| + return params;
|
| + }
|
| + // Each network config = [DOWNLOAD_BANDWIDTH_Kbit/s, LATENCY_MS]
|
| + // Numbers are chosen to be similar to webpagereplay/net_configs.py
|
| + var netConfig = {};
|
| + netConfig['cable'] = [5120, 28];
|
| + netConfig['dsl'] = [1536, 50];
|
| + netConfig['wifi'] = [1024, 60];
|
| + netConfig['none'] = null;
|
| + // Constrained network server URL.
|
| + var CNS_BASE_URL = 'http://cns.chrome:9000/ServeConstrained?';
|
|
|
| - return params;
|
| + function getNetsimURL(net) {
|
| + if (!netConfig[net])
|
| + return CNS_BASE_URL;
|
| + return CNS_BASE_URL + 'bandwidth=' + netConfig[net][0] +
|
| + '&latency=' + netConfig[net][1]
|
| }
|
| - qsParams = getQueryStrings();
|
| - if (qsParams["type"]) {
|
| - testElement = document.createElement(qsParams["type"]);
|
| - if (qsParams["id"])
|
| - testElement.id = qsParams["id"];
|
| - testElement.preload = "none";
|
| - testElement.src = qsParams["src"];
|
| - testElement.controls = true;
|
| - document.body.appendChild(testElement);
|
| +
|
| + function getMediaSRC() {
|
| + var mediaSRC = qsParams['src']
|
| + if (qsParams['net'])
|
| + return getNetsimURL(qsParams['net']) + '&f=' + mediaSRC;
|
| + return mediaSRC;
|
| }
|
| +
|
| + qsParams = getQueryStrings();
|
| + var type = qsParams['type'] || 'video';
|
| + var testElement = document.createElement(type);
|
| + testElement.preload = 'none';
|
| + testElement.controls = true;
|
| + if (qsParams['id'])
|
| + testElement.id = qsParams['id'];
|
| + testElement.src = getMediaSRC();
|
| + document.body.appendChild(testElement);
|
| </script>
|
| </html>
|
|
|