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

Side by Side Diff: build/android/devil/utils/lsusb_test.py

Issue 1637543004: [Android] Fix lsusb test timeouts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 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 """Tests for the cmd_helper module.""" 6 """Tests for the cmd_helper module."""
7 7
8 import unittest 8 import unittest
9 9
10 from devil import devil_env 10 from devil import devil_env
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 } 215 }
216 } 216 }
217 217
218 218
219 class LsusbTest(mock_calls.TestCase): 219 class LsusbTest(mock_calls.TestCase):
220 """Test Lsusb parsing.""" 220 """Test Lsusb parsing."""
221 221
222 def testLsusb(self): 222 def testLsusb(self):
223 with self.assertCalls( 223 with self.assertCalls(
224 (mock.call.devil.utils.cmd_helper.GetCmdStatusAndOutputWithTimeout( 224 (mock.call.devil.utils.cmd_helper.GetCmdStatusAndOutputWithTimeout(
225 ['lsusb'], timeout=2), (None, DEVICE_LIST)), 225 ['lsusb'], timeout=10), (None, DEVICE_LIST)),
226 (mock.call.devil.utils.cmd_helper.GetCmdStatusAndOutputWithTimeout( 226 (mock.call.devil.utils.cmd_helper.GetCmdStatusAndOutputWithTimeout(
227 ['lsusb', '-v', '-s', '003:007'], timeout=2), (None, RAW_OUTPUT))): 227 ['lsusb', '-v', '-s', '003:007'], timeout=10), (None, RAW_OUTPUT))):
228 self.assertDictEqual(lsusb.lsusb().pop(), EXPECTED_RESULT) 228 self.assertDictEqual(lsusb.lsusb().pop(), EXPECTED_RESULT)
229 229
230 def testGetSerial(self): 230 def testGetSerial(self):
231 with self.assertCalls( 231 with self.assertCalls(
232 (mock.call.devil.utils.cmd_helper.GetCmdStatusAndOutputWithTimeout( 232 (mock.call.devil.utils.cmd_helper.GetCmdStatusAndOutputWithTimeout(
233 ['lsusb'], timeout=2), (None, DEVICE_LIST)), 233 ['lsusb'], timeout=10), (None, DEVICE_LIST)),
234 (mock.call.devil.utils.cmd_helper.GetCmdStatusAndOutputWithTimeout( 234 (mock.call.devil.utils.cmd_helper.GetCmdStatusAndOutputWithTimeout(
235 ['lsusb', '-v', '-s', '003:007'], timeout=2), (None, RAW_OUTPUT))): 235 ['lsusb', '-v', '-s', '003:007'], timeout=10), (None, RAW_OUTPUT))):
236 self.assertEqual(lsusb.get_android_devices(), ['01d2450ea194a93b']) 236 self.assertEqual(lsusb.get_android_devices(), ['01d2450ea194a93b'])
237 237
238 def testGetLsusbSerial(self): 238 def testGetLsusbSerial(self):
239 with self.assertCalls( 239 with self.assertCalls(
240 (mock.call.devil.utils.cmd_helper.GetCmdStatusAndOutputWithTimeout( 240 (mock.call.devil.utils.cmd_helper.GetCmdStatusAndOutputWithTimeout(
241 ['lsusb'], timeout=2), (None, DEVICE_LIST)), 241 ['lsusb'], timeout=10), (None, DEVICE_LIST)),
242 (mock.call.devil.utils.cmd_helper.GetCmdStatusAndOutputWithTimeout( 242 (mock.call.devil.utils.cmd_helper.GetCmdStatusAndOutputWithTimeout(
243 ['lsusb', '-v', '-s', '003:007'], timeout=2), (None, RAW_OUTPUT))): 243 ['lsusb', '-v', '-s', '003:007'], timeout=10), (None, RAW_OUTPUT))):
244 out = lsusb.lsusb().pop() 244 out = lsusb.lsusb().pop()
245 self.assertEqual(lsusb.get_lsusb_serial(out), '01d2450ea194a93b') 245 self.assertEqual(lsusb.get_lsusb_serial(out), '01d2450ea194a93b')
246 246
247 247
248 if __name__ == '__main__': 248 if __name__ == '__main__':
249 unittest.main() 249 unittest.main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698