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

Unified Diff: chrome/test/functional/media/audio_latency_perf.py

Issue 10411007: Add new PyAuto test for measuring audio tag latency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup. Created 8 years, 7 months 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
Index: chrome/test/functional/media/audio_latency_perf.py
diff --git a/chrome/test/functional/media/audio_latency_perf.py b/chrome/test/functional/media/audio_latency_perf.py
new file mode 100755
index 0000000000000000000000000000000000000000..76e56c69a1ad796c952afc07327f40878b063775
--- /dev/null
+++ b/chrome/test/functional/media/audio_latency_perf.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Audio latency performance test.
+
+Benchmark measuring how fast we can continuously repeat a short sound clip. In
+the ideal scenario we'd have zero latency processing script, seeking back to the
+beginning of the clip, and resuming audio playback.
+
+Performance is recorded as the average latency of N playbacks. I.e., if we play
+a clip 50 times and the ideal duration of all playbacks is 1000ms and the total
+duration is 1500ms, the recorded result is (1500ms - 1000ms) / 50 == 10ms.
+"""
+import os
+
+import pyauto_media
+import pyauto_utils
+import pyauto
+
+
+# HTML test path; relative to src/chrome/test/data.
+_TEST_HTML_PATH = os.path.join('media', 'html', 'audio_latency_perf.html')
+
+
+class AudioLatencyPerfTest(pyauto.PyUITest):
+ """PyAuto test container. See file doc string for more information."""
+
+ def testAudioLatency(self):
+ """Launches HTML test which runs the audio latency test."""
+ self.NavigateToURL(self.GetFileURLForDataPath(_TEST_HTML_PATH))
+
+ # Block until the test finishes and notifies us.
+ self.assertTrue(self.ExecuteJavascript('startTest(true);'))
+ ideal_duration = int(self.GetDOMValue('idealDuration'))
+ actual_duration = int(self.GetDOMValue('actualDuration'))
+ loop_count = int(self.GetDOMValue('loopCount'))
+
+ latency = float(actual_duration - ideal_duration) / loop_count
shadi 2012/05/17 22:03:37 Is there a preference for calculating this here ra
DaleCurtis 2012/05/18 00:23:36 Good point. I'll move the calculation into the pag
+ pyauto_utils.PrintPerfResult('audio_latency', 'latency', latency, 'ms')
shadi 2012/05/17 22:03:37 Is the plan to just test the .wav file? If we want
DaleCurtis 2012/05/18 00:23:36 No, just the wav file, test should be format agnos
+
+
+if __name__ == '__main__':
+ pyauto_media.Main()
« chrome/test/data/media/html/audio_latency_perf.html ('K') | « chrome/test/functional/PYAUTO_TESTS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698