diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2014-03-26 16:24:08 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2014-03-26 16:24:08 +0000 |
commit | 6945781e0b3094d2547d31589c3a249bd65a2f41 (patch) | |
tree | 85cdb9744543a8d4162b9c55501dafdee85d41a1 /UnitTesting/GTMIPhoneUnitTestDelegate.m | |
parent | 0bac72735b993b897d88a341fd3ae7ef3df10b48 (diff) |
Add a different method for the notification vs. the delegate, but channel
the two together after switching back to the application object.
DELTA=8 (6 added, 0 deleted, 2 changed)
RCL=63807817-p10
RDATE=2014/03/26 08:58:12
Diffstat (limited to 'UnitTesting/GTMIPhoneUnitTestDelegate.m')
-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:. |