| Index: tools/telemetry/telemetry/core/platform/ios_device.py
|
| diff --git a/tools/telemetry/telemetry/core/platform/ios_device.py b/tools/telemetry/telemetry/core/platform/ios_device.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..83e7a8ca7e68b2ac4950955bfdf3e836effb2c61
|
| --- /dev/null
|
| +++ b/tools/telemetry/telemetry/core/platform/ios_device.py
|
| @@ -0,0 +1,49 @@
|
| +# Copyright 2014 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +import re
|
| +import subprocess
|
| +
|
| +from telemetry import decorators
|
| +from telemetry.core import platform
|
| +from telemetry.core.platform import device
|
| +
|
| +
|
| +class IOSDevice(device.Device):
|
| + def __init__(self):
|
| + super(IOSDevice, self).__init__(name='ios', guid='')
|
| +
|
| + @classmethod
|
| + def GetAllConnectedDevices(cls):
|
| + return []
|
| +
|
| + def FindAllAvailableBrowsers(self, options):
|
| + return []
|
| +
|
| +
|
| +def CanFindAvailableBrowsers():
|
| + # TODO(baxley): Add support for all platforms possible. Probably Linux,
|
| + # probably not Windows.
|
| + return platform.GetHostPlatform().GetOSName() == 'mac'
|
| +
|
| +
|
| +@decorators.Cache
|
| +def IsIosDeviceAttached():
|
| + devices = subprocess.check_output('system_profiler SPUSBDataType', shell=True)
|
| + for line in devices.split('\n'):
|
| + if line and re.match(r'\s*(iPod|iPhone|iPad):', line):
|
| + return True
|
| + return False
|
| +
|
| +
|
| +def FindAllAvailableDevices(options):
|
| + """Returns a list of available devices.
|
| + """
|
| + if not CanFindAvailableBrowsers():
|
| + return []
|
| +
|
| + if not IsIosDeviceAttached():
|
| + return []
|
| +
|
| + return [IOSDevice()]
|
|
|