summaryrefslogtreecommitdiff
path: root/deps/v8/build/android/pylib/local/device/local_device_instrumentation_test_run_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/build/android/pylib/local/device/local_device_instrumentation_test_run_test.py')
-rwxr-xr-xdeps/v8/build/android/pylib/local/device/local_device_instrumentation_test_run_test.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/deps/v8/build/android/pylib/local/device/local_device_instrumentation_test_run_test.py b/deps/v8/build/android/pylib/local/device/local_device_instrumentation_test_run_test.py
new file mode 100755
index 0000000000..fb96ee6bbd
--- /dev/null
+++ b/deps/v8/build/android/pylib/local/device/local_device_instrumentation_test_run_test.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env vpython
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Tests for local_device_instrumentation_test_run."""
+
+# pylint: disable=protected-access
+
+import unittest
+
+from pylib.base import base_test_result
+from pylib.base import mock_environment
+from pylib.base import mock_test_instance
+from pylib.local.device import local_device_instrumentation_test_run
+
+class LocalDeviceInstrumentationTestRunTest(unittest.TestCase):
+
+ # TODO(crbug.com/797002): Decide whether the _ShouldRetry hook is worth
+ # retaining and remove these tests if not.
+
+ def testShouldRetry_failure(self):
+ env = mock_environment.MockEnvironment()
+ ti = mock_test_instance.MockTestInstance()
+ obj = (local_device_instrumentation_test_run
+ .LocalDeviceInstrumentationTestRun(env, ti))
+ test = {
+ 'annotations': {},
+ 'class': 'SadTest',
+ 'method': 'testFailure',
+ 'is_junit4': True,
+ }
+ result = base_test_result.BaseTestResult(
+ 'SadTest.testFailure', base_test_result.ResultType.FAIL)
+ self.assertTrue(obj._ShouldRetry(test, result))
+
+ def testShouldRetry_retryOnFailure(self):
+ env = mock_environment.MockEnvironment()
+ ti = mock_test_instance.MockTestInstance()
+ obj = (local_device_instrumentation_test_run
+ .LocalDeviceInstrumentationTestRun(env, ti))
+ test = {
+ 'annotations': {'RetryOnFailure': None},
+ 'class': 'SadTest',
+ 'method': 'testRetryOnFailure',
+ 'is_junit4': True,
+ }
+ result = base_test_result.BaseTestResult(
+ 'SadTest.testRetryOnFailure', base_test_result.ResultType.FAIL)
+ self.assertTrue(obj._ShouldRetry(test, result))
+
+ def testShouldRetry_notRun(self):
+ env = mock_environment.MockEnvironment()
+ ti = mock_test_instance.MockTestInstance()
+ obj = (local_device_instrumentation_test_run
+ .LocalDeviceInstrumentationTestRun(env, ti))
+ test = {
+ 'annotations': {},
+ 'class': 'SadTest',
+ 'method': 'testNotRun',
+ 'is_junit4': True,
+ }
+ result = base_test_result.BaseTestResult(
+ 'SadTest.testNotRun', base_test_result.ResultType.NOTRUN)
+ self.assertTrue(obj._ShouldRetry(test, result))
+
+
+if __name__ == '__main__':
+ unittest.main(verbosity=2)