| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 """Audio latency performance test. | |
| 7 | |
| 8 Benchmark measuring how fast we can continuously repeat a short sound | |
| 9 clip, while another clip is running in the background. In the ideal | |
| 10 scenario we'd have zero latency processing script, seeking back to the | |
| 11 beginning of the clip, and resuming audio playback. | |
| 12 | |
| 13 Performance is recorded as the average latency of N playbacks. I.e., if we play | |
| 14 a clip 50 times and the ideal duration of all playbacks is 1000ms and the total | |
| 15 duration is 1500ms, the recorded result is (1500ms - 1000ms) / 50 == 10ms. | |
| 16 """ | |
| 17 import os | |
| 18 | |
| 19 import pyauto_media | |
| 20 import pyauto_utils | |
| 21 import pyauto | |
| 22 | |
| 23 | |
| 24 # HTML test path; relative to src/chrome/test/data. | |
| 25 _TEST_HTML_PATH = os.path.join('media', 'html', 'mixed_audio_latency_perf.html') | |
| 26 | |
| 27 | |
| 28 class MixedAudioLatencyPerfTest(pyauto.PyUITest): | |
| 29 """PyAuto test container. See file doc string for more information.""" | |
| 30 | |
| 31 def testAudioLatency(self): | |
| 32 """Launches HTML test which runs the audio latency test.""" | |
| 33 self.NavigateToURL(self.GetFileURLForDataPath(_TEST_HTML_PATH)) | |
| 34 | |
| 35 # Block until the test finishes and notifies us. | |
| 36 self.assertTrue(self.ExecuteJavascript('startTest();')) | |
| 37 latency = float(self.GetDOMValue('averageLatency')) | |
| 38 pyauto_utils.PrintPerfResult('audio_latency', 'latency_bg_clip', latency, | |
| 39 'ms') | |
| 40 | |
| 41 | |
| 42 if __name__ == '__main__': | |
| 43 pyauto_media.Main() | |
| OLD | NEW |