summaryrefslogtreecommitdiffstats
path: root/chrome/test/functional
diff options
context:
space:
mode:
authorshadi@chromium.org <shadi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-13 22:53:47 +0000
committershadi@chromium.org <shadi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-13 22:53:47 +0000
commitdde9195ed4690ae30322362d5d1f8b8b98deae09 (patch)
treedaecfaecf13506a04c1ba41837e034f11fa4d75c /chrome/test/functional
parent89c6202ef61755e8ec6e513096bc7ffb25818997 (diff)
downloadchromium_src-dde9195ed4690ae30322362d5d1f8b8b98deae09.zip
chromium_src-dde9195ed4690ae30322362d5d1f8b8b98deae09.tar.gz
chromium_src-dde9195ed4690ae30322362d5d1f8b8b98deae09.tar.bz2
Add video-play-percent to logs.
This cl does the followign: 1- detects if a video error or abort event gets fired. 2- prints the percentage of video that had played at the end of each test. BUG=109968 TEST=ran perf tests locally. Review URL: http://codereview.chromium.org/9148056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117716 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/functional')
-rwxr-xr-xchrome/test/functional/media/media_constrained_network_perf.py42
1 files changed, 33 insertions, 9 deletions
diff --git a/chrome/test/functional/media/media_constrained_network_perf.py b/chrome/test/functional/media/media_constrained_network_perf.py
index 73b1ce53..29ac2f1 100755
--- a/chrome/test/functional/media/media_constrained_network_perf.py
+++ b/chrome/test/functional/media/media_constrained_network_perf.py
@@ -105,18 +105,36 @@ class TestWorker(threading.Thread):
if tab['url'] == url:
return tab['index']
- def _HaveMetric(self, var_name, unique_url):
- """Checks if unique_url page has variable value ready. Set to < 0 pre-run.
+ def _HaveMetricOrError(self, var_name, unique_url):
+ """Checks if the page has variable value ready or if an error has occured.
+
+ The varaible value must be set to < 0 pre-run.
Args:
var_name: The variable name to check the metric for.
unique_url: The url of the page to check for the variable's metric.
+
+ Returns:
+ True is the var_name value is >=0 or if an error_msg exists.
"""
with self._automation_lock:
tab = self._FindTabLocked(unique_url)
self._metrics[var_name] = int(self._pyauto.GetDOMValue(var_name,
tab_index=tab))
- return self._metrics[var_name] >= 0
+ self._metrics['errorMsg'] = self._pyauto.GetDOMValue('errorMsg',
+ tab_index=tab)
+
+ return self._metrics[var_name] >= 0 or self._metrics['errorMsg'] != ''
+
+ def _GetVideoProgress(self, unique_url):
+ """Gets the video's current play progress percentage.
+
+ Args:
+ unique_url: The url of the page to check for video play progress.
+ """
+ with self._automation_lock:
+ return int(self._pyauto.CallJavascriptFunc(
+ 'calculateProgress', tab_index=self._FindTabLocked(unique_url)))
def run(self):
"""Opens tab, starts HTML test, and records metrics for each queue entry.
@@ -157,14 +175,14 @@ class TestWorker(threading.Thread):
# here since pyauto.WaitUntil doesn't call into Chrome.
self._metrics['epp'] = self._metrics['ttp'] = -1
self._pyauto.WaitUntil(
- self._HaveMetric, args=['ttp', unique_url], retry_sleep=1, timeout=10,
- debug=False)
+ self._HaveMetricOrError, args=['ttp', unique_url], retry_sleep=1,
+ timeout=10, debug=False)
# Do not wait for epp if ttp is not available.
series_name = ''.join(name)
if self._metrics['ttp'] >= 0:
self._pyauto.WaitUntil(
- self._HaveMetric, args=['epp', unique_url], retry_sleep=2,
+ self._HaveMetricOrError, args=['epp', unique_url], retry_sleep=2,
timeout=_TEST_VIDEO_DURATION_SEC * 10, debug=False)
# Record results.
@@ -173,9 +191,15 @@ class TestWorker(threading.Thread):
'%')
pyauto_utils.PrintPerfResult('ttp', series_name, self._metrics['ttp'],
'ms')
- else:
+ logging.debug('Test %s ended with %d%% of the video played.',
+ series_name, self._GetVideoProgress(unique_url))
+ elif self._metrics['errorMsg'] == '':
logging.error('Test %s timed-out.', series_name)
+ if self._metrics['errorMsg'] != '':
+ logging.debug('Test %s ended with error: %s', series_name,
+ self._metrics['errorMsg'])
+
# Close the tab.
with self._automation_lock:
self._pyauto.GetBrowserWindow(0).GetTab(
@@ -203,7 +227,7 @@ class ProcessLogger(threading.Thread):
line = True
while line:
line = self._process.stderr.readline()
- logging.debug(line)
+ logging.debug(line.strip())
class MediaConstrainedNetworkPerfTest(pyauto.PyUITest):
@@ -224,7 +248,7 @@ class MediaConstrainedNetworkPerfTest(pyauto.PyUITest):
line = True
while line:
line = process.stderr.readline()
- logging.debug(line)
+ logging.debug(line.strip())
if 'STARTED' in line:
self._server_pid = process.pid
pyauto.PyUITest.setUp(self)