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

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py

Issue 18291002: Fix lint errors in chromium_android.py and chromium_android_unittest.py (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Also fix lint errors in test Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py ('k') | 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 # Copyright (C) 2012 Google Inc. All rights reserved. 1 # Copyright (C) 2012 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 24 matching lines...) Expand all
35 from webkitpy.common.system import executive_mock 35 from webkitpy.common.system import executive_mock
36 from webkitpy.common.system.executive_mock import MockExecutive2 36 from webkitpy.common.system.executive_mock import MockExecutive2
37 from webkitpy.common.system.systemhost_mock import MockSystemHost 37 from webkitpy.common.system.systemhost_mock import MockSystemHost
38 38
39 from webkitpy.layout_tests.port import chromium_android 39 from webkitpy.layout_tests.port import chromium_android
40 from webkitpy.layout_tests.port import chromium_port_testcase 40 from webkitpy.layout_tests.port import chromium_port_testcase
41 from webkitpy.layout_tests.port import driver 41 from webkitpy.layout_tests.port import driver
42 from webkitpy.layout_tests.port import driver_unittest 42 from webkitpy.layout_tests.port import driver_unittest
43 from webkitpy.tool.mocktool import MockOptions 43 from webkitpy.tool.mocktool import MockOptions
44 44
45
45 # Any "adb" commands will be interpret by this class instead of executing actual 46 # Any "adb" commands will be interpret by this class instead of executing actual
46 # commansd on the file system, which we don't want to do. 47 # commansd on the file system, which we don't want to do.
47 class MockAndroidDebugBridge: 48 class MockAndroidDebugBridge:
48 def __init__(self, device_count): 49 def __init__(self, device_count):
49 self._device_count = device_count 50 self._device_count = device_count
50 self._last_command = None 51 self._last_command = None
51 52
52 # Local public methods. 53 # Local public methods.
53 54
54 def run_command(self, args): 55 def run_command(self, args):
(...skipping 21 matching lines...) Expand all
76 def last_command(self): 77 def last_command(self):
77 return self._last_command 78 return self._last_command
78 79
79 # Local private methods. 80 # Local private methods.
80 81
81 def _get_device_output(self): 82 def _get_device_output(self):
82 serials = ['123456789ABCDEF0', '123456789ABCDEF1', '123456789ABCDEF2', 83 serials = ['123456789ABCDEF0', '123456789ABCDEF1', '123456789ABCDEF2',
83 '123456789ABCDEF3', '123456789ABCDEF4', '123456789ABCDEF5'] 84 '123456789ABCDEF3', '123456789ABCDEF4', '123456789ABCDEF5']
84 output = 'List of devices attached\n' 85 output = 'List of devices attached\n'
85 for serial in serials[:self._device_count]: 86 for serial in serials[:self._device_count]:
86 output += '%s\tdevice\n' % serial 87 output += '%s\tdevice\n' % serial
87 return output 88 return output
88 89
89 90
90 class AndroidCommandsTest(unittest.TestCase): 91 class AndroidCommandsTest(unittest.TestCase):
91 def setUp(self): 92 def setUp(self):
92 chromium_android.AndroidCommands._adb_command_path = None 93 chromium_android.AndroidCommands._adb_command_path = None
93 chromium_android.AndroidCommands._adb_command_path_options = ['adb'] 94 chromium_android.AndroidCommands._adb_command_path_options = ['adb']
94 95
95 def make_executive(self, device_count): 96 def make_executive(self, device_count):
96 self._mock_executive = MockAndroidDebugBridge(device_count) 97 self._mock_executive = MockAndroidDebugBridge(device_count)
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 mock_adb = MockAndroidDebugBridge(2) 211 mock_adb = MockAndroidDebugBridge(2)
211 mock_executive = MockExecutive2(run_command_fn=mock_adb.run_command) 212 mock_executive = MockExecutive2(run_command_fn=mock_adb.run_command)
212 213
213 port0 = chromium_android.ChromiumAndroidPort(MockSystemHost(executive=mo ck_executive), 214 port0 = chromium_android.ChromiumAndroidPort(MockSystemHost(executive=mo ck_executive),
214 'chromium-android', options=MockOptions(additional_drt_flag=['--foo= bar'])) 215 'chromium-android', options=MockOptions(additional_drt_flag=['--foo= bar']))
215 port1 = chromium_android.ChromiumAndroidPort(MockSystemHost(executive=mo ck_executive), 216 port1 = chromium_android.ChromiumAndroidPort(MockSystemHost(executive=mo ck_executive),
216 'chromium-android', options=MockOptions(driver_name='content_shell') ) 217 'chromium-android', options=MockOptions(driver_name='content_shell') )
217 218
218 self.assertEqual(1, port0.driver_cmd_line().count('--foo=bar')) 219 self.assertEqual(1, port0.driver_cmd_line().count('--foo=bar'))
219 self.assertEqual(0, port1.driver_cmd_line().count('--create-stdin-fifo') ) 220 self.assertEqual(0, port1.driver_cmd_line().count('--create-stdin-fifo') )
220
221
222 class ChromiumAndroidTwoPortsTest(unittest.TestCase):
223 # Test that the driver's command line indeed goes through to the driver.
224 def test_options_with_two_ports(self):
225 mock_adb = MockAndroidDebugBridge(2)
226 mock_executive = MockExecutive2(run_command_fn=mock_adb.run_command)
227
228 port0 = chromium_android.ChromiumAndroidPort(MockSystemHost(executive=mo ck_executive),
229 'chromium-android', options=MockOptions(additional_drt_flag=['--foo= bar']))
230 port1 = chromium_android.ChromiumAndroidPort(MockSystemHost(executive=mo ck_executive),
231 'chromium-android', options=MockOptions(driver_name='content_shell') )
232
233 self.assertEqual(1, port0.driver_cmd_line().count('--foo=bar'))
234 self.assertEqual(0, port1.driver_cmd_line().count('--create-stdin-fifo') )
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698