OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 import os | 6 import os |
7 import pexpect | 7 import pexpect |
8 import shlex | 8 import shlex |
9 import sys | 9 import sys |
10 import tempfile | 10 import tempfile |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 # The test.fifo path is determined by: | 53 # The test.fifo path is determined by: |
54 # testing/android/java/src/org/chromium/native_test/ | 54 # testing/android/java/src/org/chromium/native_test/ |
55 # ChromeNativeTestActivity.java and | 55 # ChromeNativeTestActivity.java and |
56 # testing/android/native_test_launcher.cc | 56 # testing/android/native_test_launcher.cc |
57 return '/data/data/org.chromium.native_test/files/test.fifo' | 57 return '/data/data/org.chromium.native_test/files/test.fifo' |
58 | 58 |
59 def _ClearFifo(self): | 59 def _ClearFifo(self): |
60 self.adb.RunShellCommand('rm -f ' + self._GetFifo()) | 60 self.adb.RunShellCommand('rm -f ' + self._GetFifo()) |
61 | 61 |
62 def _WatchFifo(self, timeout, logfile=None): | 62 def _WatchFifo(self, timeout, logfile=None): |
63 for i in range(5): | 63 for i in range(10): |
64 if self.adb.FileExistsOnDevice(self._GetFifo()): | 64 if self.adb.FileExistsOnDevice(self._GetFifo()): |
65 print 'Fifo created...' | 65 print 'Fifo created...' |
66 break | 66 break |
67 time.sleep(i) | 67 time.sleep(i) |
68 else: | 68 else: |
69 raise Exception('Unable to find fifo on device %s ' % self._GetFifo()) | 69 raise Exception('Unable to find fifo on device %s ' % self._GetFifo()) |
70 args = shlex.split(self.adb.Adb()._target_arg) | 70 args = shlex.split(self.adb.Adb()._target_arg) |
71 args += ['shell', 'cat', self._GetFifo()] | 71 args += ['shell', 'cat', self._GetFifo()] |
72 return pexpect.spawn('adb', args, timeout=timeout, logfile=logfile) | 72 return pexpect.spawn('adb', args, timeout=timeout, logfile=logfile) |
73 | 73 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 def StripAndCopyExecutable(self): | 113 def StripAndCopyExecutable(self): |
114 # Always uninstall the previous one (by activity name); we don't | 114 # Always uninstall the previous one (by activity name); we don't |
115 # know what was embedded in it. | 115 # know what was embedded in it. |
116 self.adb.ManagedInstall(self.test_suite_full, False, | 116 self.adb.ManagedInstall(self.test_suite_full, False, |
117 package_name='org.chromium.native_test') | 117 package_name='org.chromium.native_test') |
118 | 118 |
119 def _GetTestSuiteBaseName(self): | 119 def _GetTestSuiteBaseName(self): |
120 """Returns the base name of the test suite.""" | 120 """Returns the base name of the test suite.""" |
121 # APK test suite names end with '-debug.apk' | 121 # APK test suite names end with '-debug.apk' |
122 return os.path.basename(self.test_suite).rsplit('-debug', 1)[0] | 122 return os.path.basename(self.test_suite).rsplit('-debug', 1)[0] |
OLD | NEW |