summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshadi@chromium.org <shadi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-02 20:54:48 +0000
committershadi@chromium.org <shadi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-02 20:54:48 +0000
commit0500f7c19ae8407cfd5d9da3adeaa8bada15ca34 (patch)
tree35b34c170258b94b204859044e37fb04d30d51e9
parentd0ae86126a5a9df3068f38edd30ac22bb0a9f477 (diff)
downloadchromium_src-0500f7c19ae8407cfd5d9da3adeaa8bada15ca34.zip
chromium_src-0500f7c19ae8407cfd5d9da3adeaa8bada15ca34.tar.gz
chromium_src-0500f7c19ae8407cfd5d9da3adeaa8bada15ca34.tar.bz2
Update CNS to run on chromeperf34 and CNS tests to run on windows perf_av bot.
(Added OWNERS file to chrome/test/functional/media) BUG=139262 NOTRY=true TEST=none Review URL: https://chromiumcodereview.appspot.com/10825051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149695 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/test/functional/media/OWNERS3
-rw-r--r--chrome/test/functional/media/cns_test_base.py39
-rwxr-xr-xchrome/test/functional/media/media_constrained_network_perf.py7
-rwxr-xr-xchrome/test/functional/media/media_seek_perf.py5
-rwxr-xr-xmedia/tools/constrained_network_server/cns.py15
5 files changed, 48 insertions, 21 deletions
diff --git a/chrome/test/functional/media/OWNERS b/chrome/test/functional/media/OWNERS
new file mode 100644
index 0000000..aa43ab1
--- /dev/null
+++ b/chrome/test/functional/media/OWNERS
@@ -0,0 +1,3 @@
+dalecurtis@chromium.org
+scherkus@chromium.org
+shadi@chromium.org
diff --git a/chrome/test/functional/media/cns_test_base.py b/chrome/test/functional/media/cns_test_base.py
index bb48d54..b90932c 100644
--- a/chrome/test/functional/media/cns_test_base.py
+++ b/chrome/test/functional/media/cns_test_base.py
@@ -15,6 +15,8 @@ import urllib2
import pyauto
import pyauto_paths
+WINDOWS = 'win32' in sys.platform
+
# List of commonly used network constraints settings.
# Each setting is a tuppe of the form:
# ('TEST_NAME', [BANDWIDTH_Kbps, LATENCY_ms, PACKET_LOSS_%])
@@ -42,7 +44,10 @@ _CNS_PATH = os.path.join(
_CNS_PORT = 9000
# Base CNS URL, only requires & separated parameter names appended.
-CNS_BASE_URL = 'http://127.0.0.1:%d/ServeConstrained?' % _CNS_PORT
+if WINDOWS:
+ CNS_BASE_URL = 'http://chromeperf34.chrome:%d/ServeConstrained?' % _CNS_PORT
+else:
+ CNS_BASE_URL = 'http://127.0.0.1:%d/ServeConstrained?' % _CNS_PORT
# Used for server sanity check.
_TEST_VIDEO = 'roller.webm'
@@ -69,7 +74,22 @@ class CNSTestBase(pyauto.PyUITest):
pyauto.PyUITest.__init__(self, *args, **kwargs)
def setUp(self):
- """Starts the Constrained Network Server (CNS)."""
+ """Ensures the Constrained Network Server (CNS) server is up and running."""
+ if WINDOWS:
+ self._SetUpWin()
+ else:
+ self._SetUpLinux()
+
+ def _SetUpWin(self):
+ """Ensures the test can connect to the external CNS server."""
+ if self.WaitUntil(self._CanAccessServer, retry_sleep=3, timeout=30,
+ debug=False):
+ pyauto.PyUITest.setUp(self)
+ else:
+ self.fail('Failed to connect to CNS.')
+
+ def _SetUpLinux(self):
+ """Starts the CNS server locally."""
cmd = [sys.executable, os.path.join(pyauto_paths.GetSourceDir(), _CNS_PATH),
'--port', str(self._port),
'--interface', self._interface,
@@ -103,13 +123,14 @@ class CNSTestBase(pyauto.PyUITest):
def tearDown(self):
"""Stops the Constrained Network Server (CNS)."""
pyauto.PyUITest.tearDown(self)
- logging.debug('Stopping CNS server.')
- # Do not use process.kill(), it will not clean up cns.
- self.Kill(self._cns_process.pid)
- # Need to wait since the process logger has a lock on the process stderr.
- self._cns_process.wait()
- self.assertFalse(self._cns_process.returncode is None)
- logging.debug('CNS server stopped.')
+ if not WINDOWS:
+ logging.debug('Stopping CNS server.')
+ # Do not use process.kill(), it will not clean up cns.
+ self.Kill(self._cns_process.pid)
+ # Need to wait since the process logger has a lock on the process stderr.
+ self._cns_process.wait()
+ self.assertFalse(self._cns_process.returncode is None)
+ logging.debug('CNS server stopped.')
class ProcessLogger(threading.Thread):
diff --git a/chrome/test/functional/media/media_constrained_network_perf.py b/chrome/test/functional/media/media_constrained_network_perf.py
index d78567f..d06b82d 100755
--- a/chrome/test/functional/media/media_constrained_network_perf.py
+++ b/chrome/test/functional/media/media_constrained_network_perf.py
@@ -21,6 +21,7 @@ The CNS code is located under: <root>/src/media/tools/constrained_network_server
import logging
import os
+import posixpath
import Queue
import pyauto_media
@@ -54,14 +55,14 @@ _TEST_ITERATIONS = 3
# Media file names used for measuring epp and tpp.
_TEST_MEDIA_EPP = ['roller.webm']
-_TEST_MEDIA_EPP.extend(os.path.join('crowd', name) for name in
+_TEST_MEDIA_EPP.extend(posixpath.join('crowd', name) for name in
['crowd360.ogv', 'crowd.wav', 'crowd.ogg'])
# Media file names used for measuring tpp without epp.
-_TEST_MEDIA_NO_EPP = [os.path.join('dartmoor', name) for name in
+_TEST_MEDIA_NO_EPP = [posixpath.join('dartmoor', name) for name in
['dartmoor2.ogg', 'dartmoor2.m4a', 'dartmoor2.mp3',
'dartmoor2.wav']]
-_TEST_MEDIA_NO_EPP.extend(os.path.join('crowd', name) for name in
+_TEST_MEDIA_NO_EPP.extend(posixpath.join('crowd', name) for name in
['crowd1080.webm', 'crowd1080.ogv', 'crowd1080.mp4',
'crowd360.webm', 'crowd360.mp4'])
diff --git a/chrome/test/functional/media/media_seek_perf.py b/chrome/test/functional/media/media_seek_perf.py
index 98210c1..04d67e1 100755
--- a/chrome/test/functional/media/media_seek_perf.py
+++ b/chrome/test/functional/media/media_seek_perf.py
@@ -11,6 +11,7 @@ different network constraints.
import logging
import os
+import posixpath
import pyauto_media
import pyauto_utils
@@ -26,10 +27,10 @@ _TEST_HTML_PATH = os.path.join('media', 'html', 'media_seek.html')
# The media files used for testing.
# Path under CNS root folder (pyauto_private/media).
-_TEST_VIDEOS = [os.path.join('dartmoor', name) for name in
+_TEST_VIDEOS = [posixpath.join('dartmoor', name) for name in
['dartmoor2.ogg', 'dartmoor2.m4a', 'dartmoor2.mp3',
'dartmoor2.wav']]
-_TEST_VIDEOS.extend(os.path.join('crowd', name) for name in
+_TEST_VIDEOS.extend(posixpath.join('crowd', name) for name in
['crowd1080.webm', 'crowd1080.ogv', 'crowd1080.mp4',
'crowd360.webm', 'crowd360.ogv', 'crowd360.mp4'])
diff --git a/media/tools/constrained_network_server/cns.py b/media/tools/constrained_network_server/cns.py
index cf2257f..4fe31ee 100755
--- a/media/tools/constrained_network_server/cns.py
+++ b/media/tools/constrained_network_server/cns.py
@@ -13,6 +13,7 @@ TODO(dalecurtis): Add some more docs here.
"""
import logging
+from logging import handlers
import mimetypes
import optparse
import os
@@ -321,22 +322,22 @@ def ParseArgs():
# Convert the path to an absolute to remove any . or ..
options.www_root = os.path.abspath(options.www_root)
- # Required so that cherrypy logs do not get propagated to root logger causing
- # the logs to be printed twice.
- cherrypy.log.error_log.propagate = False
- cherrypy.log.access_log.propagate = False
-
_SetLogger(options.verbose)
return options
def _SetLogger(verbose):
- # Logging is used for traffic_control debug statements.
+ file_handler = handlers.RotatingFileHandler('cns.log', 'a', 10000000, 10)
+ file_handler.setFormatter(logging.Formatter('[%(threadName)s] %(message)s'))
+
log_level = _DEFAULT_LOG_LEVEL
if verbose:
log_level = logging.DEBUG
- logging.basicConfig(level=log_level, format='[%(threadName)s] %(message)s')
+ file_handler.setLevel(log_level)
+
+ cherrypy.log.error_log.addHandler(file_handler)
+ cherrypy.log.access_log.addHandler(file_handler)
def Main():