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 clip. In | |
9 the ideal scenario we'd have zero latency processing script, seeking back to the | |
10 beginning of the clip, and resuming audio playback. | |
11 | |
12 Performance is recorded as the average latency of N playbacks. I.e., if we play | |
13 a clip 50 times and the ideal duration of all playbacks is 1000ms and the total | |
14 duration is 1500ms, the recorded result is (1500ms - 1000ms) / 50 == 10ms. | |
15 """ | |
16 import os | |
17 | |
18 import pyauto_media | |
19 import pyauto_utils | |
20 import pyauto | |
21 | |
22 | |
23 # HTML test path; relative to src/chrome/test/data. | |
24 _TEST_HTML_PATH = os.path.join('media', 'html', 'audio_latency_perf.html') | |
25 | |
26 | |
27 class AudioLatencyPerfTest(pyauto.PyUITest): | |
28 """PyAuto test container. See file doc string for more information.""" | |
29 | |
30 def testAudioLatency(self): | |
31 """Launches HTML test which runs the audio latency test.""" | |
32 self.NavigateToURL(self.GetFileURLForDataPath(_TEST_HTML_PATH)) | |
33 | |
34 # Block until the test finishes and notifies us. | |
35 self.assertTrue(self.ExecuteJavascript('startTest(true);')) | |
36 ideal_duration = int(self.GetDOMValue('idealDuration')) | |
37 actual_duration = int(self.GetDOMValue('actualDuration')) | |
38 loop_count = int(self.GetDOMValue('loopCount')) | |
39 | |
40 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
| |
41 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
| |
42 | |
43 | |
44 if __name__ == '__main__': | |
45 pyauto_media.Main() | |
OLD | NEW |