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

Side by Side Diff: build/android/pylib/gtest/local_device_gtest_run.py

Issue 1124763003: Update from https://crrev.com/327068 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: update nacl, buildtools, fix display_change_notifier_unittest Created 5 years, 7 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
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 5
6 import logging 6 import logging
7 import os 7 import os
8 8
9 from pylib import constants 9 from pylib import constants
10 from pylib import ports 10 from pylib import ports
(...skipping 12 matching lines...) Expand all
23 _EXTRA_COMMAND_LINE_FILE = ( 23 _EXTRA_COMMAND_LINE_FILE = (
24 'org.chromium.native_test.ChromeNativeTestActivity.CommandLineFile') 24 'org.chromium.native_test.ChromeNativeTestActivity.CommandLineFile')
25 _EXTRA_COMMAND_LINE_FLAGS = ( 25 _EXTRA_COMMAND_LINE_FLAGS = (
26 'org.chromium.native_test.ChromeNativeTestActivity.CommandLineFlags') 26 'org.chromium.native_test.ChromeNativeTestActivity.CommandLineFlags')
27 27
28 _MAX_SHARD_SIZE = 256 28 _MAX_SHARD_SIZE = 256
29 29
30 # TODO(jbudorick): Move this up to the test instance if the net test server is 30 # TODO(jbudorick): Move this up to the test instance if the net test server is
31 # handled outside of the APK for the remote_device environment. 31 # handled outside of the APK for the remote_device environment.
32 _SUITE_REQUIRES_TEST_SERVER_SPAWNER = [ 32 _SUITE_REQUIRES_TEST_SERVER_SPAWNER = [
33 'content_unittests', 'content_browsertests', 'net_unittests', 'unit_tests' 33 'components_browsertests', 'content_unittests', 'content_browsertests',
34 'net_unittests', 'unit_tests'
34 ] 35 ]
35 36
36 class _ApkDelegate(object): 37 class _ApkDelegate(object):
37 def __init__(self, apk): 38 def __init__(self, apk):
38 self._apk = apk 39 self._apk = apk
39 self._package = apk_helper.GetPackageName(self._apk) 40 self._package = apk_helper.GetPackageName(self._apk)
40 self._runner = apk_helper.GetInstrumentationName(self._apk) 41 self._runner = apk_helper.GetInstrumentationName(self._apk)
41 self._component = '%s/%s' % (self._package, self._runner) 42 self._component = '%s/%s' % (self._package, self._runner)
42 self._enable_test_server_spawner = False 43 self._enable_test_server_spawner = False
43 44
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 # for long shell commands lands. 106 # for long shell commands lands.
106 with device_temp_file.DeviceTempFile(device.adb) as script_file: 107 with device_temp_file.DeviceTempFile(device.adb) as script_file:
107 script_contents = ' '.join(cmd) 108 script_contents = ' '.join(cmd)
108 logging.info('script contents: %r' % script_contents) 109 logging.info('script contents: %r' % script_contents)
109 device.WriteFile(script_file.name, script_contents) 110 device.WriteFile(script_file.name, script_contents)
110 output = device.RunShellCommand(['sh', script_file.name], cwd=cwd, 111 output = device.RunShellCommand(['sh', script_file.name], cwd=cwd,
111 env=env, **kwargs) 112 env=env, **kwargs)
112 return output 113 return output
113 114
114 def Clear(self, device): 115 def Clear(self, device):
115 try: 116 device.KillAll(self._exe_file_name, blocking=True, timeout=30, quiet=True)
116 device.KillAll(self._exe_file_name, blocking=True, timeout=30, retries=0)
117 except device_errors.CommandFailedError:
118 # Raised if there is no process with the given name, which in this case
119 # is all we care about.
120 pass
121 117
122 118
123 class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun): 119 class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun):
124 120
125 def __init__(self, env, test_instance): 121 def __init__(self, env, test_instance):
126 assert isinstance(env, local_device_environment.LocalDeviceEnvironment) 122 assert isinstance(env, local_device_environment.LocalDeviceEnvironment)
127 assert isinstance(test_instance, gtest_test_instance.GtestTestInstance) 123 assert isinstance(test_instance, gtest_test_instance.GtestTestInstance)
128 super(LocalDeviceGtestRun, self).__init__(env, test_instance) 124 super(LocalDeviceGtestRun, self).__init__(env, test_instance)
129 125
130 if self._test_instance.apk: 126 if self._test_instance.apk:
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 return results 197 return results
202 198
203 #override 199 #override
204 def TearDown(self): 200 def TearDown(self):
205 def individual_device_tear_down(dev): 201 def individual_device_tear_down(dev):
206 for s in self._servers[str(dev)]: 202 for s in self._servers[str(dev)]:
207 s.TearDown() 203 s.TearDown()
208 204
209 self._env.parallel_devices.pMap(individual_device_tear_down) 205 self._env.parallel_devices.pMap(individual_device_tear_down)
210 206
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698