Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include <asl.h> | 5 #include <asl.h> |
| 6 #import <Foundation/Foundation.h> | 6 #import <Foundation/Foundation.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 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 // is the PID of the process the message is about (as opposed to launchd's PID). | 62 // is the PID of the process the message is about (as opposed to launchd's PID). |
| 63 #define ASL_KEY_REF_PID "RefPID" | 63 #define ASL_KEY_REF_PID "RefPID" |
| 64 | 64 |
| 65 namespace { | 65 namespace { |
| 66 | 66 |
| 67 // Name of environment variables that control the user's home directory in the | 67 // Name of environment variables that control the user's home directory in the |
| 68 // simulator. | 68 // simulator. |
| 69 const char* const kUserHomeEnvVariable = "CFFIXED_USER_HOME"; | 69 const char* const kUserHomeEnvVariable = "CFFIXED_USER_HOME"; |
| 70 const char* const kHomeEnvVariable = "HOME"; | 70 const char* const kHomeEnvVariable = "HOME"; |
| 71 | 71 |
| 72 // Device family codes for iPhone and iPad. | |
| 73 const int kIPhoneFamily = 1; | |
| 74 const int kIPadFamily = 2; | |
|
Dirk Pranke
2016/03/16 01:23:22
Are these (and the constant on line 113) no longer
sdefresne
2016/03/17 10:53:47
Yeah, they cause compilation about unused const va
| |
| 75 | |
| 76 // Max number of seconds to wait for the simulator session to start. | 72 // Max number of seconds to wait for the simulator session to start. |
| 77 // This timeout must allow time to start up iOS Simulator, install the app | 73 // This timeout must allow time to start up iOS Simulator, install the app |
| 78 // and perform any other black magic that is encoded in the | 74 // and perform any other black magic that is encoded in the |
| 79 // iPhoneSimulatorRemoteClient framework to kick things off. Normal start up | 75 // iPhoneSimulatorRemoteClient framework to kick things off. Normal start up |
| 80 // time is only a couple seconds but machine load, disk caches, etc., can all | 76 // time is only a couple seconds but machine load, disk caches, etc., can all |
| 81 // affect startup time in the wild so the timeout needs to be fairly generous. | 77 // affect startup time in the wild so the timeout needs to be fairly generous. |
| 82 // If this timeout occurs iossim will likely exit with non-zero status; the | 78 // If this timeout occurs iossim will likely exit with non-zero status; the |
| 83 // exception being if the app is invoked and completes execution before the | 79 // exception being if the app is invoked and completes execution before the |
| 84 // session is started (this case is handled in session:didStart:withError). | 80 // session is started (this case is handled in session:didStart:withError). |
| 85 const NSTimeInterval kDefaultSessionStartTimeoutSeconds = 30; | 81 const NSTimeInterval kDefaultSessionStartTimeoutSeconds = 30; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 103 | 99 |
| 104 const char* gToolName = "iossim"; | 100 const char* gToolName = "iossim"; |
| 105 | 101 |
| 106 // Exit status codes. | 102 // Exit status codes. |
| 107 const int kExitSuccess = EXIT_SUCCESS; | 103 const int kExitSuccess = EXIT_SUCCESS; |
| 108 const int kExitFailure = EXIT_FAILURE; | 104 const int kExitFailure = EXIT_FAILURE; |
| 109 const int kExitInvalidArguments = 2; | 105 const int kExitInvalidArguments = 2; |
| 110 const int kExitInitializationFailure = 3; | 106 const int kExitInitializationFailure = 3; |
| 111 const int kExitAppFailedToStart = 4; | 107 const int kExitAppFailedToStart = 4; |
| 112 const int kExitAppCrashed = 5; | 108 const int kExitAppCrashed = 5; |
| 113 const int kExitUnsupportedXcodeVersion = 6; | |
| 114 | 109 |
| 115 void LogError(NSString* format, ...) { | 110 void LogError(NSString* format, ...) { |
| 116 va_list list; | 111 va_list list; |
| 117 va_start(list, format); | 112 va_start(list, format); |
| 118 | 113 |
| 119 NSString* message = | 114 NSString* message = |
| 120 [[[NSString alloc] initWithFormat:format arguments:list] autorelease]; | 115 [[[NSString alloc] initWithFormat:format arguments:list] autorelease]; |
| 121 | 116 |
| 122 fprintf(stderr, "%s: ERROR: %s\n", gToolName, [message UTF8String]); | 117 fprintf(stderr, "%s: ERROR: %s\n", gToolName, [message UTF8String]); |
| 123 fflush(stderr); | 118 fflush(stderr); |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 897 [error localizedDescription], | 892 [error localizedDescription], |
| 898 [error domain], static_cast<long int>([error code])); | 893 [error domain], static_cast<long int>([error code])); |
| 899 } | 894 } |
| 900 | 895 |
| 901 // Note that this code is only executed if the simulator fails to start | 896 // Note that this code is only executed if the simulator fails to start |
| 902 // because once the main run loop is started, only the delegate calling | 897 // because once the main run loop is started, only the delegate calling |
| 903 // exit() will end the program. | 898 // exit() will end the program. |
| 904 [pool drain]; | 899 [pool drain]; |
| 905 return kExitFailure; | 900 return kExitFailure; |
| 906 } | 901 } |
| OLD | NEW |