| 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  |    6  | 
|    7 """Unit tests for instrumentation.TestRunner.""" |    7 """Unit tests for instrumentation.TestRunner.""" | 
|    8  |    8  | 
|    9 # pylint: disable=W0212 |    9 # pylint: disable=W0212 | 
|   10  |   10  | 
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  244         'class': ['test.package.TestClass'], |  244         'class': ['test.package.TestClass'], | 
|  245         'test': ['testMethod'], |  245         'test': ['testMethod'], | 
|  246         'stack': ['', 'foo/bar.py (27)', 'hello/world.py (42)'], |  246         'stack': ['', 'foo/bar.py (27)', 'hello/world.py (42)'], | 
|  247       }), |  247       }), | 
|  248     ] |  248     ] | 
|  249     result = self.instance._GenerateTestResult( |  249     result = self.instance._GenerateTestResult( | 
|  250         'test.package.TestClass#testMethod', statuses, 0, 1000) |  250         'test.package.TestClass#testMethod', statuses, 0, 1000) | 
|  251     self.assertEqual(base_test_result.ResultType.CRASH, result.GetType()) |  251     self.assertEqual(base_test_result.ResultType.CRASH, result.GetType()) | 
|  252     self.assertEqual('\nfoo/bar.py (27)\nhello/world.py (42)', result.GetLog()) |  252     self.assertEqual('\nfoo/bar.py (27)\nhello/world.py (42)', result.GetLog()) | 
|  253  |  253  | 
|  254   def testRunInstrumentationTest_verifyAdbShellCommand(self): |  254   def test_RunTest_verifyAdbShellCommand(self): | 
|  255     self.instance.options.test_runner = 'MyTestRunner' |  255     self.instance.options.test_runner = 'MyTestRunner' | 
|  256     self.instance.device.RunShellCommand = mock.Mock() |  256     self.instance.device.RunShellCommand = mock.Mock() | 
|  257     self.instance._GenerateTestResult = mock.Mock() |  257     self.instance.test_pkg.GetPackageName = mock.Mock( | 
|  258     with mock.patch('pylib.instrumentation.test_runner.' |  258         return_value='test.package') | 
|  259                         'TestRunner._ParseAmInstrumentRawOutput', |  259     self.instance._GetInstrumentationArgs = mock.Mock( | 
|  260                     return_value=(mock.Mock(), mock.Mock(), mock.Mock())): |  260         return_value={'test_arg_key': 'test_arg_value'}) | 
|  261       self.instance.RunInstrumentationTest( |  261     self.instance._RunTest('test.package.TestClass#testMethod', 100) | 
|  262           'test.package.TestClass#testMethod', |  | 
|  263           'test.package', |  | 
|  264           {'test_arg_key': 'test_arg_value'}, |  | 
|  265           100) |  | 
|  266     self.instance.device.RunShellCommand.assert_called_with( |  262     self.instance.device.RunShellCommand.assert_called_with( | 
|  267         ['am', 'instrument', '-r', |  263         ['am', 'instrument', '-r', | 
|  268          '-e', 'test_arg_key', "'test_arg_value'", |  264          '-e', 'test_arg_key', "'test_arg_value'", | 
|  269          '-e', 'class', "'test.package.TestClass#testMethod'", |  265          '-e', 'class', "'test.package.TestClass#testMethod'", | 
|  270          '-w', 'test.package/MyTestRunner'], |  266          '-w', 'test.package/MyTestRunner'], | 
|  271         timeout=100, retries=0) |  267         timeout=100, retries=0) | 
|  272  |  268  | 
|  273 if __name__ == '__main__': |  269 if __name__ == '__main__': | 
|  274   unittest.main(verbosity=2) |  270   unittest.main(verbosity=2) | 
|  275  |  271  | 
| OLD | NEW |