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 #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 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 didStart:(BOOL)started | 205 didStart:(BOOL)started |
206 withError:(NSError*)error { | 206 withError:(NSError*)error { |
207 if (!started) { | 207 if (!started) { |
208 // If the test executes very quickly (<30ms), the SimulatorDelegate may not | 208 // If the test executes very quickly (<30ms), the SimulatorDelegate may not |
209 // get the initial session:started:withError: message indicating successful | 209 // get the initial session:started:withError: message indicating successful |
210 // startup of the simulated app. Instead the delegate will get a | 210 // startup of the simulated app. Instead the delegate will get a |
211 // session:started:withError: message after the timeout has elapsed. To | 211 // session:started:withError: message after the timeout has elapsed. To |
212 // account for this case, check if the simulated app's stdio file was | 212 // account for this case, check if the simulated app's stdio file was |
213 // ever created and if it exists dump it to stdout and return success. | 213 // ever created and if it exists dump it to stdout and return success. |
214 NSFileManager* fileManager = [NSFileManager defaultManager]; | 214 NSFileManager* fileManager = [NSFileManager defaultManager]; |
215 if ([fileManager fileExistsAtPath:stdioPath_ isDirectory:NO]) { | 215 if ([fileManager fileExistsAtPath:stdioPath_]) { |
216 appRunning_ = NO; | 216 appRunning_ = NO; |
217 [self tailOutput]; | 217 [self tailOutput]; |
218 // Note that exiting in this state leaves a process running | 218 // Note that exiting in this state leaves a process running |
219 // (e.g. /.../iPhoneSimulator4.3.sdk/usr/libexec/installd -t 30) that will | 219 // (e.g. /.../iPhoneSimulator4.3.sdk/usr/libexec/installd -t 30) that will |
220 // prevent future simulator sessions from being started for 30 seconds | 220 // prevent future simulator sessions from being started for 30 seconds |
221 // unless the iOS Simulator application is killed altogether. | 221 // unless the iOS Simulator application is killed altogether. |
222 [self session:session didEndWithError:nil]; | 222 [self session:session didEndWithError:nil]; |
223 | 223 |
224 // session:didEndWithError should not return (because it exits) so | 224 // session:didEndWithError should not return (because it exits) so |
225 // the execution path should never get here. | 225 // the execution path should never get here. |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 [error localizedDescription], | 687 [error localizedDescription], |
688 [error domain], static_cast<long int>([error code])); | 688 [error domain], static_cast<long int>([error code])); |
689 } | 689 } |
690 | 690 |
691 // Note that this code is only executed if the simulator fails to start | 691 // Note that this code is only executed if the simulator fails to start |
692 // because once the main run loop is started, only the delegate calling | 692 // because once the main run loop is started, only the delegate calling |
693 // exit() will end the program. | 693 // exit() will end the program. |
694 [pool drain]; | 694 [pool drain]; |
695 return EXIT_FAILURE; | 695 return EXIT_FAILURE; |
696 } | 696 } |
OLD | NEW |