Changeset 243770 in webkit
- Timestamp:
- Apr 2, 2019, 5:04:01 PM (7 years ago)
- Location:
- branches/safari-607-branch/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) (1 diff)
-
Scripts/webkitpy/xcode/simulated_device.py (modified) (8 diffs)
-
Scripts/webkitpy/xcode/simulated_device_unittest.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-607-branch/Tools/ChangeLog
r243769 r243770 1 2019-04-02 Kocsen Chung <kocsen_chung@apple.com> 2 3 Cherry-pick r239945. rdar://problem/49539128 4 5 webkitpy: Expose device_type from host-like objects 6 https://bugs.webkit.org/show_bug.cgi?id=193406 7 <rdar://problem/47262305> 8 9 Reviewed by Lucas Forschler. 10 11 Devices should expose device_type. As a result, all host objects should 12 provide a device_type property, even if they do not yet define a device_type. 13 14 * Scripts/webkitpy/common/system/systemhost.py: 15 (SystemHost): 16 (SystemHost.device_type): 17 * Scripts/webkitpy/common/system/systemhost_mock.py: 18 (MockSystemHost): 19 (MockSystemHost.device_type): 20 * Scripts/webkitpy/port/device.py: 21 (Device): 22 (Device.device_type): 23 * Scripts/webkitpy/xcode/simulated_device.py: 24 (SimulatedDeviceManager._find_exisiting_device_for_request): 25 (SimulatedDeviceManager._disambiguate_device_type): 26 (SimulatedDeviceManager._does_fulfill_request): 27 (SimulatedDeviceManager.device_count_for_type): 28 (SimulatedDeviceManager.initialize_devices): 29 * Scripts/webkitpy/xcode/simulated_device_unittest.py: 30 (test_available_devices): 31 (test_swapping_devices): 32 33 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239945 268f45cc-cd09-0410-ab3c-d52691b4dbfc 34 35 2019-01-14 Jonathan Bedard <jbedard@apple.com> 36 37 webkitpy: Expose device_type from host-like objects 38 https://bugs.webkit.org/show_bug.cgi?id=193406 39 <rdar://problem/47262305> 40 41 Reviewed by Lucas Forschler. 42 43 Devices should expose device_type. As a result, all host objects should 44 provide a device_type property, even if they do not yet define a device_type. 45 46 * Scripts/webkitpy/common/system/systemhost.py: 47 (SystemHost): 48 (SystemHost.device_type): 49 * Scripts/webkitpy/common/system/systemhost_mock.py: 50 (MockSystemHost): 51 (MockSystemHost.device_type): 52 * Scripts/webkitpy/port/device.py: 53 (Device): 54 (Device.device_type): 55 * Scripts/webkitpy/xcode/simulated_device.py: 56 (SimulatedDeviceManager._find_exisiting_device_for_request): 57 (SimulatedDeviceManager._disambiguate_device_type): 58 (SimulatedDeviceManager._does_fulfill_request): 59 (SimulatedDeviceManager.device_count_for_type): 60 (SimulatedDeviceManager.initialize_devices): 61 * Scripts/webkitpy/xcode/simulated_device_unittest.py: 62 (test_available_devices): 63 (test_swapping_devices): 64 1 65 2019-04-02 Kocsen Chung <kocsen_chung@apple.com> 2 66 -
branches/safari-607-branch/Tools/Scripts/webkitpy/common/system/systemhost.py
r233332 r243770 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 -
branches/safari-607-branch/Tools/Scripts/webkitpy/common/system/systemhost_mock.py
r217853 r243770 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 -
branches/safari-607-branch/Tools/Scripts/webkitpy/port/device.py
r243748 r243770 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 -
branches/safari-607-branch/Tools/Scripts/webkitpy/xcode/simulated_device.py
r243748 r243770 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 … … 177 177 device = None 178 178 break 179 if device and request.device_type == device. platform_device.device_type:179 if device and request.device_type == device.device_type: 180 180 return device 181 181 return None … … 223 223 # We use the existing devices to determine a legal family if no family is specified 224 224 for device in SimulatedDeviceManager.AVAILABLE_DEVICES: 225 if device. platform_device.device_type == full_device_type:226 full_device_type.hardware_family = device. platform_device.device_type.hardware_family225 if device.device_type == full_device_type: 226 full_device_type.hardware_family = device.device_type.hardware_family 227 227 break 228 228 … … 286 286 if not request.use_booted_simulator: 287 287 continue 288 if request.device_type == device. platform_device.device_type:288 if request.device_type == device.device_type: 289 289 _log.debug("The request for '{}' matched {} exactly".format(request.device_type, device)) 290 290 return request … … 294 294 if not request.use_booted_simulator: 295 295 continue 296 if device. platform_device.device_type in request.device_type:296 if device.device_type in request.device_type: 297 297 _log.debug("The request for '{}' fuzzy-matched {}".format(request.device_type, device)) 298 298 return request … … 307 307 if not request.use_booted_simulator or not request.allow_incomplete_match: 308 308 continue 309 if request.device_type.software_variant == device. platform_device.device_type.software_variant:309 if request.device_type.software_variant == device.device_type.software_variant: 310 310 _log.warn("The request for '{}' incomplete-matched {}".format(request.device_type, device)) 311 311 _log.warn("This may cause unexpected behavior in code that expected the device type {}".format(request.device_type)) … … 342 342 343 343 if SimulatedDeviceManager.device_by_filter(lambda device: device.platform_device.is_booted_or_booting(), host=host) and use_booted_simulator: 344 filter = lambda device: device.platform_device.is_booted_or_booting() and device. platform_device.device_type in device_type344 filter = lambda device: device.platform_device.is_booted_or_booting() and device.device_type in device_type 345 345 return len(SimulatedDeviceManager.device_by_filter(filter, host=host)) 346 346 … … 384 384 if not request.use_booted_simulator: 385 385 continue 386 if request.device_type != device. platform_device.device_type and not request.allow_incomplete_match:386 if request.device_type != device.device_type and not request.allow_incomplete_match: 387 387 continue 388 if request.device_type.software_variant != device. platform_device.device_type.software_variant:388 if request.device_type.software_variant != device.device_type.software_variant: 389 389 continue 390 390 requests.remove(request) -
branches/safari-607-branch/Tools/Scripts/webkitpy/xcode/simulated_device_unittest.py
r243748 r243770 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): … … 642 642 643 643 # We won't test the creation and deletion of simulators, only managing existing sims 644 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)645 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)644 SimulatedDeviceTest.change_state_to(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPhone 8'), host)[0], SimulatedDevice.DeviceState.BOOTED) 645 SimulatedDeviceTest.change_state_to(SimulatedDeviceManager.device_by_filter(lambda device: device.device_type == DeviceType.from_string('iPhone X'), host)[0], SimulatedDevice.DeviceState.BOOTED) 646 646 647 647 SimulatedDeviceManager.initialize_devices(DeviceRequest(DeviceType.from_string('iPhone 8')), host=host)
Note:
See TracChangeset
for help on using the changeset viewer.