| 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 """Defines TestPackageApk to help run APK-based native tests.""" | 5 """Defines TestPackageApk to help run APK-based native tests.""" |
| 6 # pylint: disable=W0212 | 6 # pylint: disable=W0212 |
| 7 | 7 |
| 8 import itertools |
| 8 import logging | 9 import logging |
| 9 import os | 10 import os |
| 11 import posixpath |
| 10 import shlex | 12 import shlex |
| 11 import sys | 13 import sys |
| 12 import tempfile | 14 import tempfile |
| 13 import time | 15 import time |
| 14 | 16 |
| 15 from pylib import android_commands | 17 from pylib import android_commands |
| 16 from pylib import constants | 18 from pylib import constants |
| 17 from pylib import pexpect | 19 from pylib import pexpect |
| 18 from pylib.device import device_errors | 20 from pylib.device import device_errors |
| 19 from pylib.device import intent | 21 from pylib.device import intent |
| 20 from pylib.gtest import gtest_test_instance | 22 from pylib.gtest import gtest_test_instance |
| 23 from pylib.gtest import local_device_gtest_run |
| 21 from pylib.gtest.test_package import TestPackage | 24 from pylib.gtest.test_package import TestPackage |
| 22 | 25 |
| 23 | 26 |
| 24 class TestPackageApk(TestPackage): | 27 class TestPackageApk(TestPackage): |
| 25 """A helper class for running APK-based native tests.""" | 28 """A helper class for running APK-based native tests.""" |
| 26 | 29 |
| 27 def __init__(self, suite_name): | 30 def __init__(self, suite_name): |
| 28 """ | 31 """ |
| 29 Args: | 32 Args: |
| 30 suite_name: Name of the test suite (e.g. base_unittests). | 33 suite_name: Name of the test suite (e.g. base_unittests). |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 self._StartActivity(device, force_stop=False) | 137 self._StartActivity(device, force_stop=False) |
| 135 finally: | 138 finally: |
| 136 self.tool.CleanUpEnvironment() | 139 self.tool.CleanUpEnvironment() |
| 137 logfile = android_commands.NewLineNormalizer(sys.stdout) | 140 logfile = android_commands.NewLineNormalizer(sys.stdout) |
| 138 return self._WatchFifo(device, timeout=10, logfile=logfile) | 141 return self._WatchFifo(device, timeout=10, logfile=logfile) |
| 139 | 142 |
| 140 #override | 143 #override |
| 141 def Install(self, device): | 144 def Install(self, device): |
| 142 self.tool.CopyFiles(device) | 145 self.tool.CopyFiles(device) |
| 143 device.Install(self.suite_path) | 146 device.Install(self.suite_path) |
| 147 |
| 148 #override |
| 149 def PullAppFiles(self, device, files, directory): |
| 150 local_device_gtest_run.PullAppFilesImpl( |
| 151 device, self._package_info.package, files, directory) |
| OLD | NEW |