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

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

Issue 22933005: [android] Make build_type a singleton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix call to _LogToFile Created 7 years, 4 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 | Annotate | Revision Log
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 6
7 import logging 7 import logging
8 import os 8 import os
9 import shlex 9 import shlex
10 import sys 10 import sys
11 import tempfile 11 import tempfile
12 import time 12 import time
13 13
14 from pylib import android_commands 14 from pylib import android_commands
15 from pylib import cmd_helper 15 from pylib import cmd_helper
16 from pylib import constants 16 from pylib import constants
17 from pylib import pexpect 17 from pylib import pexpect
18 from pylib.android_commands import errors 18 from pylib.android_commands import errors
19 19
20 from test_package import TestPackage 20 from test_package import TestPackage
21 21
22 22
23 class TestPackageApk(TestPackage): 23 class TestPackageApk(TestPackage):
24 """A helper class for running APK-based native tests.""" 24 """A helper class for running APK-based native tests."""
25 25
26 def __init__(self, suite_name, build_type): 26 def __init__(self, suite_name):
27 """ 27 """
28 Args: 28 Args:
29 suite_name: Name of the test suite (e.g. base_unittests). 29 suite_name: Name of the test suite (e.g. base_unittests).
30 build_type: 'Release' or 'Debug'.
31 """ 30 """
32 TestPackage.__init__(self, suite_name) 31 TestPackage.__init__(self, suite_name)
33 product_dir = os.path.join(cmd_helper.OutDirectory.get(), build_type) 32 product_dir = os.path.join(cmd_helper.OutDirectory.get(),
33 constants.GetBuildType())
34 if suite_name == 'content_browsertests': 34 if suite_name == 'content_browsertests':
35 self.suite_path = os.path.join( 35 self.suite_path = os.path.join(
36 product_dir, 'apks', '%s.apk' % suite_name) 36 product_dir, 'apks', '%s.apk' % suite_name)
37 self._test_apk_package_name = constants.BROWSERTEST_TEST_PACKAGE_NAME 37 self._test_apk_package_name = constants.BROWSERTEST_TEST_PACKAGE_NAME
38 self._test_activity_name = constants.BROWSERTEST_TEST_ACTIVITY_NAME 38 self._test_activity_name = constants.BROWSERTEST_TEST_ACTIVITY_NAME
39 self._command_line_file = constants.BROWSERTEST_COMMAND_LINE_FILE 39 self._command_line_file = constants.BROWSERTEST_COMMAND_LINE_FILE
40 else: 40 else:
41 self.suite_path = os.path.join( 41 self.suite_path = os.path.join(
42 product_dir, '%s_apk' % suite_name, '%s-debug.apk' % suite_name) 42 product_dir, '%s_apk' % suite_name, '%s-debug.apk' % suite_name)
43 self._test_apk_package_name = constants.GTEST_TEST_PACKAGE_NAME 43 self._test_apk_package_name = constants.GTEST_TEST_PACKAGE_NAME
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 finally: 120 finally:
121 self.tool.CleanUpEnvironment() 121 self.tool.CleanUpEnvironment()
122 logfile = android_commands.NewLineNormalizer(sys.stdout) 122 logfile = android_commands.NewLineNormalizer(sys.stdout)
123 return self._WatchFifo(adb, timeout=10, logfile=logfile) 123 return self._WatchFifo(adb, timeout=10, logfile=logfile)
124 124
125 #override 125 #override
126 def Install(self, adb): 126 def Install(self, adb):
127 self.tool.CopyFiles() 127 self.tool.CopyFiles()
128 adb.ManagedInstall(self.suite_path, False, 128 adb.ManagedInstall(self.suite_path, False,
129 package_name=self._test_apk_package_name) 129 package_name=self._test_apk_package_name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698