Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Performance Unit Tests requiring Unswizzling #13791

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
#import "FirebasePerformance/Sources/Common/FPRDiagnostics.h"

#import <GoogleUtilities/GULSwizzler.h>
#ifdef UNSWIZZLE_AVAILABLE
#import <GoogleUtilities/GULSwizzler+Unswizzle.h>
#endif

@implementation FPRSelectorInstrumentor {
// The class this instrumentor operates on.
Expand Down Expand Up @@ -76,11 +73,8 @@ - (void)swizzle {

- (void)unswizzle {
_swizzled = NO;
#ifdef UNSWIZZLE_AVAILABLE
[GULSwizzler unswizzleClass:_class selector:_selector isClassSelector:_isClassSelector];
#else
NSAssert(NO, @"Unswizzling is disabled.");
#endif
// For the SDK, we do not unswizzle, but this does run in unit tests,
// though it does not seem to have any effect
}

- (IMP)currentIMP {
Expand Down
4 changes: 0 additions & 4 deletions FirebasePerformance/Tests/Unit/FPRClassInstrumentorTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ - (void)testCannotInstrumentSameSelectorTwice {

#pragma mark - Unswizzle based tests

#if !SWIFT_PACKAGE

/** Tests swizzling an instance selector. */
- (void)testSwizzleInstanceSelector {
FPRClassInstrumentor *classInstrumentor =
Expand Down Expand Up @@ -158,6 +156,4 @@ - (void)testVoidReturnClassSelector {
[classInstrumentor unswizzle];
}

#endif // SWIFT_PACKAGE

@end
4 changes: 0 additions & 4 deletions FirebasePerformance/Tests/Unit/FPRInstrumentTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ - (void)testRegisterAlreadyRegisteredClassInstrumentor {

#pragma mark - Unswizzle based tests

#if !SWIFT_PACKAGE

- (void)testDeregisterInstrumentors {
FPRInstrument *instrument = [[FPRInstrument alloc] init];
FPRClassInstrumentor *classInstrumentor =
Expand All @@ -86,6 +84,4 @@ - (void)testDeregisterInstrumentors {
[classInstrumentor unswizzle];
}

#endif // SWIFT_PACKAGE

@end
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

#pragma mark - Unswizzle based tests

#if !SWIFT_PACKAGE

#import "FirebasePerformance/Tests/Unit/Instruments/FPRNSURLConnectionInstrumentTestDelegates.h"

#import <XCTest/XCTest.h>
Expand Down Expand Up @@ -519,5 +517,3 @@ - (void)testDownloadDelegateCompletionAPIGetsCalledEvenIfDataDelegateIsImplement
}

@end

#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

#pragma mark - Unswizzle based tests

#ifndef SWIFT_PACKAGE

#import "FirebasePerformance/Tests/Unit/Instruments/FPRNSURLSessionInstrumentTestDelegates.h"

#import <XCTest/XCTest.h>
Expand Down Expand Up @@ -836,5 +834,3 @@ - (void)testMutableRequestURLs {
}

@end

#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

#pragma mark - Unswizzle based tests

#if !SWIFT_PACKAGE

#import "FirebasePerformance/Sources/Instrumentation/UIKit/FPRUIViewControllerInstrument.h"

#import <XCTest/XCTest.h>
Expand Down Expand Up @@ -54,6 +52,8 @@ - (void)setUp {
originalViewDidDisappearInvoked = NO;
}

#if !SWIFT_PACKAGE

/** Tests that the viewControllerDidAppear: of the FPRScreenTraceTracker sharedInstance is invoked
* when a UIViewController's viewDidAppear: is invoked.
*/
Expand All @@ -77,6 +77,8 @@ - (void)testViewDidAppearInvokesViewControllerDidAppearOnScreenTraceTracker {
[[testViewController view] removeFromSuperview];
}

#endif // SWIFT_PACKAGE

/** Tests that the viewControllerDidAppear: of the FPRScreenTraceTracker sharedInstance is invoked
* when a UIViewController's viewDidAppear: is invoked.
*/
Expand Down Expand Up @@ -172,5 +174,3 @@ - (void)testViewDidAppearInvokesPreviousViewDidDisappear {
}

@end

#endif // SWIFT_PACKAGE
Loading