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

Unified Diff: Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py

Issue 16917006: Only consider Android devices with more than 30% battery remaining for layout tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py
index 62995b1630fc3b76a1ea9f42d86dc7ea8bbb4c05..412fd221149ec8bf6e8432620f512804ed70673e 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py
@@ -68,6 +68,8 @@ class MockAndroidDebugBridge:
return self._get_device_output()
if len(args) > 3 and args[3] == 'command':
return 'mockoutput'
+ if len(args) > 5 and args[5] == 'battery':
+ return 'level: 99'
return ''
@@ -104,12 +106,6 @@ class AndroidCommandsTest(unittest.TestCase):
chromium_android.AndroidCommands.set_adb_command_path_options(['path1', 'path2', 'path3'])
self.assertEqual('path2', chromium_android.AndroidCommands.adb_command_path(executive))
- # The get_devices() method should throw if there aren't any devices. Otherwise it returns an array.
- def test_get_devices(self):
- self.assertRaises(AssertionError, chromium_android.AndroidCommands.get_devices, self.make_executive(0))
- self.assertEquals(1, len(chromium_android.AndroidCommands.get_devices(self.make_executive(1))))
- self.assertEquals(5, len(chromium_android.AndroidCommands.get_devices(self.make_executive(5))))
-
# The used adb command should include the device's serial number, and get_serial() should reflect this.
def test_adb_command_and_get_serial(self):
android_commands = self.make_android_commands(1, '123456789ABCDEF0')
@@ -191,9 +187,11 @@ class ChromiumAndroidDriverTest(unittest.TestCase):
def setUp(self):
self._mock_adb = MockAndroidDebugBridge(1)
self._mock_executive = MockExecutive2(run_command_fn=self._mock_adb.run_command)
+
+ android_commands = chromium_android.AndroidCommands(self._mock_executive, '123456789ABCDEF0')
self._port = chromium_android.ChromiumAndroidPort(MockSystemHost(executive=self._mock_executive), 'chromium-android')
self._driver = chromium_android.ChromiumAndroidDriver(self._port, worker_number=0,
- pixel_tests=True, driver_details=chromium_android.ContentShellDriverDetails())
+ pixel_tests=True, driver_details=chromium_android.ContentShellDriverDetails(), android_commands=android_commands)
# The cmd_line() method in the Android port is used for starting a shell, not the test runner.
def test_cmd_line(self):
@@ -207,7 +205,7 @@ class ChromiumAndroidDriverTest(unittest.TestCase):
self.assertIsNone(self._driver._read_prompt(time.time() + 1))
-class ChromiumAndroidDriverTwoDriverTest(unittest.TestCase):
+class ChromiumAndroidDriverTwoDriversTest(unittest.TestCase):
# Test two drivers getting the right serial numbers, and that we disregard per-test arguments.
def test_two_drivers(self):
mock_adb = MockAndroidDebugBridge(2)
@@ -215,9 +213,9 @@ class ChromiumAndroidDriverTwoDriverTest(unittest.TestCase):
port = chromium_android.ChromiumAndroidPort(MockSystemHost(executive=mock_executive), 'chromium-android')
driver0 = chromium_android.ChromiumAndroidDriver(port, worker_number=0, pixel_tests=True,
- driver_details=chromium_android.DumpRenderTreeDriverDetails())
+ driver_details=chromium_android.DumpRenderTreeDriverDetails(), android_commands=port._devices.get_device(mock_executive, 0))
driver1 = chromium_android.ChromiumAndroidDriver(port, worker_number=1, pixel_tests=True,
- driver_details=chromium_android.DumpRenderTreeDriverDetails())
+ driver_details=chromium_android.DumpRenderTreeDriverDetails(), android_commands=port._devices.get_device(mock_executive, 1))
self.assertEqual(['adb', '-s', '123456789ABCDEF0', 'shell'], driver0.cmd_line(True, []))
self.assertEqual(['adb', '-s', '123456789ABCDEF1', 'shell'], driver1.cmd_line(True, ['anything']))
@@ -238,22 +236,6 @@ class ChromiumAndroidTwoPortsTest(unittest.TestCase):
self.assertEqual(0, port1.driver_cmd_line().count('--create-stdin-fifo'))
-class ChromiumAndroidDriverTwoDriversTest(unittest.TestCase):
- # Test two drivers getting the right serial numbers, and that we disregard per-test arguments.
- def test_two_drivers(self):
- mock_adb = MockAndroidDebugBridge(2)
- mock_executive = MockExecutive2(run_command_fn=mock_adb.run_command)
-
- port = chromium_android.ChromiumAndroidPort(MockSystemHost(executive=mock_executive), 'chromium-android')
- driver0 = chromium_android.ChromiumAndroidDriver(port, worker_number=0, pixel_tests=True,
- driver_details=chromium_android.ContentShellDriverDetails())
- driver1 = chromium_android.ChromiumAndroidDriver(port, worker_number=1, pixel_tests=True,
- driver_details=chromium_android.ContentShellDriverDetails())
-
- self.assertEqual(['adb', '-s', '123456789ABCDEF0', 'shell'], driver0.cmd_line(True, []))
- self.assertEqual(['adb', '-s', '123456789ABCDEF1', 'shell'], driver1.cmd_line(True, []))
-
-
class ChromiumAndroidTwoPortsTest(unittest.TestCase):
# Test that the driver's command line indeed goes through to the driver.
def test_options_with_two_ports(self):

Powered by Google App Engine
This is Rietveld 408576698