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

Side by Side Diff: build/android/pylib/python_test_base.py

Issue 11276054: Adding a new method to python tests on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 (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 """Base class for Android Python-driven tests. 5 """Base class for Android Python-driven tests.
6 6
7 This test case is intended to serve as the base class for any Python-driven 7 This test case is intended to serve as the base class for any Python-driven
8 tests. It is similar to the Python unitttest module in that the user's tests 8 tests. It is similar to the Python unitttest module in that the user's tests
9 inherit from this case and add their tests in that case. 9 inherit from this case and add their tests in that case.
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 def SetUp(self, options): 48 def SetUp(self, options):
49 self.options = options 49 self.options = options
50 self.shard_index = self.options.shard_index 50 self.shard_index = self.options.shard_index
51 self.device_id = self.options.device_id 51 self.device_id = self.options.device_id
52 self.adb = android_commands.AndroidCommands(self.device_id) 52 self.adb = android_commands.AndroidCommands(self.device_id)
53 self.ports_to_forward = [] 53 self.ports_to_forward = []
54 54
55 def TearDown(self): 55 def TearDown(self):
56 pass 56 pass
57 57
58 def GetOutDir(self):
59 return os.path.join(os.environ['CHROME_SRC'], 'out',
60 self.options.build_type)
61
58 def Run(self): 62 def Run(self):
59 logging.warning('Running Python-driven test: %s', self.test_name) 63 logging.warning('Running Python-driven test: %s', self.test_name)
60 return getattr(self, self.test_name)() 64 return getattr(self, self.test_name)()
61 65
62 def _RunJavaTest(self, fname, suite, test): 66 def _RunJavaTest(self, fname, suite, test):
63 """Runs a single Java test with a Java TestRunner. 67 """Runs a single Java test with a Java TestRunner.
64 68
65 Args: 69 Args:
66 fname: filename for the test (e.g. foo/bar/baz/tests/FooTest.py) 70 fname: filename for the test (e.g. foo/bar/baz/tests/FooTest.py)
67 suite: name of the Java test suite (e.g. FooTest) 71 suite: name of the Java test suite (e.g. FooTest)
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 163
160 def _ComposeFullTestName(self, fname, suite, test): 164 def _ComposeFullTestName(self, fname, suite, test):
161 package_name = self._GetPackageName(fname) 165 package_name = self._GetPackageName(fname)
162 return package_name + '.' + suite + '#' + test 166 return package_name + '.' + suite + '#' + test
163 167
164 def _GetPackageName(self, fname): 168 def _GetPackageName(self, fname):
165 """Extracts the package name from the test file path.""" 169 """Extracts the package name from the test file path."""
166 dirname = os.path.dirname(fname) 170 dirname = os.path.dirname(fname)
167 package = dirname[dirname.rfind(BASE_ROOT) + len(BASE_ROOT):] 171 package = dirname[dirname.rfind(BASE_ROOT) + len(BASE_ROOT):]
168 return package.replace(os.sep, '.') 172 return package.replace(os.sep, '.')
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698