Skip to content

Commit 25a120b

Browse files
committed
Fix Performance Unit Tests requiring Swizzling
1 parent c216e1f commit 25a120b

File tree

7 files changed

+6
-21
lines changed

7 files changed

+6
-21
lines changed

FirebasePerformance/Sources/Instrumentation/FPRSelectorInstrumentor.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#import "FirebasePerformance/Sources/Common/FPRDiagnostics.h"
1818

1919
#import <GoogleUtilities/GULSwizzler.h>
20-
#ifdef UNSWIZZLE_AVAILABLE
20+
#ifdef FPR_UNSWIZZLE_AVAILABLE
2121
#import <GoogleUtilities/GULSwizzler+Unswizzle.h>
2222
#endif
2323

@@ -76,7 +76,7 @@ - (void)swizzle {
7676

7777
- (void)unswizzle {
7878
_swizzled = NO;
79-
#ifdef UNSWIZZLE_AVAILABLE
79+
#ifdef FPR_UNSWIZZLE_AVAILABLE
8080
[GULSwizzler unswizzleClass:_class selector:_selector isClassSelector:_isClassSelector];
8181
#else
8282
NSAssert(NO, @"Unswizzling is disabled.");

FirebasePerformance/Tests/Unit/FPRClassInstrumentorTest.m

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ - (void)testCannotInstrumentSameSelectorTwice {
5757

5858
#pragma mark - Unswizzle based tests
5959

60-
#if !SWIFT_PACKAGE
61-
6260
/** Tests swizzling an instance selector. */
6361
- (void)testSwizzleInstanceSelector {
6462
FPRClassInstrumentor *classInstrumentor =
@@ -158,6 +156,4 @@ - (void)testVoidReturnClassSelector {
158156
[classInstrumentor unswizzle];
159157
}
160158

161-
#endif // SWIFT_PACKAGE
162-
163159
@end

FirebasePerformance/Tests/Unit/FPRInstrumentTest.m

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ - (void)testRegisterAlreadyRegisteredClassInstrumentor {
6565

6666
#pragma mark - Unswizzle based tests
6767

68-
#if !SWIFT_PACKAGE
69-
7068
- (void)testDeregisterInstrumentors {
7169
FPRInstrument *instrument = [[FPRInstrument alloc] init];
7270
FPRClassInstrumentor *classInstrumentor =
@@ -86,6 +84,4 @@ - (void)testDeregisterInstrumentors {
8684
[classInstrumentor unswizzle];
8785
}
8886

89-
#endif // SWIFT_PACKAGE
90-
9187
@end

FirebasePerformance/Tests/Unit/Instruments/FPRNSURLConnectionInstrumentTest.m

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
#pragma mark - Unswizzle based tests
1616

17-
#if !SWIFT_PACKAGE
18-
1917
#import "FirebasePerformance/Tests/Unit/Instruments/FPRNSURLConnectionInstrumentTestDelegates.h"
2018

2119
#import <XCTest/XCTest.h>
@@ -519,5 +517,3 @@ - (void)testDownloadDelegateCompletionAPIGetsCalledEvenIfDataDelegateIsImplement
519517
}
520518

521519
@end
522-
523-
#endif // SWIFT_PACKAGE

FirebasePerformance/Tests/Unit/Instruments/FPRNSURLSessionInstrumentTest.m

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
#pragma mark - Unswizzle based tests
1616

17-
#ifndef SWIFT_PACKAGE
18-
1917
#import "FirebasePerformance/Tests/Unit/Instruments/FPRNSURLSessionInstrumentTestDelegates.h"
2018

2119
#import <XCTest/XCTest.h>
@@ -836,5 +834,3 @@ - (void)testMutableRequestURLs {
836834
}
837835

838836
@end
839-
840-
#endif // SWIFT_PACKAGE

FirebasePerformance/Tests/Unit/Instruments/FPRUIViewControllerInstrumentTest.m

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
#pragma mark - Unswizzle based tests
1616

17-
#if !SWIFT_PACKAGE
18-
1917
#import "FirebasePerformance/Sources/Instrumentation/UIKit/FPRUIViewControllerInstrument.h"
2018

2119
#import <XCTest/XCTest.h>
@@ -173,4 +171,3 @@ - (void)testViewDidAppearInvokesPreviousViewDidDisappear {
173171

174172
@end
175173

176-
#endif // SWIFT_PACKAGE

Package.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,7 @@ let package = Package(
884884
.product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
885885
.product(name: "GULEnvironment", package: "GoogleUtilities"),
886886
.product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
887+
.product(name: "GULSwizzlerTestHelpers", package: "GoogleUtilities"),
887888
.product(name: "GULUserDefaults", package: "GoogleUtilities"),
888889
.product(name: "nanopb", package: "nanopb"),
889890
],
@@ -895,6 +896,7 @@ let package = Package(
895896
.define("PB_NO_PACKED_STRUCTS", to: "1"),
896897
.define("PB_ENABLE_MALLOC", to: "1"),
897898
.define("FIRPerformance_LIB_VERSION", to: firebaseVersion),
899+
.define("FPR_UNSWIZZLE_AVAILABLE", to: "1"),
898900
],
899901
linkerSettings: [
900902
.linkedFramework("MobileCoreServices", .when(platforms: [.iOS, .tvOS])),
@@ -907,6 +909,8 @@ let package = Package(
907909
"FirebasePerformanceTarget",
908910
"SharedTestUtilities",
909911
"GCDWebServer",
912+
.product(name: "GULMethodSwizzler", package: "GoogleUtilities"),
913+
.product(name: "GULSwizzlerTestHelpers", package: "GoogleUtilities"),
910914
.product(name: "OCMock", package: "ocmock"),
911915
],
912916
path: "FirebasePerformance/Tests/Unit",

0 commit comments

Comments
 (0)