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

Side by Side Diff: build/android/pylib/instrumentation/instrumentation_test_instance_test.py

Issue 2855483003: [Android] Remove --test-arguments arg from test_runner.py. (Closed)
Patch Set: trivial rebase Created 3 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 #!/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 29 matching lines...) Expand all
40 return instrumentation_test_instance.InstrumentationTestInstance( 40 return instrumentation_test_instance.InstrumentationTestInstance(
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',
51 ]) 50 ])
52 51
53 def createFlagAttributesArgs( 52 def createFlagAttributesArgs(
54 self, command_line_flags=None, device_flags_file=None, 53 self, command_line_flags=None, device_flags_file=None,
55 strict_mode=None, regenerate_goldens=None, test_arguments=None): 54 strict_mode=None, regenerate_goldens=None):
56 return self._FlagAttributesArgs( 55 return self._FlagAttributesArgs(
57 command_line_flags, device_flags_file, strict_mode, 56 command_line_flags, device_flags_file, strict_mode,
58 regenerate_goldens, test_arguments) 57 regenerate_goldens)
59 58
60 def test_initializeFlagAttributes_commandLineFlags(self): 59 def test_initializeFlagAttributes_commandLineFlags(self):
61 o = self.createTestInstance() 60 o = self.createTestInstance()
62 args = self.createFlagAttributesArgs(command_line_flags=['--foo', '--bar']) 61 args = self.createFlagAttributesArgs(command_line_flags=['--foo', '--bar'])
63 o._initializeFlagAttributes(args) 62 o._initializeFlagAttributes(args)
64 self.assertEquals(o._flags, ['--enable-test-intents', '--foo', '--bar']) 63 self.assertEquals(o._flags, ['--enable-test-intents', '--foo', '--bar'])
65 64
66 def test_initializeFlagAttributes_deviceFlagsFile(self): 65 def test_initializeFlagAttributes_deviceFlagsFile(self):
67 o = self.createTestInstance() 66 o = self.createTestInstance()
68 with tempfile.NamedTemporaryFile() as flags_file: 67 with tempfile.NamedTemporaryFile() as flags_file:
(...skipping 16 matching lines...) Expand all
85 o._initializeFlagAttributes(args) 84 o._initializeFlagAttributes(args)
86 self.assertEquals(o._flags, ['--enable-test-intents']) 85 self.assertEquals(o._flags, ['--enable-test-intents'])
87 86
88 def test_initializeFlagAttributes_regenerateGoldens(self): 87 def test_initializeFlagAttributes_regenerateGoldens(self):
89 o = self.createTestInstance() 88 o = self.createTestInstance()
90 args = self.createFlagAttributesArgs(regenerate_goldens=True) 89 args = self.createFlagAttributesArgs(regenerate_goldens=True)
91 o._initializeFlagAttributes(args) 90 o._initializeFlagAttributes(args)
92 self.assertEquals( 91 self.assertEquals(
93 o._flags, ['--enable-test-intents', '--regenerate-goldens']) 92 o._flags, ['--enable-test-intents', '--regenerate-goldens'])
94 93
95 def test_initializeFlagAttributes_testArgumentsRaisesException(self):
96 o = self.createTestInstance()
97 args = self.createFlagAttributesArgs(test_arguments='--foo --bar')
98 with self.assertRaises(Exception):
99 o._initializeFlagAttributes(args)
100
101 def testGetTests_noFilter(self): 94 def testGetTests_noFilter(self):
102 o = self.createTestInstance() 95 o = self.createTestInstance()
103 raw_tests = [ 96 raw_tests = [
104 { 97 {
105 'annotations': {'Feature': {'value': ['Foo']}}, 98 'annotations': {'Feature': {'value': ['Foo']}},
106 'class': 'org.chromium.test.SampleTest', 99 'class': 'org.chromium.test.SampleTest',
107 'superclass': 'java.lang.Object', 100 'superclass': 'java.lang.Object',
108 'methods': [ 101 'methods': [
109 { 102 {
110 'annotations': {'SmallTest': None}, 103 'annotations': {'SmallTest': None},
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 }), 713 }),
721 ] 714 ]
722 results = instrumentation_test_instance.GenerateTestResults( 715 results = instrumentation_test_instance.GenerateTestResults(
723 None, None, statuses, 0, 1000) 716 None, None, statuses, 0, 1000)
724 self.assertEqual(1, len(results)) 717 self.assertEqual(1, len(results))
725 self.assertEqual(base_test_result.ResultType.SKIP, results[0].GetType()) 718 self.assertEqual(base_test_result.ResultType.SKIP, results[0].GetType())
726 719
727 720
728 if __name__ == '__main__': 721 if __name__ == '__main__':
729 unittest.main(verbosity=2) 722 unittest.main(verbosity=2)
OLDNEW
« no previous file with comments | « build/android/pylib/instrumentation/instrumentation_test_instance.py ('k') | build/android/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698