Chromium Code Reviews

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

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « build/android/pylib/device_settings.py ('k') | build/android/pylib/host_driven/test_server.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 logging 8 import logging
9 import os 9 import os
10 import shlex 10 import shlex
(...skipping 22 matching lines...)
33 self.suite_path = os.path.join( 33 self.suite_path = os.path.join(
34 constants.GetOutDirectory(), 'apks', '%s.apk' % suite_name) 34 constants.GetOutDirectory(), 'apks', '%s.apk' % suite_name)
35 self._package_info = constants.PACKAGE_INFO['content_browsertests'] 35 self._package_info = constants.PACKAGE_INFO['content_browsertests']
36 else: 36 else:
37 self.suite_path = os.path.join( 37 self.suite_path = os.path.join(
38 constants.GetOutDirectory(), '%s_apk' % suite_name, 38 constants.GetOutDirectory(), '%s_apk' % suite_name,
39 '%s-debug.apk' % suite_name) 39 '%s-debug.apk' % suite_name)
40 self._package_info = constants.PACKAGE_INFO['gtest'] 40 self._package_info = constants.PACKAGE_INFO['gtest']
41 41
42 def _CreateCommandLineFileOnDevice(self, device, options): 42 def _CreateCommandLineFileOnDevice(self, device, options):
43 command_line_file = tempfile.NamedTemporaryFile() 43 device.WriteFile(self._package_info.cmdline_file,
44 # GTest expects argv[0] to be the executable path. 44 self.suite_name + ' ' + options)
45 command_line_file.write(self.suite_name + ' ' + options)
46 command_line_file.flush()
47 device.PushChangedFiles([(
48 command_line_file.name,
49 self._package_info.cmdline_file)])
50 45
51 def _GetFifo(self): 46 def _GetFifo(self):
52 # The test.fifo path is determined by: 47 # The test.fifo path is determined by:
53 # testing/android/java/src/org/chromium/native_test/ 48 # testing/android/java/src/org/chromium/native_test/
54 # ChromeNativeTestActivity.java and 49 # ChromeNativeTestActivity.java and
55 # testing/android/native_test_launcher.cc 50 # testing/android/native_test_launcher.cc
56 return '/data/data/' + self._package_info.package + '/files/test.fifo' 51 return '/data/data/' + self._package_info.package + '/files/test.fifo'
57 52
58 def _ClearFifo(self, device): 53 def _ClearFifo(self, device):
59 device.RunShellCommand('rm -f ' + self._GetFifo()) 54 device.RunShellCommand('rm -f ' + self._GetFifo())
(...skipping 66 matching lines...)
126 self._StartActivity(device) 121 self._StartActivity(device)
127 finally: 122 finally:
128 self.tool.CleanUpEnvironment() 123 self.tool.CleanUpEnvironment()
129 logfile = android_commands.NewLineNormalizer(sys.stdout) 124 logfile = android_commands.NewLineNormalizer(sys.stdout)
130 return self._WatchFifo(device, timeout=10, logfile=logfile) 125 return self._WatchFifo(device, timeout=10, logfile=logfile)
131 126
132 #override 127 #override
133 def Install(self, device): 128 def Install(self, device):
134 self.tool.CopyFiles(device) 129 self.tool.CopyFiles(device)
135 device.Install(self.suite_path) 130 device.Install(self.suite_path)
OLDNEW
« no previous file with comments | « build/android/pylib/device_settings.py ('k') | build/android/pylib/host_driven/test_server.py » ('j') | no next file with comments »

Powered by Google App Engine