| 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 re | 7 import re |
| 8 import sys | 8 import sys |
| 9 | 9 |
| 10 import cmd_helper | 10 import cmd_helper |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 '/chrome-native-tests-command-line') | 50 '/chrome-native-tests-command-line') |
| 51 | 51 |
| 52 def _GetGTestReturnCode(self): | 52 def _GetGTestReturnCode(self): |
| 53 return None | 53 return None |
| 54 | 54 |
| 55 def _GetFifo(self): | 55 def _GetFifo(self): |
| 56 # The test.fifo path is determined by: | 56 # The test.fifo path is determined by: |
| 57 # testing/android/java/src/org/chromium/native_test/ | 57 # testing/android/java/src/org/chromium/native_test/ |
| 58 # ChromeNativeTestActivity.java and | 58 # ChromeNativeTestActivity.java and |
| 59 # testing/android/native_test_launcher.cc | 59 # testing/android/native_test_launcher.cc |
| 60 return os.path.join(self.adb.GetExternalStorage(), | 60 return '/data/data/org.chromium.native_test/files/test.fifo' |
| 61 'native_tests', 'test.fifo') | |
| 62 | 61 |
| 63 def _ClearFifo(self): | 62 def _ClearFifo(self): |
| 64 self.adb.RunShellCommand('rm -f ' + self._GetFifo()) | 63 self.adb.RunShellCommand('rm -f ' + self._GetFifo()) |
| 65 | 64 |
| 66 def _WatchFifo(self, timeout): | 65 def _WatchFifo(self, timeout): |
| 67 i = 0 | |
| 68 for i in range(5): | 66 for i in range(5): |
| 69 if self.adb.FileExistsOnDevice(self._GetFifo()): | 67 if self.adb.FileExistsOnDevice(self._GetFifo()): |
| 70 print 'Fifo created...' | 68 print 'Fifo created...' |
| 71 break | 69 break |
| 72 time.sleep(i) | 70 time.sleep(i) |
| 73 else: | 71 else: |
| 74 sys.exit('Unable to find fifo on device %s ' % self._GetFifo()) | 72 raise Exception('Unable to find fifo on device %s ' % self._GetFifo()) |
| 75 args = shlex.split(self.adb.Adb()._target_arg) | 73 args = shlex.split(self.adb.Adb()._target_arg) |
| 76 args += ['shell', 'cat', self._GetFifo()] | 74 args += ['shell', 'cat', self._GetFifo()] |
| 77 return pexpect.spawn('adb', args, timeout=timeout, logfile=sys.stdout) | 75 return pexpect.spawn('adb', args, timeout=timeout, logfile=sys.stdout) |
| 78 | 76 |
| 79 def GetAllTests(self): | 77 def GetAllTests(self): |
| 80 """Returns a list of all tests available in the test suite.""" | 78 """Returns a list of all tests available in the test suite.""" |
| 81 self._CreateTestRunnerScript('--gtest_list_tests') | 79 self._CreateTestRunnerScript('--gtest_list_tests') |
| 82 try: | 80 try: |
| 83 self.tool.SetupEnvironment() | 81 self.tool.SetupEnvironment() |
| 84 # Clear and start monitoring logcat. | 82 # Clear and start monitoring logcat. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 def StripAndCopyExecutable(self): | 115 def StripAndCopyExecutable(self): |
| 118 # Always uninstall the previous one (by activity name); we don't | 116 # Always uninstall the previous one (by activity name); we don't |
| 119 # know what was embedded in it. | 117 # know what was embedded in it. |
| 120 self.adb.ManagedInstall(self.test_suite_full, False, | 118 self.adb.ManagedInstall(self.test_suite_full, False, |
| 121 package_name='org.chromium.native_test') | 119 package_name='org.chromium.native_test') |
| 122 | 120 |
| 123 def _GetTestSuiteBaseName(self): | 121 def _GetTestSuiteBaseName(self): |
| 124 """Returns the base name of the test suite.""" | 122 """Returns the base name of the test suite.""" |
| 125 # APK test suite names end with '-debug.apk' | 123 # APK test suite names end with '-debug.apk' |
| 126 return os.path.basename(self.test_suite).rsplit('-debug', 1)[0] | 124 return os.path.basename(self.test_suite).rsplit('-debug', 1)[0] |
| OLD | NEW |