| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 import re | 7 import re |
| 8 import tempfile | 8 import tempfile |
| 9 | 9 |
| 10 from devil.android import apk_helper | 10 from devil.android import apk_helper |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 def __init__(self, args, isolate_delegate, error_func): | 131 def __init__(self, args, isolate_delegate, error_func): |
| 132 super(GtestTestInstance, self).__init__() | 132 super(GtestTestInstance, self).__init__() |
| 133 # TODO(jbudorick): Support multiple test suites. | 133 # TODO(jbudorick): Support multiple test suites. |
| 134 if len(args.suite_name) > 1: | 134 if len(args.suite_name) > 1: |
| 135 raise ValueError('Platform mode currently supports only 1 gtest suite') | 135 raise ValueError('Platform mode currently supports only 1 gtest suite') |
| 136 self._extract_test_list_from_filter = args.extract_test_list_from_filter | 136 self._extract_test_list_from_filter = args.extract_test_list_from_filter |
| 137 self._shard_timeout = args.shard_timeout | 137 self._shard_timeout = args.shard_timeout |
| 138 self._skip_clear_data = args.skip_clear_data | 138 self._skip_clear_data = args.skip_clear_data |
| 139 self._suite = args.suite_name[0] | 139 self._suite = args.suite_name[0] |
| 140 | 140 |
| 141 incremental_part = '_incremental' if args.incremental_install else '' | 141 self._exe_path = os.path.join(constants.GetOutDirectory(), |
| 142 self._suite) |
| 143 |
| 144 incremental_part = '' |
| 145 if args.test_apk_incremental_install_script: |
| 146 incremental_part = '_incremental' |
| 147 |
| 142 apk_path = os.path.join( | 148 apk_path = os.path.join( |
| 143 constants.GetOutDirectory(), '%s_apk' % self._suite, | 149 constants.GetOutDirectory(), '%s_apk' % self._suite, |
| 144 '%s-debug%s.apk' % (self._suite, incremental_part)) | 150 '%s-debug%s.apk' % (self._suite, incremental_part)) |
| 145 self._exe_path = os.path.join(constants.GetOutDirectory(), | 151 self._test_apk_incremental_install_script = ( |
| 146 self._suite) | 152 args.test_apk_incremental_install_script) |
| 147 if not os.path.exists(apk_path): | 153 if not os.path.exists(apk_path): |
| 148 self._apk_helper = None | 154 self._apk_helper = None |
| 149 else: | 155 else: |
| 150 self._apk_helper = apk_helper.ApkHelper(apk_path) | 156 self._apk_helper = apk_helper.ApkHelper(apk_path) |
| 151 self._extras = { | 157 self._extras = { |
| 152 _EXTRA_NATIVE_TEST_ACTIVITY: self._apk_helper.GetActivityName(), | 158 _EXTRA_NATIVE_TEST_ACTIVITY: self._apk_helper.GetActivityName(), |
| 153 } | 159 } |
| 154 if self._suite in RUN_IN_SUB_THREAD_TEST_SUITES: | 160 if self._suite in RUN_IN_SUB_THREAD_TEST_SUITES: |
| 155 self._extras[_EXTRA_RUN_IN_SUB_THREAD] = 1 | 161 self._extras[_EXTRA_RUN_IN_SUB_THREAD] = 1 |
| 156 if self._suite in BROWSER_TEST_SUITES: | 162 if self._suite in BROWSER_TEST_SUITES: |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 256 |
| 251 @property | 257 @property |
| 252 def skip_clear_data(self): | 258 def skip_clear_data(self): |
| 253 return self._skip_clear_data | 259 return self._skip_clear_data |
| 254 | 260 |
| 255 @property | 261 @property |
| 256 def suite(self): | 262 def suite(self): |
| 257 return self._suite | 263 return self._suite |
| 258 | 264 |
| 259 @property | 265 @property |
| 266 def test_apk_incremental_install_script(self): |
| 267 return self._test_apk_incremental_install_script |
| 268 |
| 269 @property |
| 260 def test_arguments(self): | 270 def test_arguments(self): |
| 261 return self._test_arguments | 271 return self._test_arguments |
| 262 | 272 |
| 263 @property | 273 @property |
| 264 def extract_test_list_from_filter(self): | 274 def extract_test_list_from_filter(self): |
| 265 return self._extract_test_list_from_filter | 275 return self._extract_test_list_from_filter |
| 266 | 276 |
| 267 #override | 277 #override |
| 268 def TestType(self): | 278 def TestType(self): |
| 269 return 'gtest' | 279 return 'gtest' |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 result_type = None | 379 result_type = None |
| 370 | 380 |
| 371 return results | 381 return results |
| 372 | 382 |
| 373 #override | 383 #override |
| 374 def TearDown(self): | 384 def TearDown(self): |
| 375 """Clear the mappings created by SetUp.""" | 385 """Clear the mappings created by SetUp.""" |
| 376 if self._isolate_delegate: | 386 if self._isolate_delegate: |
| 377 self._isolate_delegate.Clear() | 387 self._isolate_delegate.Clear() |
| 378 | 388 |
| OLD | NEW |