Ensure fakes/mocks are debug-only.

This commit is contained in:
Matthew Chen 2018-09-14 14:18:39 -04:00
parent ef12612a9c
commit 2ba642c9e9
18 changed files with 77 additions and 10 deletions

View File

@ -28,7 +28,7 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1115976DB2D993FB7AAB33CEBB52F472"
BlueprintIdentifier = "237277EA071A0C42090E0E10F34EFC45"
BuildableName = "SignalServiceKit.framework"
BlueprintName = "SignalServiceKit"
ReferencedContainer = "container:Pods/Pods.xcodeproj">
@ -56,7 +56,7 @@
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B50508FED0E49769CFCF3F5D7B5FCD61"
BlueprintIdentifier = "11B0EF2E18D829262A7DF015BEBB0909"
BuildableName = "SignalServiceKit-Unit-Tests.xctest"
BlueprintName = "SignalServiceKit-Unit-Tests"
ReferencedContainer = "container:Pods/Pods.xcodeproj">

View File

@ -6,8 +6,12 @@
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@interface OWSFakeCallMessageHandler : NSObject <OWSCallMessageHandler>
@end
#endif
NS_ASSUME_NONNULL_END

View File

@ -1,37 +1,42 @@
// Created by Michael Kirk on 12/18/16.
// Copyright © 2016 Open Whisper Systems. All rights reserved.
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "OWSFakeCallMessageHandler.h"
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@implementation OWSFakeCallMessageHandler
- (void)receivedOffer:(OWSSignalServiceProtosCallMessageOffer *)offer fromCallerId:(NSString *)callerId
- (void)receivedOffer:(SSKProtoCallMessageOffer *)offer fromCallerId:(NSString *)callerId
{
NSLog(@"%s", __PRETTY_FUNCTION__);
}
- (void)receivedAnswer:(OWSSignalServiceProtosCallMessageAnswer *)answer fromCallerId:(NSString *)callerId
- (void)receivedAnswer:(SSKProtoCallMessageAnswer *)answer fromCallerId:(NSString *)callerId
{
NSLog(@"%s", __PRETTY_FUNCTION__);
}
- (void)receivedIceUpdate:(OWSSignalServiceProtosCallMessageIceUpdate *)iceUpdate fromCallerId:(NSString *)callerId
- (void)receivedIceUpdate:(SSKProtoCallMessageIceUpdate *)iceUpdate fromCallerId:(NSString *)callerId
{
NSLog(@"%s", __PRETTY_FUNCTION__);
}
- (void)receivedHangup:(OWSSignalServiceProtosCallMessageHangup *)hangup fromCallerId:(NSString *)callerId
- (void)receivedHangup:(SSKProtoCallMessageHangup *)hangup fromCallerId:(NSString *)callerId
{
NSLog(@"%s", __PRETTY_FUNCTION__);
}
- (void)receivedBusy:(OWSSignalServiceProtosCallMessageBusy *)busy fromCallerId:(NSString *)callerId
- (void)receivedBusy:(SSKProtoCallMessageBusy *)busy fromCallerId:(NSString *)callerId
{
NSLog(@"%s", __PRETTY_FUNCTION__);
}
@end
#endif
NS_ASSUME_NONNULL_END

View File

@ -6,8 +6,12 @@
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@interface OWSFakeContactsManager : NSObject <ContactsManagerProtocol>
@end
#endif
NS_ASSUME_NONNULL_END

View File

@ -6,7 +6,7 @@
NS_ASSUME_NONNULL_BEGIN
@class UIImage;
#ifdef DEBUG
@implementation OWSFakeContactsManager
@ -37,4 +37,6 @@ NS_ASSUME_NONNULL_BEGIN
@end
#endif
NS_ASSUME_NONNULL_END

View File

@ -6,6 +6,8 @@
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@interface OWSFakeMessageSender : OWSMessageSender
@property (nonatomic, nullable) dispatch_block_t enqueueMessageBlock;
@ -14,4 +16,6 @@ NS_ASSUME_NONNULL_BEGIN
@end
#endif
NS_ASSUME_NONNULL_END

View File

@ -6,6 +6,8 @@
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@implementation OWSFakeMessageSender
- (void)enqueueMessage:(TSOutgoingMessage *)message
@ -46,4 +48,6 @@ NS_ASSUME_NONNULL_BEGIN
@end
#endif
NS_ASSUME_NONNULL_END

View File

@ -6,10 +6,14 @@
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@interface OWSFakeNetworkManager : TSNetworkManager
- (instancetype)init;
@end
#endif
NS_ASSUME_NONNULL_END

View File

@ -6,6 +6,8 @@
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@implementation OWSFakeNetworkManager
- (void)makeRequest:(TSRequest *)request
@ -17,4 +19,6 @@ NS_ASSUME_NONNULL_BEGIN
@end
#endif
NS_ASSUME_NONNULL_END

View File

@ -6,8 +6,12 @@
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@interface OWSFakeNotificationsManager : NSObject <NotificationsProtocol>
@end
#endif
NS_ASSUME_NONNULL_END

View File

@ -6,6 +6,8 @@
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@implementation OWSFakeNotificationsManager
- (void)notifyUserForIncomingMessage:(TSIncomingMessage *)incomingMessage
@ -23,4 +25,6 @@ NS_ASSUME_NONNULL_BEGIN
@end
#endif
NS_ASSUME_NONNULL_END

View File

@ -6,8 +6,12 @@
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@interface OWSFakeProfileManager : NSObject <ProfileManagerProtocol>
@end
#endif
NS_ASSUME_NONNULL_END

View File

@ -8,6 +8,8 @@
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@interface OWSFakeProfileManager ()
@property (nonatomic, readonly) NSMutableDictionary<NSString *, OWSAES256Key *> *profileKeys;
@ -68,4 +70,6 @@ NS_ASSUME_NONNULL_BEGIN
@end
#endif
NS_ASSUME_NONNULL_END

View File

@ -6,8 +6,12 @@
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@interface TestAppContext : NSObject <AppContext>
@end
#endif
NS_ASSUME_NONNULL_END

View File

@ -7,6 +7,8 @@
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@interface TestAppContext ()
@property (nonatomic) SSKTestKeychainStorage *testKeychainStorage;
@ -150,4 +152,6 @@ NS_ASSUME_NONNULL_BEGIN
@end
#endif
NS_ASSUME_NONNULL_END

View File

@ -4,6 +4,8 @@
import Foundation
#if DEBUG
@objc
public class SSKTestKeychainStorage: NSObject, SSKKeychainStorage {
@ -50,3 +52,5 @@ public class SSKTestKeychainStorage: NSObject, SSKKeychainStorage {
dataMap.removeValue(forKey: key)
}
}
#endif

View File

@ -6,8 +6,12 @@
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@interface SSKBaseTest : XCTestCase
@end
#endif
NS_ASSUME_NONNULL_END

View File

@ -9,6 +9,8 @@
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@implementation SSKBaseTest
- (void)setUp
@ -35,4 +37,6 @@ NS_ASSUME_NONNULL_BEGIN
@end
#endif
NS_ASSUME_NONNULL_END