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

Unified 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: rebase head 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/perf/page_sets/tough_video_cases.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « 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