webkitpy: Create device given lower-case DeviceType
authorjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Dec 2018 22:09:19 +0000 (22:09 +0000)
committerjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Dec 2018 22:09:19 +0000 (22:09 +0000)
<https://bugs.webkit.org/show_bug.cgi?id=192472>
<rdar://problem/46532650>

Reviewed by Lucas Forschler.

* Scripts/webkitpy/xcode/simulated_device.py:
(SimulatedDeviceManager._get_device_identifier_for_type): Comparing simctl device identifiers with DeviceTypes
should be letter-case agnostic.
* Scripts/webkitpy/xcode/simulated_device_unittest.py:
(test_lower_case_device_type):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238940 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/xcode/simulated_device.py
Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py

index 3dfa182..9506728 100644 (file)
@@ -1,3 +1,17 @@
+2018-12-06  Jonathan Bedard  <jbedard@apple.com>
+
+        webkitpy: Create device given lower-case DeviceType
+        <https://bugs.webkit.org/show_bug.cgi?id=192472>
+        <rdar://problem/46532650>
+
+        Reviewed by Lucas Forschler.
+
+        * Scripts/webkitpy/xcode/simulated_device.py:
+        (SimulatedDeviceManager._get_device_identifier_for_type): Comparing simctl device identifiers with DeviceTypes
+        should be letter-case agnostic.
+        * Scripts/webkitpy/xcode/simulated_device_unittest.py:
+        (test_lower_case_device_type):
+
 2018-12-06  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS] WKWebView should match UITextView behavior when editing text with an RTL keyboard
index 832261c..9510a4b 100644 (file)
@@ -229,7 +229,7 @@ class SimulatedDeviceManager(object):
     @staticmethod
     def _get_device_identifier_for_type(device_type):
         for type_id, type_name in SimulatedDeviceManager._device_identifier_to_name.iteritems():
-            if type_name == '{} {}'.format(device_type.hardware_family, device_type.hardware_type):
+            if type_name.lower() == '{} {}'.format(device_type.hardware_family.lower(), device_type.hardware_type.lower()):
                 return type_id
         return None
 
index 9f58671..da5201e 100644 (file)
@@ -610,6 +610,20 @@ class SimulatedDeviceTest(unittest.TestCase):
         SimulatedDeviceManager.tear_down(host)
         self.assertIsNone(SimulatedDeviceManager.INITIALIZED_DEVICES)
 
+    def test_lower_case_device_type(self):
+        SimulatedDeviceTest.reset_simulated_device_manager()
+        host = SimulatedDeviceTest.mock_host_for_simctl()
+        SimulatedDeviceManager.available_devices(host)
+
+        SimulatedDeviceManager.initialize_devices(DeviceRequest(DeviceType.from_string('iphone 5s', Version(11))), host=host)
+
+        self.assertEquals(1, len(SimulatedDeviceManager.INITIALIZED_DEVICES))
+        self.assertEquals('34FB476C-6FA0-43C8-8945-1BD7A4EBF0DE', SimulatedDeviceManager.INITIALIZED_DEVICES[0].udid)
+        self.assertEquals(SimulatedDevice.DeviceState.BOOTED, SimulatedDeviceManager.INITIALIZED_DEVICES[0].platform_device.state())
+
+        SimulatedDeviceManager.tear_down(host)
+        self.assertIsNone(SimulatedDeviceManager.INITIALIZED_DEVICES)
+
     @staticmethod
     def change_state_to(device, state):
         assert isinstance(state, int)