Changeset 239945 in webkit
- Timestamp:
- Jan 14, 2019, 2:02:18 PM (8 years ago)
- Location:
- trunk/Tools
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
Scripts/webkitpy/common/system/systemhost.py (modified) (2 diffs)
-
Scripts/webkitpy/common/system/systemhost_mock.py (modified) (2 diffs)
-
Scripts/webkitpy/port/device.py (modified) (2 diffs)
-
Scripts/webkitpy/xcode/simulated_device.py (modified) (8 diffs)
-
Scripts/webkitpy/xcode/simulated_device_unittest.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r239939 r239945 1 2019-01-14 Jonathan Bedard <jbedard@apple.com> 2 3 webkitpy: Expose device_type from host-like objects 4 https://bugs.webkit.org/show_bug.cgi?id=193406 5 <rdar://problem/47262305> 6 7 Reviewed by Lucas Forschler. 8 9 Devices should expose device_type. As a result, all host objects should 10 provide a device_type property, even if they do not yet define a device_type. 11 12 * Scripts/webkitpy/common/system/systemhost.py: 13 (SystemHost): 14 (SystemHost.device_type): 15 * Scripts/webkitpy/common/system/systemhost_mock.py: 16 (MockSystemHost): 17 (MockSystemHost.device_type): 18 * Scripts/webkitpy/port/device.py: 19 (Device): 20 (Device.device_type): 21 * Scripts/webkitpy/xcode/simulated_device.py: 22 (SimulatedDeviceManager._find_exisiting_device_for_request): 23 (SimulatedDeviceManager._disambiguate_device_type): 24 (SimulatedDeviceManager._does_fulfill_request): 25 (SimulatedDeviceManager.device_count_for_type): 26 (SimulatedDeviceManager.initialize_devices): 27 * Scripts/webkitpy/xcode/simulated_device_unittest.py: 28 (test_available_devices): 29 (test_swapping_devices): 30 1 31 2019-01-14 Jonathan Bedard <jbedard@apple.com> 2 32 -
trunk/Tools/Scripts/webkitpy/common/system/systemhost.py
r233332 r239945 1 1 # Copyright (c) 2011 Google Inc. All rights reserved. 2 # Copyright (C) 2019 Apple Inc. All rights reserved. 2 3 # 3 4 # Redistribution and use in source and binary forms, with or without … … 55 56 return '' 56 57 return self.executive.run_command(['xcrun', 'lldb', '--python-path'], return_stderr=False).rstrip() 58 59 @property 60 def device_type(self): 61 return None -
trunk/Tools/Scripts/webkitpy/common/system/systemhost_mock.py
r217853 r239945 1 # Copyright (c) 2011 Google Inc. All rights reserved. 2 # 3 # Redistribution and use in source and binary forms, with or without 4 # modification, are permitted provided that the following conditions are 5 # met: 6 # 7 # * Redistributions of source code must retain the above copyright 8 # notice, this list of conditions and the following disclaimer. 9 # * Redistributions in binary form must reproduce the above 10 # copyright notice, this list of conditions and the following disclaimer 11 # in the documentation and/or other materials provided with the 12 # distribution. 13 # * Neither the name of Google Inc. nor the names of its 14 # contributors may be used to endorse or promote products derived from 15 # this software without specific prior written permission. 16 # 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1 # Copyright (c) 2011 Google Inc. All rights reserved. 2 # Copyright (C) 2019 Apple Inc. All rights reserved. 3 # 4 # Redistribution and use in source and binary forms, with or without 5 # modification, are permitted provided that the following conditions are 6 # met: 7 # 8 # * Redistributions of source code must retain the above copyright 9 # notice, this list of conditions and the following disclaimer. 10 # * Redistributions in binary form must reproduce the above 11 # copyright notice, this list of conditions and the following disclaimer 12 # in the documentation and/or other materials provided with the 13 # distribution. 14 # * Neither the name of Google Inc. nor the names of its 15 # contributors may be used to endorse or promote products derived from 16 # this software without specific prior written permission. 17 # 18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 29 29 30 from webkitpy.common.system.environment import Environment … … 58 59 def symbolicate_crash_log_if_needed(self, path): 59 60 return self.filesystem.read_text_file(path) 61 62 @property 63 def device_type(self): 64 return None -
trunk/Tools/Scripts/webkitpy/port/device.py
r222510 r239945 1 # Copyright (C) 2017 Apple Inc. All rights reserved.1 # Copyright (C) 2017-2019 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 98 98 return self.platform_device.udid 99 99 100 @property 101 def device_type(self): 102 return self.platform_device.device_type 103 100 104 def __nonzero__(self): 101 105 return self.platform_device is not None -
trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py
r239939 r239945 1 # Copyright (C) 2017 Apple Inc. All rights reserved.1 # Copyright (C) 2017-2019 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 176 176 device = None 177 177 break 178 if device and request.device_type == device. platform_device.device_type:178 if device and request.device_type == device.device_type: 179 179 return device 180 180 return None … … 222 222 # We use the existing devices to determine a legal family if no family is specified 223 223 for device in SimulatedDeviceManager.AVAILABLE_DEVICES: 224 if device. platform_device.device_type == full_device_type:225 full_device_type.hardware_family = device. platform_device.device_type.hardware_family224 if device.device_type == full_device_type: 225 full_device_type.hardware_family = device.device_type.hardware_family 226 226 break 227 227 … … 285 285 if not request.use_booted_simulator: 286 286 continue 287 if request.device_type == device. platform_device.device_type:287 if request.device_type == device.device_type: 288 288 _log.debug("The request for '{}' matched {} exactly".format(request.device_type, device)) 289 289 return request … … 293 293 if not request.use_booted_simulator: 294 294 continue 295 if device. platform_device.device_type in request.device_type:295 if device.device_type in request.device_type: 296 296 _log.debug("The request for '{}' fuzzy-matched {}".format(request.device_type, device)) 297 297 return request … … 306 306 if not request.use_booted_simulator or not request.allow_incomplete_match: 307 307 continue 308 if request.device_type.software_variant == device. platform_device.device_type.software_variant:308 if request.device_type.software_variant == device.device_type.software_variant: 309 309 _log.warn("The request for '{}' incomplete-matched {}".format(request.device_type, device)) 310 310 _log.warn("This may cause unexpected behavior in code that expected the device type {}".format(request.device_type)) … … 341 341 342 342 if SimulatedDeviceManager.device_by_filter(lambda device: device.platform_device.is_booted_or_booting(), host=host) and use_booted_simulator: 343 filter = lambda device: device.platform_device.is_booted_or_booting() and device. platform_device.device_type in device_type343 filter = lambda device: device.platform_device.is_booted_or_booting() and device.device_type in device_type 344 344 return len(SimulatedDeviceManager.device_by_filter(filter, host=host)) 345 345 … … 383 383 if not request.use_booted_simulator: 384 384 continue 385 if request.device_type != device. platform_device.device_type and not request.allow_incomplete_match:385 if request.device_type != device.device_type and not request.allow_incomplete_match: 386 386 continue 387 if request.device_type.software_variant != device. platform_device.device_type.software_variant:387 if request.device_type.software_variant != device.device_type.software_variant: 388 388 continue 389 389 requests.remove(request) -
trunk/Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py
r238940 r239945 1 # Copyright (C) 2017 Apple Inc. All rights reserved.1 # Copyright (C) 2017-2019 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 569 569 570 570 # There should only be 1 iPhone X, iPhone 8 and iPhone SE 571 self.assertEquals(1, len(SimulatedDeviceManager.device_by_filter(lambda device: device. platform_device.device_type == DeviceType.from_string('iPhone X'), host)))572 self.assertEquals(1, len(SimulatedDeviceManager.device_by_filter(lambda device: device. platform_device.device_type == DeviceType.from_string('iPhone 8'), host)))571 self.assertEquals(1, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPhone X'), host))) 572 self.assertEquals(1, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPhone 8'), host))) 573 573 574 574 # There should be 2 5s and 6s 575 self.assertEquals(2, len(SimulatedDeviceManager.device_by_filter(lambda device: device. platform_device.device_type == DeviceType.from_string('iPhone 5s'), host)))576 self.assertEquals(2, len(SimulatedDeviceManager.device_by_filter(lambda device: device. platform_device.device_type == DeviceType.from_string('iPhone 6s'), host)))575 self.assertEquals(2, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPhone 5s'), host))) 576 self.assertEquals(2, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPhone 6s'), host))) 577 577 578 578 # 19 iPhones 579 self.assertEquals(19, len(SimulatedDeviceManager.device_by_filter(lambda device: device. platform_device.device_type == DeviceType.from_string('iPhone'), host)))579 self.assertEquals(19, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPhone'), host))) 580 580 581 581 # 11 iPads 582 self.assertEquals(11, len(SimulatedDeviceManager.device_by_filter(lambda device: device. platform_device.device_type == DeviceType.from_string('iPad'), host)))582 self.assertEquals(11, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPad'), host))) 583 583 584 584 # 18 Apple watches 585 self.assertEquals(6, len(SimulatedDeviceManager.device_by_filter(lambda device: device. platform_device.device_type == DeviceType.from_string('Apple Watch'), host)))585 self.assertEquals(6, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('Apple Watch'), host))) 586 586 587 587 # 3 Apple TVs 588 self.assertEquals(3, len(SimulatedDeviceManager.device_by_filter(lambda device: device. platform_device.device_type == DeviceType.from_string('Apple TV'), host)))588 self.assertEquals(3, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('Apple TV'), host))) 589 589 590 590 # 18 devices running iOS 11.0 591 self.assertEquals(18, len(SimulatedDeviceManager.device_by_filter(lambda device: device. platform_device.device_type == DeviceType(software_variant='iOS', software_version=Version(11, 0, 1)), host)))591 self.assertEquals(18, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType(software_variant='iOS', software_version=Version(11, 0, 1)), host))) 592 592 593 593 # 11 iPhones running iOS 11.0 594 self.assertEquals(11, len(SimulatedDeviceManager.device_by_filter(lambda device: device. platform_device.device_type == DeviceType(hardware_family='iPhone', software_version=Version(11, 0, 1)), host)))594 self.assertEquals(11, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType(hardware_family='iPhone', software_version=Version(11, 0, 1)), host))) 595 595 596 596 # 1 device running iOS 12 597 self.assertEquals(1, len(SimulatedDeviceManager.device_by_filter(lambda device: device. platform_device.device_type == DeviceType(software_variant='iOS', software_version=Version(12, 0, 0)), host)))597 self.assertEquals(1, len(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType(software_variant='iOS', software_version=Version(12, 0, 0)), host))) 598 598 599 599 def test_existing_simulator(self): … … 641 641 642 642 # We won't test the creation and deletion of simulators, only managing existing sims 643 SimulatedDeviceTest.change_state_to(SimulatedDeviceManager.device_by_filter(lambda device: device. platform_device.device_type == DeviceType.from_string('iPhone 8'), host)[0], SimulatedDevice.DeviceState.BOOTED)644 SimulatedDeviceTest.change_state_to(SimulatedDeviceManager.device_by_filter(lambda device: device. platform_device.device_type == DeviceType.from_string('iPhone X'), host)[0], SimulatedDevice.DeviceState.BOOTED)643 SimulatedDeviceTest.change_state_to(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPhone 8'), host)[0], SimulatedDevice.DeviceState.BOOTED) 644 SimulatedDeviceTest.change_state_to(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPhone X'), host)[0], SimulatedDevice.DeviceState.BOOTED) 645 645 646 646 SimulatedDeviceManager.initialize_devices(DeviceRequest(DeviceType.from_string('iPhone 8')), host=host)
Note:
See TracChangeset
for help on using the changeset viewer.