diff options
-rw-r--r-- | UnitTesting/GTMIPhoneUnitTestDelegate.m | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/UnitTesting/GTMIPhoneUnitTestDelegate.m b/UnitTesting/GTMIPhoneUnitTestDelegate.m index 03ded2f..affcc3e 100644 --- a/UnitTesting/GTMIPhoneUnitTestDelegate.m +++ b/UnitTesting/GTMIPhoneUnitTestDelegate.m @@ -60,7 +60,7 @@ if ((self = [super init])) { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self - selector:@selector(applicationDidFinishLaunching:) + selector:@selector(handleApplicationDidFinishLaunchingNotification:) name:UIApplicationDidFinishLaunchingNotification object:[UIApplication sharedApplication]]; [self setRetainer:self]; @@ -68,6 +68,12 @@ return self; } +// If running in the mode were we get the notification, bridge it over to +// the method we'd get if we are the app delegate. +- (void)handleApplicationDidFinishLaunchingNotification:(NSNotification *)note { + [self applicationDidFinishLaunching:[note object]]; +} + // Run through all the registered classes and run test methods on any // that are subclasses of SenTestCase. Terminate the application upon // test completion. @@ -82,7 +88,7 @@ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc removeObserver:self name:UIApplicationDidFinishLaunchingNotification - object:[UIApplication sharedApplication]]; + object:application]; // To permit UI-based tests, run the tests and exit app in a delayed selector // call. This ensures tests are run outside of applicationDidFinishLaunching:. |