Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(537)

Side by Side Diff: build/android/pylib/local/device/local_device_gtest_run.py

Issue 1398953002: Android gtest runner: Create only a single ApkHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gtest-faster-10
Patch Set: rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/pylib/gtest/gtest_test_instance.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 itertools 5 import itertools
6 import os 6 import os
7 import posixpath 7 import posixpath
8 8
9 from devil.android import device_errors 9 from devil.android import device_errors
10 from devil.android import device_temp_file 10 from devil.android import device_temp_file
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 host_file_base, ext = os.path.splitext(host_file) 48 host_file_base, ext = os.path.splitext(host_file)
49 for i in itertools.count(): 49 for i in itertools.count():
50 host_file = '%s_%d%s' % (host_file_base, i, ext) 50 host_file = '%s_%d%s' % (host_file_base, i, ext)
51 if not os.path.exists(host_file): 51 if not os.path.exists(host_file):
52 break 52 break
53 device.PullFile(device_file, host_file) 53 device.PullFile(device_file, host_file)
54 54
55 class _ApkDelegate(object): 55 class _ApkDelegate(object):
56 def __init__(self, test_instance): 56 def __init__(self, test_instance):
57 self._activity = test_instance.activity 57 self._activity = test_instance.activity
58 self._apk = test_instance.apk 58 self._apk_helper = test_instance.apk_helper
59 self._package = test_instance.package 59 self._package = test_instance.package
60 self._runner = test_instance.runner 60 self._runner = test_instance.runner
61 self._permissions = test_instance.permissions 61 self._permissions = test_instance.permissions
62 62
63 self._component = '%s/%s' % (self._package, self._runner) 63 self._component = '%s/%s' % (self._package, self._runner)
64 self._extras = test_instance.extras 64 self._extras = test_instance.extras
65 65
66 def Install(self, device): 66 def Install(self, device):
67 device.Install(self._apk, permissions=self._permissions) 67 device.Install(self._apk_helper, permissions=self._permissions)
68 68
69 def Run(self, test, device, flags=None, **kwargs): 69 def Run(self, test, device, flags=None, **kwargs):
70 extras = dict(self._extras) 70 extras = dict(self._extras)
71 71
72 if ('timeout' in kwargs 72 if ('timeout' in kwargs
73 and gtest_test_instance.EXTRA_SHARD_NANO_TIMEOUT not in extras): 73 and gtest_test_instance.EXTRA_SHARD_NANO_TIMEOUT not in extras):
74 # Make sure the instrumentation doesn't kill the test before the 74 # Make sure the instrumentation doesn't kill the test before the
75 # scripts do. The provided timeout value is in seconds, but the 75 # scripts do. The provided timeout value is in seconds, but the
76 # instrumentation deals with nanoseconds because that's how Android 76 # instrumentation deals with nanoseconds because that's how Android
77 # handles time. 77 # handles time.
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 return results 253 return results
254 254
255 #override 255 #override
256 def TearDown(self): 256 def TearDown(self):
257 @local_device_test_run.handle_shard_failures 257 @local_device_test_run.handle_shard_failures
258 def individual_device_tear_down(dev): 258 def individual_device_tear_down(dev):
259 for s in self._servers.get(str(dev), []): 259 for s in self._servers.get(str(dev), []):
260 s.TearDown() 260 s.TearDown()
261 261
262 self._env.parallel_devices.pMap(individual_device_tear_down) 262 self._env.parallel_devices.pMap(individual_device_tear_down)
OLDNEW
« no previous file with comments | « build/android/pylib/gtest/gtest_test_instance.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698