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

Unified Diff: tools/telemetry/telemetry/core/platform/ios_device.py

Issue 1015313002: Detect iOS simulator as an iOS test device. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better indenting and a doc string Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index 0cec05e7fdbadde5071a36e001a019494cc3b9f4..f093d245992382902994591ff2dc54dfcc5f9b36 100644
--- a/tools/telemetry/telemetry/core/platform/ios_device.py
+++ b/tools/telemetry/telemetry/core/platform/ios_device.py
@@ -2,13 +2,21 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import os
import re
import subprocess
from telemetry.core import platform
from telemetry.core.platform import device
+from telemetry.util import path
+IOSSIM_BUILD_DIRECTORIES = [
+ 'Debug-iphonesimulator',
+ 'Profile-iphonesimulator',
+ 'Release-iphonesimulator'
+]
+
class IOSDevice(device.Device):
def __init__(self):
super(IOSDevice, self).__init__(name='ios', guid='ios')
@@ -25,6 +33,25 @@ def _IsIosDeviceAttached():
return True
return False
+def _IsIosSimulatorAvailable():
+ """Determines whether an iOS simulator is present in the local checkout.
+
+ Assumes the iOS simulator (iossim) and Chromium have already been built.
+
+ Returns:
+ True if at least one simulator is found, otherwise False.
+ """
+ for build_dir in IOSSIM_BUILD_DIRECTORIES:
+ iossim_path = os.path.join(
+ path.GetChromiumSrcDir(), 'out', build_dir, 'iossim')
nednguyen 2015/03/19 21:04:10 FYI, this won't work once telemetry is moved to gi
+ chromium_path = os.path.join(
+ path.GetChromiumSrcDir(), 'out', build_dir, 'Chromium.app')
+
+ # If the iOS simulator and Chromium app are present, return True
+ if os.path.exists(iossim_path) and os.path.exists(chromium_path):
+ return True
+
+ return False
def FindAllAvailableDevices(_):
"""Returns a list of available devices.
@@ -34,7 +61,7 @@ def FindAllAvailableDevices(_):
if platform.GetHostPlatform().GetOSName() != 'mac':
return []
- if not _IsIosDeviceAttached():
+ if not _IsIosDeviceAttached() and not _IsIosSimulatorAvailable():
return []
- return [IOSDevice()]
+ return [IOSDevice()]
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698