summaryrefslogtreecommitdiffstats
path: root/media/tools
diff options
context:
space:
mode:
authorshadi@chromium.org <shadi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-24 01:12:35 +0000
committershadi@chromium.org <shadi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-24 01:12:35 +0000
commit5f13770de8ac80ede136e0b9c26fcab253c5d30b (patch)
treefe200d711c67e4a1ab3380c673cc8f69aad0dd86 /media/tools
parentcb34e2d4328b9e67a3f49e11f1f17f1e7a892235 (diff)
downloadchromium_src-5f13770de8ac80ede136e0b9c26fcab253c5d30b.zip
chromium_src-5f13770de8ac80ede136e0b9c26fcab253c5d30b.tar.gz
chromium_src-5f13770de8ac80ede136e0b9c26fcab253c5d30b.tar.bz2
CNS seek tests for <video>.
We record seek performance using the product of: - Video formats: webm and ogv. - Network constraints: cable, wifi, and no constraints. - Seek cases: long, short, and buffered seeks. - Video location: cached and un-cached videos. BUG=122749 TEST=manual run Review URL: http://codereview.chromium.org/9960063 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133585 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/tools')
-rwxr-xr-xmedia/tools/constrained_network_server/cns.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/media/tools/constrained_network_server/cns.py b/media/tools/constrained_network_server/cns.py
index 94a8f49..dd8088f 100755
--- a/media/tools/constrained_network_server/cns.py
+++ b/media/tools/constrained_network_server/cns.py
@@ -185,7 +185,7 @@ class ConstrainedNetworkServer(object):
@cherrypy.expose
def ServeConstrained(self, f=None, bandwidth=None, latency=None, loss=None,
- new_port=False):
+ new_port=False, no_cache=False, **kwargs):
"""Serves the requested file with the requested constraints.
Subsequent requests for the same constraints from the same IP will share the
@@ -199,9 +199,16 @@ class ConstrainedNetworkServer(object):
latency: time to add to each packet (integer in ms).
loss: percentage of packets to drop (integer, 0-100).
new_port: whether to use a new port for this request or not.
+ no_cache: Set reponse's cache-control to no-cache.
"""
cherrypy.log('Got request for %s, bandwidth=%s, latency=%s, loss=%s, '
- 'new_port=%s' % (f, bandwidth, latency, loss, new_port))
+ 'new_port=%s, no_cache=%s, kwargs=%s' %
+ (f, bandwidth, latency, loss, new_port, no_cache, kwargs))
+ if no_cache:
+ response = cherrypy.response
+ response.headers['Pragma'] = 'no-cache'
+ response.headers['Cache-Control'] = 'no-cache'
+
# CherryPy is a bit wonky at detecting parameters, so just make them all
# optional and validate them ourselves.
if not f:
@@ -246,11 +253,14 @@ class ConstrainedNetworkServer(object):
cherrypy.log('Time to set up port %d = %ssec.' %
(constrained_port, end_time - start_time))
- # Build constrained URL. Only pass on the file parameter.
- constrained_url = '%s?f=%s' % (
+ # Build constrained URL using the constrained port and original URL
+ # parameters except the network constraints (bandwidth, latency, and loss).
+ constrained_url = '%s?f=%s&no_cache=%s&%s' % (
cherrypy.url().replace(
':%d' % self._options.port, ':%d' % constrained_port),
- f)
+ f,
+ no_cache,
+ '&'.join(['%s=%s' % (key, kwargs[key]) for key in kwargs]))
# Redirect request to the constrained port.
cherrypy.lib.cptools.redirect(constrained_url, internal=False)