summaryrefslogtreecommitdiffstats
path: root/testing/iossim
diff options
context:
space:
mode:
authorthomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-10 17:02:59 +0000
committerthomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-10 17:02:59 +0000
commit30e331c4a98b8714e53232d3e8429cea73897e5b (patch)
tree2fa03237d7dc150e066c05a0d53338164ad5ef2f /testing/iossim
parentf0834d5ef9c16c10fdae4075b73b90c70f36efc3 (diff)
downloadchromium_src-30e331c4a98b8714e53232d3e8429cea73897e5b.zip
chromium_src-30e331c4a98b8714e53232d3e8429cea73897e5b.tar.gz
chromium_src-30e331c4a98b8714e53232d3e8429cea73897e5b.tar.bz2
Expose the startup timeout as something that can be controlled via commandline.
Review URL: https://chromiumcodereview.appspot.com/10826246 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151058 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'testing/iossim')
-rw-r--r--testing/iossim/iossim.mm25
1 files changed, 20 insertions, 5 deletions
diff --git a/testing/iossim/iossim.mm b/testing/iossim/iossim.mm
index c39e5a6..f5b5fd7 100644
--- a/testing/iossim/iossim.mm
+++ b/testing/iossim/iossim.mm
@@ -63,7 +63,7 @@ const int kIPadFamily = 2;
// If this timeout occurs iossim will likely exit with non-zero status; the
// exception being if the app is invoked and completes execution before the
// session is started (this case is handled in session:didStart:withError).
-const NSTimeInterval kSessionStartTimeoutSeconds = 30;
+const NSTimeInterval kDefaultSessionStartTimeoutSeconds = 30;
// While the simulated app is running, its stdout is redirected to a file which
// is polled by iossim and written to iossim's stdout using the following
@@ -492,7 +492,7 @@ BOOL InitializeSimulatorUserHome(NSString* userHomePath) {
// Prints the usage information to stderr.
void PrintUsage() {
fprintf(stderr, "Usage: iossim [-d device] [-s sdkVersion] [-u homeDir] "
- "[-e envKey=value]* <appPath> [<appArgs>]\n"
+ "[-e envKey=value]* [-t startupTimeout] <appPath> [<appArgs>]\n"
" where <appPath> is the path to the .app directory and appArgs are any"
" arguments to send the simulated app.\n"
"\n"
@@ -504,7 +504,10 @@ void PrintUsage() {
" -u Specifies a user home directory for the simulator."
" Will create a new directory if not specified.\n"
" -e Specifies an environment key=value pair that will be"
- " set in the simulated application's environment.\n");
+ " set in the simulated application's environment.\n"
+ " -t Specifies the session startup timeout (in seconds)."
+ " Defaults to %d.\n",
+ static_cast<int>(kDefaultSessionStartTimeoutSeconds));
}
} // namespace
@@ -531,10 +534,11 @@ int main(int argc, char* const argv[]) {
NSString* simHomePath = nil;
NSMutableArray* appArgs = [NSMutableArray array];
NSMutableDictionary* appEnv = [NSMutableDictionary dictionary];
+ NSTimeInterval sessionStartTimeout = kDefaultSessionStartTimeoutSeconds;
// Parse the optional arguments
int c;
- while ((c = getopt(argc, argv, "hs:d:u:e:")) != -1) {
+ while ((c = getopt(argc, argv, "hs:d:u:e:t:")) != -1) {
switch (c) {
case 's':
sdkVersion = [NSString stringWithUTF8String:optarg];
@@ -559,6 +563,17 @@ int main(int argc, char* const argv[]) {
[appEnv setObject:value forKey:key];
}
break;
+ case 't': {
+ int timeout = atoi(optarg);
+ if (timeout > 0) {
+ sessionStartTimeout = static_cast<NSTimeInterval>(timeout);
+ } else {
+ LogError(@"Invalid startup timeout (%s).", optarg);
+ PrintUsage();
+ exit(EXIT_FAILURE);
+ }
+ }
+ break;
case 'h':
PrintUsage();
exit(EXIT_SUCCESS);
@@ -660,7 +675,7 @@ int main(int argc, char* const argv[]) {
// Start the simulator session.
NSError* error;
BOOL started = [session requestStartWithConfig:config
- timeout:kSessionStartTimeoutSeconds
+ timeout:sessionStartTimeout
error:&error];
// Spin the runtime indefinitely. When the delegate gets the message that the