| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Unit tests for instrumentation_test_instance.""" | 6 """Unit tests for instrumentation_test_instance.""" |
| 7 | 7 |
| 8 # pylint: disable=protected-access | 8 # pylint: disable=protected-access |
| 9 | 9 |
| 10 import collections | 10 import collections |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 mock.MagicMock(), mock.MagicMock(), lambda s: None) | 41 mock.MagicMock(), mock.MagicMock(), lambda s: None) |
| 42 | 42 |
| 43 _FlagAttributesArgs = collections.namedtuple( | 43 _FlagAttributesArgs = collections.namedtuple( |
| 44 '_FlagAttributesArgs', | 44 '_FlagAttributesArgs', |
| 45 [ | 45 [ |
| 46 'command_line_flags', | 46 'command_line_flags', |
| 47 'device_flags_file', | 47 'device_flags_file', |
| 48 'strict_mode', | 48 'strict_mode', |
| 49 'regenerate_goldens', | 49 'regenerate_goldens', |
| 50 'test_arguments', | 50 'test_arguments', |
| 51 'gs_results_bucket', |
| 51 ]) | 52 ]) |
| 52 | 53 |
| 53 def createFlagAttributesArgs( | 54 def createFlagAttributesArgs( |
| 54 self, command_line_flags=None, device_flags_file=None, | 55 self, command_line_flags=None, device_flags_file=None, |
| 55 strict_mode=None, regenerate_goldens=None, test_arguments=None): | 56 strict_mode=None, regenerate_goldens=None, test_arguments=None, |
| 57 gs_results_bucket=None): |
| 56 return self._FlagAttributesArgs( | 58 return self._FlagAttributesArgs( |
| 57 command_line_flags, device_flags_file, strict_mode, | 59 command_line_flags, device_flags_file, strict_mode, |
| 58 regenerate_goldens, test_arguments) | 60 regenerate_goldens, test_arguments, gs_results_bucket) |
| 59 | 61 |
| 60 def test_initializeFlagAttributes_commandLineFlags(self): | 62 def test_initializeFlagAttributes_commandLineFlags(self): |
| 61 o = self.createTestInstance() | 63 o = self.createTestInstance() |
| 62 args = self.createFlagAttributesArgs(command_line_flags=['--foo', '--bar']) | 64 args = self.createFlagAttributesArgs(command_line_flags=['--foo', '--bar']) |
| 63 o._initializeFlagAttributes(args) | 65 o._initializeFlagAttributes(args) |
| 64 self.assertEquals(o._flags, ['--enable-test-intents', '--foo', '--bar']) | 66 self.assertEquals(o._flags, ['--enable-test-intents', '--foo', '--bar']) |
| 65 | 67 |
| 66 def test_initializeFlagAttributes_deviceFlagsFile(self): | 68 def test_initializeFlagAttributes_deviceFlagsFile(self): |
| 67 o = self.createTestInstance() | 69 o = self.createTestInstance() |
| 68 with tempfile.NamedTemporaryFile() as flags_file: | 70 with tempfile.NamedTemporaryFile() as flags_file: |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 }), | 722 }), |
| 721 ] | 723 ] |
| 722 results = instrumentation_test_instance.GenerateTestResults( | 724 results = instrumentation_test_instance.GenerateTestResults( |
| 723 None, None, statuses, 0, 1000) | 725 None, None, statuses, 0, 1000) |
| 724 self.assertEqual(1, len(results)) | 726 self.assertEqual(1, len(results)) |
| 725 self.assertEqual(base_test_result.ResultType.SKIP, results[0].GetType()) | 727 self.assertEqual(base_test_result.ResultType.SKIP, results[0].GetType()) |
| 726 | 728 |
| 727 | 729 |
| 728 if __name__ == '__main__': | 730 if __name__ == '__main__': |
| 729 unittest.main(verbosity=2) | 731 unittest.main(verbosity=2) |
| OLD | NEW |