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

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

Issue 1126543009: [Android] Refactor the native test wrappers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 import logging 5 import logging
6 import os 6 import os
7 import re 7 import re
8 import shutil 8 import shutil
9 import sys 9 import sys
10 10
11 from pylib import constants 11 from pylib import constants
12 from pylib.base import base_test_result 12 from pylib.base import base_test_result
13 from pylib.base import test_instance 13 from pylib.base import test_instance
14 14
15 sys.path.append(os.path.join( 15 sys.path.append(os.path.join(
16 constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib', 'common')) 16 constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib', 'common'))
17 import unittest_util 17 import unittest_util
18 18
19 19
20 BROWSER_TEST_FLAGS = [
21 # content::kSingleProcessTestsFlag
22 '--single_process',
Ted C 2015/05/05 23:11:17 Any reason we don't add these in the java side act
jbudorick 2015/05/06 18:00:00 Nope, and it's cleaner to do so.
23
24 # switches::kUseFakeDeviceForMediaStream
25 '--use-fake-device-for-media-stream',
26
27 # switches::kUseFakeUIForMediaStream,
28 '--use-fake-ui-for-media-stream',
29 ]
30 BROWSER_TEST_SUITES = [
31 'components_browsertests',
32 'content_browsertests',
33 ]
34
35
20 # Used for filtering large data deps at a finer grain than what's allowed in 36 # Used for filtering large data deps at a finer grain than what's allowed in
21 # isolate files since pushing deps to devices is expensive. 37 # isolate files since pushing deps to devices is expensive.
22 # Wildcards are allowed. 38 # Wildcards are allowed.
23 _DEPS_EXCLUSION_LIST = [ 39 _DEPS_EXCLUSION_LIST = [
24 'chrome/test/data/extensions/api_test', 40 'chrome/test/data/extensions/api_test',
25 'chrome/test/data/extensions/secure_shell', 41 'chrome/test/data/extensions/secure_shell',
26 'chrome/test/data/firefox*', 42 'chrome/test/data/firefox*',
27 'chrome/test/data/gpu', 43 'chrome/test/data/gpu',
28 'chrome/test/data/image_decoding', 44 'chrome/test/data/image_decoding',
29 'chrome/test/data/import', 45 'chrome/test/data/import',
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 101
86 class GtestTestInstance(test_instance.TestInstance): 102 class GtestTestInstance(test_instance.TestInstance):
87 103
88 def __init__(self, args, isolate_delegate, error_func): 104 def __init__(self, args, isolate_delegate, error_func):
89 super(GtestTestInstance, self).__init__() 105 super(GtestTestInstance, self).__init__()
90 # TODO(jbudorick): Support multiple test suites. 106 # TODO(jbudorick): Support multiple test suites.
91 if len(args.suite_name) > 1: 107 if len(args.suite_name) > 1:
92 raise ValueError('Platform mode currently supports only 1 gtest suite') 108 raise ValueError('Platform mode currently supports only 1 gtest suite')
93 self._suite = args.suite_name[0] 109 self._suite = args.suite_name[0]
94 110
95 if (self._suite == 'content_browsertests' or 111 if self._suite in BROWSER_TEST_SUITES:
96 self._suite == 'components_browsertests'): 112 self._flags = BROWSER_TEST_FLAGS
97 error_func('%s are not currently supported '
98 'in platform mode.' % self._suite)
99 self._apk_path = os.path.join(
100 constants.GetOutDirectory(), 'apks', '%s.apk' % self._suite)
101 else: 113 else:
102 self._apk_path = os.path.join( 114 self._flags = []
103 constants.GetOutDirectory(), '%s_apk' % self._suite, 115
104 '%s-debug.apk' % self._suite) 116 self._apk_path = os.path.join(
117 constants.GetOutDirectory(), '%s_apk' % self._suite,
118 '%s-debug.apk' % self._suite)
105 self._exe_path = os.path.join(constants.GetOutDirectory(), 119 self._exe_path = os.path.join(constants.GetOutDirectory(),
106 self._suite) 120 self._suite)
107 if not os.path.exists(self._apk_path): 121 if not os.path.exists(self._apk_path):
108 self._apk_path = None 122 self._apk_path = None
109 if not os.path.exists(self._exe_path): 123 if not os.path.exists(self._exe_path):
110 self._exe_path = None 124 self._exe_path = None
111 if not self._apk_path and not self._exe_path: 125 if not self._apk_path and not self._exe_path:
112 error_func('Could not find apk or executable for %s' % self._suite) 126 error_func('Could not find apk or executable for %s' % self._suite)
113 127
114 self._data_deps = [] 128 self._data_deps = []
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 244
231 @property 245 @property
232 def apk(self): 246 def apk(self):
233 return self._apk_path 247 return self._apk_path
234 248
235 @property 249 @property
236 def exe(self): 250 def exe(self):
237 return self._exe_path 251 return self._exe_path
238 252
239 @property 253 @property
254 def flags(self):
255 return self._flags
256
257 @property
240 def suite(self): 258 def suite(self):
241 return self._suite 259 return self._suite
242 260
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698