summaryrefslogtreecommitdiffstats
path: root/build/android
diff options
context:
space:
mode:
authorwnwen <wnwen@chromium.org>2016-01-12 08:40:10 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-12 16:41:04 +0000
commit2b56c1506cbc03f6a9a0a857a8726f73051e85c9 (patch)
tree99eb0c755a938553a23e3edc5156fb45e57468a2 /build/android
parent3de53402bbf3a7247141205d65603d79695a8811 (diff)
downloadchromium_src-2b56c1506cbc03f6a9a0a857a8726f73051e85c9.zip
chromium_src-2b56c1506cbc03f6a9a0a857a8726f73051e85c9.tar.gz
chromium_src-2b56c1506cbc03f6a9a0a857a8726f73051e85c9.tar.bz2
Add --strict-mode cmdline flag to test_runner.
Default flag is --strict-mode=testing to prevent any regressions in instrumentation tests. BUG=564863 Review URL: https://codereview.chromium.org/1540983002 Cr-Commit-Position: refs/heads/master@{#368895}
Diffstat (limited to 'build/android')
-rw-r--r--build/android/pylib/instrumentation/instrumentation_test_instance.py4
-rw-r--r--build/android/pylib/instrumentation/test_options.py3
-rw-r--r--build/android/pylib/instrumentation/test_runner.py2
-rwxr-xr-xbuild/android/test_runner.py7
4 files changed, 14 insertions, 2 deletions
diff --git a/build/android/pylib/instrumentation/instrumentation_test_instance.py b/build/android/pylib/instrumentation/instrumentation_test_instance.py
index 00ce2bc..3faaf39 100644
--- a/build/android/pylib/instrumentation/instrumentation_test_instance.py
+++ b/build/android/pylib/instrumentation/instrumentation_test_instance.py
@@ -344,6 +344,10 @@ class InstrumentationTestInstance(test_instance.TestInstance):
with open(args.device_flags_file) as device_flags_file:
stripped_lines = (l.strip() for l in device_flags_file)
self._flags.extend([flag for flag in stripped_lines if flag])
+ if (hasattr(args, 'strict_mode') and
+ args.strict_mode and
+ args.strict_mode != 'off'):
+ self._flags.append('--strict-mode=' + args.strict_mode)
def _initializeDriverAttributes(self):
self._driver_apk = os.path.join(
diff --git a/build/android/pylib/instrumentation/test_options.py b/build/android/pylib/instrumentation/test_options.py
index 0a3d5cd..0d9c46d 100644
--- a/build/android/pylib/instrumentation/test_options.py
+++ b/build/android/pylib/instrumentation/test_options.py
@@ -27,4 +27,5 @@ InstrumentationOptions = collections.namedtuple('InstrumentationOptions', [
'delete_stale_data',
'timeout_scale',
'apk_under_test',
- 'additional_apks'])
+ 'additional_apks',
+ 'strict_mode'])
diff --git a/build/android/pylib/instrumentation/test_runner.py b/build/android/pylib/instrumentation/test_runner.py
index 003a74c..7579bee 100644
--- a/build/android/pylib/instrumentation/test_runner.py
+++ b/build/android/pylib/instrumentation/test_runner.py
@@ -111,6 +111,8 @@ class TestRunner(base_test_runner.BaseTestRunner):
os.path.join(host_paths.DIR_SOURCE_ROOT), self._lighttp_port)
if self.flags:
flags_to_add = ['--disable-fre', '--enable-test-intents']
+ if self.options.strict_mode and self.options.strict_mode != 'off':
+ flags_to_add.append('--strict-mode=' + self.options.strict_mode)
if self.options.device_flags:
with open(self.options.device_flags) as device_flags_file:
stripped_flags = (l.strip() for l in device_flags_file)
diff --git a/build/android/test_runner.py b/build/android/test_runner.py
index c109e0a..f645a61 100755
--- a/build/android/test_runner.py
+++ b/build/android/test_runner.py
@@ -393,6 +393,10 @@ def AddInstrumentationTestOptions(parser):
help='Delete stale test data on the device.')
group.add_argument('--timeout-scale', type=float,
help='Factor by which timeouts should be scaled.')
+ group.add_argument('--strict-mode', dest='strict_mode', default='testing',
+ help='StrictMode command-line flag set on the device, '
+ 'death/testing to kill the process, off to stop '
+ 'checking, flash to flash only. Default testing.')
AddCommonOptions(parser)
AddDeviceOptions(parser)
@@ -455,7 +459,8 @@ def ProcessInstrumentationOptions(args):
args.delete_stale_data,
args.timeout_scale,
args.apk_under_test,
- args.additional_apks)
+ args.additional_apks,
+ args.strict_mode)
def AddUIAutomatorTestOptions(parser):