| 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 logging | 
| 6 import os | 7 import os | 
| 7 import shlex | 8 import shlex | 
| 8 import sys | 9 import sys | 
| 9 import tempfile | 10 import tempfile | 
| 10 import time | 11 import time | 
| 11 | 12 | 
| 12 from pylib import android_commands | 13 from pylib import android_commands | 
| 13 from pylib import constants | 14 from pylib import constants | 
| 14 from pylib import pexpect | 15 from pylib import pexpect | 
| 15 from pylib.android_commands import errors | 16 from pylib.android_commands import errors | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 56     #     ChromeNativeTestActivity.java and | 57     #     ChromeNativeTestActivity.java and | 
| 57     # testing/android/native_test_launcher.cc | 58     # testing/android/native_test_launcher.cc | 
| 58     return '/data/data/' + self._apk_package_name + '/files/test.fifo' | 59     return '/data/data/' + self._apk_package_name + '/files/test.fifo' | 
| 59 | 60 | 
| 60   def _ClearFifo(self): | 61   def _ClearFifo(self): | 
| 61     self.adb.RunShellCommand('rm -f ' + self._GetFifo()) | 62     self.adb.RunShellCommand('rm -f ' + self._GetFifo()) | 
| 62 | 63 | 
| 63   def _WatchFifo(self, timeout, logfile=None): | 64   def _WatchFifo(self, timeout, logfile=None): | 
| 64     for i in range(10): | 65     for i in range(10): | 
| 65       if self.adb.FileExistsOnDevice(self._GetFifo()): | 66       if self.adb.FileExistsOnDevice(self._GetFifo()): | 
| 66         print 'Fifo created...' | 67         logging.info('Fifo created.') | 
| 67         break | 68         break | 
| 68       time.sleep(i) | 69       time.sleep(i) | 
| 69     else: | 70     else: | 
| 70       raise errors.DeviceUnresponsiveError( | 71       raise errors.DeviceUnresponsiveError( | 
| 71           'Unable to find fifo on device %s ' % self._GetFifo()) | 72           'Unable to find fifo on device %s ' % self._GetFifo()) | 
| 72     args = shlex.split(self.adb.Adb()._target_arg) | 73     args = shlex.split(self.adb.Adb()._target_arg) | 
| 73     args += ['shell', 'cat', self._GetFifo()] | 74     args += ['shell', 'cat', self._GetFifo()] | 
| 74     return pexpect.spawn('adb', args, timeout=timeout, logfile=logfile) | 75     return pexpect.spawn('adb', args, timeout=timeout, logfile=logfile) | 
| 75 | 76 | 
| 76   def ClearApplicationState(self): | 77   def ClearApplicationState(self): | 
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 118     self.tool.CopyFiles() | 119     self.tool.CopyFiles() | 
| 119     # Always uninstall the previous one (by activity name); we don't | 120     # Always uninstall the previous one (by activity name); we don't | 
| 120     # know what was embedded in it. | 121     # know what was embedded in it. | 
| 121     self.adb.ManagedInstall(self.test_suite_full, False, | 122     self.adb.ManagedInstall(self.test_suite_full, False, | 
| 122                             package_name=self._apk_package_name) | 123                             package_name=self._apk_package_name) | 
| 123 | 124 | 
| 124   def _GetTestSuiteBaseName(self): | 125   def _GetTestSuiteBaseName(self): | 
| 125     """Returns the  base name of the test suite.""" | 126     """Returns the  base name of the test suite.""" | 
| 126     # APK test suite names end with '-debug.apk' | 127     # APK test suite names end with '-debug.apk' | 
| 127     return os.path.basename(self.test_suite).rsplit('-debug', 1)[0] | 128     return os.path.basename(self.test_suite).rsplit('-debug', 1)[0] | 
| OLD | NEW | 
|---|