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

Side by Side Diff: testing/iossim/iossim.mm

Issue 336773002: Get iossim to compile with Xcode 6. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: exclude from presubmit Created 6 years, 6 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 unified diff | Download patch
« no previous file with comments | « testing/iossim/iossim.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import <Foundation/Foundation.h> 5 #import <Foundation/Foundation.h>
6 #include <asl.h> 6 #include <asl.h>
7 #include <libgen.h> 7 #include <libgen.h>
8 #include <stdarg.h> 8 #include <stdarg.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 10
11 // An executable (iossim) that runs an app in the iOS Simulator. 11 // An executable (iossim) that runs an app in the iOS Simulator.
12 // Run 'iossim -h' for usage information. 12 // Run 'iossim -h' for usage information.
13 // 13 //
14 // For best results, the iOS Simulator application should not be running when 14 // For best results, the iOS Simulator application should not be running when
15 // iossim is invoked. 15 // iossim is invoked.
16 // 16 //
17 // Headers for the iPhoneSimulatorRemoteClient framework used in this tool are 17 // Headers for iPhoneSimulatorRemoteClient and other frameworks used in this
18 // generated by class-dump, via GYP. 18 // tool are generated by class-dump, via GYP.
19 // (class-dump is available at http://www.codethecode.com/projects/class-dump/) 19 // (class-dump is available at http://www.codethecode.com/projects/class-dump/)
20 // 20 //
21 // However, there are some forward declarations required to get things to 21 // However, there are some forward declarations required to get things to
22 // compile. Also, the DTiPhoneSimulatorSessionDelegate protocol is referenced 22 // compile.
23 // by the iPhoneSimulatorRemoteClient framework, but not defined in the object
24 // file, so it must be defined here before importing the generated
25 // iPhoneSimulatorRemoteClient.h file.
26 23
24 // TODO(lliabraa): Once all builders are on Xcode 6 this ifdef can be removed
25 // (crbug.com/385030).
26 #if defined(IOSSIM_USE_XCODE_6)
27 @class DVTStackBacktrace;
28 #import "DVTFoundation.h"
29 #endif // IOSSIM_USE_XCODE_6
30
31 @protocol OS_dispatch_queue
32 @end
33 @protocol OS_dispatch_source
34 @end
35 // TODO(lliabraa): Once all builders are on Xcode 6 this ifdef can be removed
36 // (crbug.com/385030).
37 #if defined(IOSSIM_USE_XCODE_6)
38 @protocol OS_xpc_object
39 @end
40 @protocol SimBridge;
41 @class SimDeviceSet;
42 @class SimDeviceType;
43 @class SimRuntime;
44 @class SimServiceConnectionManager;
45 #import "CoreSimulator.h"
46 #endif // IOSSIM_USE_XCODE_6
47
48 @interface DVTPlatform : NSObject
49 + (BOOL)loadAllPlatformsReturningError:(id*)arg1;
50 @end
27 @class DTiPhoneSimulatorApplicationSpecifier; 51 @class DTiPhoneSimulatorApplicationSpecifier;
28 @class DTiPhoneSimulatorSession; 52 @class DTiPhoneSimulatorSession;
29 @class DTiPhoneSimulatorSessionConfig; 53 @class DTiPhoneSimulatorSessionConfig;
30 @class DTiPhoneSimulatorSystemRoot; 54 @class DTiPhoneSimulatorSystemRoot;
55 @class DVTConfinementServiceConnection;
56 @class DVTDispatchLock;
31 @class DVTiPhoneSimulatorMessenger; 57 @class DVTiPhoneSimulatorMessenger;
32 58 @class DVTNotificationToken;
33 @interface DVTPlatform : NSObject
34 + (BOOL)loadAllPlatformsReturningError:(id*)arg1;
35 @end
36
37 @protocol OS_dispatch_source
38 @end
39 @protocol OS_dispatch_queue
40 @end
41 @class DVTDispatchLock;
42 @class DVTConfinementServiceConnection;
43 @class DVTTask; 59 @class DVTTask;
44 60 // The DTiPhoneSimulatorSessionDelegate protocol is referenced
61 // by the iPhoneSimulatorRemoteClient framework, but not defined in the object
62 // file, so it must be defined here before importing the generated
63 // iPhoneSimulatorRemoteClient.h file.
45 @protocol DTiPhoneSimulatorSessionDelegate 64 @protocol DTiPhoneSimulatorSessionDelegate
46 - (void)session:(DTiPhoneSimulatorSession*)session 65 - (void)session:(DTiPhoneSimulatorSession*)session
47 didEndWithError:(NSError*)error; 66 didEndWithError:(NSError*)error;
48 - (void)session:(DTiPhoneSimulatorSession*)session 67 - (void)session:(DTiPhoneSimulatorSession*)session
49 didStart:(BOOL)started 68 didStart:(BOOL)started
50 withError:(NSError*)error; 69 withError:(NSError*)error;
51 @end 70 @end
52
53 #import "DVTiPhoneSimulatorRemoteClient.h" 71 #import "DVTiPhoneSimulatorRemoteClient.h"
54 72
55 // An undocumented system log key included in messages from launchd. The value 73 // An undocumented system log key included in messages from launchd. The value
56 // is the PID of the process the message is about (as opposed to launchd's PID). 74 // is the PID of the process the message is about (as opposed to launchd's PID).
57 #define ASL_KEY_REF_PID "RefPID" 75 #define ASL_KEY_REF_PID "RefPID"
58 76
59 namespace { 77 namespace {
60 78
61 // Name of environment variables that control the user's home directory in the 79 // Name of environment variables that control the user's home directory in the
62 // simulator. 80 // simulator.
(...skipping 14 matching lines...) Expand all
77 // exception being if the app is invoked and completes execution before the 95 // exception being if the app is invoked and completes execution before the
78 // session is started (this case is handled in session:didStart:withError). 96 // session is started (this case is handled in session:didStart:withError).
79 const NSTimeInterval kDefaultSessionStartTimeoutSeconds = 30; 97 const NSTimeInterval kDefaultSessionStartTimeoutSeconds = 30;
80 98
81 // While the simulated app is running, its stdout is redirected to a file which 99 // While the simulated app is running, its stdout is redirected to a file which
82 // is polled by iossim and written to iossim's stdout using the following 100 // is polled by iossim and written to iossim's stdout using the following
83 // polling interval. 101 // polling interval.
84 const NSTimeInterval kOutputPollIntervalSeconds = 0.1; 102 const NSTimeInterval kOutputPollIntervalSeconds = 0.1;
85 103
86 // The path within the developer dir of the private Simulator frameworks. 104 // The path within the developer dir of the private Simulator frameworks.
105 #if defined(IOSSIM_USE_XCODE_6)
106 NSString* const kSimulatorFrameworkRelativePath =
107 @"../SharedFrameworks/DVTiPhoneSimulatorRemoteClient.framework";
108 #else
87 NSString* const kSimulatorFrameworkRelativePath = 109 NSString* const kSimulatorFrameworkRelativePath =
88 @"Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/" 110 @"Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/"
89 @"DVTiPhoneSimulatorRemoteClient.framework"; 111 @"DVTiPhoneSimulatorRemoteClient.framework";
112 #endif // IOSSIM_USE_XCODE_6
90 NSString* const kDVTFoundationRelativePath = 113 NSString* const kDVTFoundationRelativePath =
91 @"../SharedFrameworks/DVTFoundation.framework"; 114 @"../SharedFrameworks/DVTFoundation.framework";
92 NSString* const kDevToolsFoundationRelativePath = 115 NSString* const kDevToolsFoundationRelativePath =
93 @"../OtherFrameworks/DevToolsFoundation.framework"; 116 @"../OtherFrameworks/DevToolsFoundation.framework";
94 NSString* const kSimulatorRelativePath = 117 NSString* const kSimulatorRelativePath =
95 @"Platforms/iPhoneSimulator.platform/Developer/Applications/" 118 @"Platforms/iPhoneSimulator.platform/Developer/Applications/"
96 @"iPhone Simulator.app"; 119 @"iPhone Simulator.app";
97 120
98 // Simulator Error String Key. This can be found by looking in the Simulator's 121 // Simulator Error String Key. This can be found by looking in the Simulator's
99 // Localizable.strings files. 122 // Localizable.strings files.
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 if (!simHomePath) { 773 if (!simHomePath) {
751 NSString* dirNameTemplate = 774 NSString* dirNameTemplate =
752 [NSString stringWithFormat:@"iossim-%@-%@-XXXXXX", appName, deviceName]; 775 [NSString stringWithFormat:@"iossim-%@-%@-XXXXXX", appName, deviceName];
753 simHomePath = CreateTempDirectory(dirNameTemplate); 776 simHomePath = CreateTempDirectory(dirNameTemplate);
754 if (!simHomePath) { 777 if (!simHomePath) {
755 LogError(@"Unable to create unique directory for template %@", 778 LogError(@"Unable to create unique directory for template %@",
756 dirNameTemplate); 779 dirNameTemplate);
757 exit(kExitInitializationFailure); 780 exit(kExitInitializationFailure);
758 } 781 }
759 } 782 }
783
760 if (!InitializeSimulatorUserHome(simHomePath)) { 784 if (!InitializeSimulatorUserHome(simHomePath)) {
761 LogError(@"Unable to initialize home directory for simulator: %@", 785 LogError(@"Unable to initialize home directory for simulator: %@",
762 simHomePath); 786 simHomePath);
763 exit(kExitInitializationFailure); 787 exit(kExitInitializationFailure);
764 } 788 }
765 789
766 // Create the config and simulator session. 790 // Create the config and simulator session.
767 DTiPhoneSimulatorSessionConfig* config = BuildSessionConfig(appSpec, 791 DTiPhoneSimulatorSessionConfig* config = BuildSessionConfig(appSpec,
768 systemRoot, 792 systemRoot,
769 stdioPath, 793 stdioPath,
(...skipping 23 matching lines...) Expand all
793 [error localizedDescription], 817 [error localizedDescription],
794 [error domain], static_cast<long int>([error code])); 818 [error domain], static_cast<long int>([error code]));
795 } 819 }
796 820
797 // Note that this code is only executed if the simulator fails to start 821 // Note that this code is only executed if the simulator fails to start
798 // because once the main run loop is started, only the delegate calling 822 // because once the main run loop is started, only the delegate calling
799 // exit() will end the program. 823 // exit() will end the program.
800 [pool drain]; 824 [pool drain];
801 return kExitFailure; 825 return kExitFailure;
802 } 826 }
OLDNEW
« no previous file with comments | « testing/iossim/iossim.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698