OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
3 # | 3 # |
4 # Use of this source code is governed by a BSD-style license | 4 # Use of this source code is governed by a BSD-style license |
5 # that can be found in the LICENSE file in the root of the source | 5 # that can be found in the LICENSE file in the root of the source |
6 # tree. An additional intellectual property rights grant can be found | 6 # tree. An additional intellectual property rights grant can be found |
7 # in the file PATENTS. All contributing project authors may | 7 # in the file PATENTS. All contributing project authors may |
8 # be found in the AUTHORS file in the root of the source tree. | 8 # be found in the AUTHORS file in the root of the source tree. |
9 | 9 |
10 import os | 10 import os |
11 import unittest | 11 import unittest |
12 import sys | 12 import sys |
13 | 13 |
14 | 14 |
15 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 15 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
16 PARENT_DIR = os.path.join(SCRIPT_DIR, os.pardir) | 16 PARENT_DIR = os.path.join(SCRIPT_DIR, os.pardir) |
17 sys.path.append(PARENT_DIR) | 17 sys.path.append(PARENT_DIR) |
18 import low_bandwidth_audio_test | 18 import low_bandwidth_audio_test |
19 | 19 |
20 | 20 |
21 class TestExtractTestRuns(unittest.TestCase): | 21 class TestExtractTestRuns(unittest.TestCase): |
22 def _testLog(self, log, *expected): | 22 def _TestLog(self, log, *expected): |
23 self.assertEqual( | 23 self.assertEqual( |
24 tuple(low_bandwidth_audio_test.ExtractTestRuns(log.splitlines(True))), | 24 tuple(low_bandwidth_audio_test.ExtractTestRuns(log.splitlines(True))), |
25 expected) | 25 expected) |
26 | 26 |
27 def testLinux(self): | 27 def testLinux(self): |
28 self._testLog(LINUX_LOG, | 28 self._TestLog(LINUX_LOG, |
29 (None, 'GoodNetworkHighBitrate', | 29 (None, 'GoodNetworkHighBitrate', |
30 '/webrtc/src/resources/voice_engine/audio_tiny16.wav', | 30 '/webrtc/src/resources/voice_engine/audio_tiny16.wav', |
31 '/webrtc/src/out/LowBandwidth_GoodNetworkHighBitrate.wav'), | 31 '/webrtc/src/out/LowBandwidth_GoodNetworkHighBitrate.wav'), |
32 (None, 'Mobile2GNetwork', | 32 (None, 'Mobile2GNetwork', |
33 '/webrtc/src/resources/voice_engine/audio_tiny16.wav', | 33 '/webrtc/src/resources/voice_engine/audio_tiny16.wav', |
34 '/webrtc/src/out/LowBandwidth_Mobile2GNetwork.wav')) | 34 '/webrtc/src/out/LowBandwidth_Mobile2GNetwork.wav')) |
35 | 35 |
36 def testAndroid(self): | 36 def testAndroid(self): |
37 self._testLog(ANDROID_LOG, | 37 self._TestLog(ANDROID_LOG, |
38 ('ddfa6149', 'Mobile2GNetwork', | 38 ('ddfa6149', 'Mobile2GNetwork', |
39 '/sdcard/chromium_tests_root/resources/voice_engine/audio_tiny16.wav', | 39 '/sdcard/chromium_tests_root/resources/voice_engine/audio_tiny16.wav', |
40 '/sdcard/chromium_tests_root/LowBandwidth_Mobile2GNetwork.wav'), | 40 '/sdcard/chromium_tests_root/LowBandwidth_Mobile2GNetwork.wav'), |
41 ('TA99205CNO', 'GoodNetworkHighBitrate', | 41 ('TA99205CNO', 'GoodNetworkHighBitrate', |
42 '/sdcard/chromium_tests_root/resources/voice_engine/audio_tiny16.wav', | 42 '/sdcard/chromium_tests_root/resources/voice_engine/audio_tiny16.wav', |
43 '/sdcard/chromium_tests_root/LowBandwidth_GoodNetworkHighBitrate.wav')) | 43 '/sdcard/chromium_tests_root/LowBandwidth_GoodNetworkHighBitrate.wav')) |
44 | 44 |
45 | 45 |
46 LINUX_LOG = r'''\ | 46 LINUX_LOG = r'''\ |
47 [==========] Running 2 tests from 1 test case. | 47 [==========] Running 2 tests from 1 test case. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 C 16.605s Main [==========] 2 tests ran. | 175 C 16.605s Main [==========] 2 tests ran. |
176 C 16.605s Main [ PASSED ] 2 tests. | 176 C 16.605s Main [ PASSED ] 2 tests. |
177 C 16.605s Main **************************************************************
****************** | 177 C 16.605s Main **************************************************************
****************** |
178 I 16.608s tear_down_device(ddfa6149) Wrote device cache: /webrtc/src/out/debu
g-android/device_cache_ddea6549.json | 178 I 16.608s tear_down_device(ddfa6149) Wrote device cache: /webrtc/src/out/debu
g-android/device_cache_ddea6549.json |
179 I 16.608s tear_down_device(TA99205CNO) Wrote device cache: /webrtc/src/out/de
bug-android/device_cache_TA99305CMO.json | 179 I 16.608s tear_down_device(TA99205CNO) Wrote device cache: /webrtc/src/out/de
bug-android/device_cache_TA99305CMO.json |
180 ''' | 180 ''' |
181 | 181 |
182 | 182 |
183 if __name__ == "__main__": | 183 if __name__ == "__main__": |
184 unittest.main() | 184 unittest.main() |
OLD | NEW |