-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1194 from ably/fix/1188-NSSecureCoding
Fix/1188 Added allowed class for NSKeyedUnarchiver
- Loading branch information
Showing
8 changed files
with
55 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
@import XCTest; | ||
#import <Ably/Ably.h> | ||
|
||
@interface _StateMachineDelegate : NSObject <ARTPushRegistererDelegate> | ||
@end | ||
|
||
@implementation _StateMachineDelegate | ||
- (void)didActivateAblyPush:(nullable ARTErrorInfo *)error { } | ||
- (void)didDeactivateAblyPush:(nullable ARTErrorInfo *)error { } | ||
@end | ||
|
||
@interface ARTArchiveTests : XCTestCase | ||
@end | ||
|
||
@implementation ARTArchiveTests | ||
|
||
- (void)test_art_unarchivedObjectOfClass_for_state_machine_states { | ||
|
||
ARTRest* rest = [[ARTRest alloc] initWithKey:@"xxxx:xxxx"]; | ||
ARTPushActivationStateMachine* stateMachine = [[ARTPushActivationStateMachine alloc] initWithRest:rest.internal delegate:[[_StateMachineDelegate alloc] init]]; | ||
|
||
NSArray* initialStates = [NSMutableArray arrayWithArray:@[ | ||
[[ARTPushActivationStateNotActivated alloc] initWithMachine:stateMachine], | ||
[[ARTPushActivationStateWaitingForPushDeviceDetails alloc] initWithMachine:stateMachine], | ||
[[ARTPushActivationStateAfterRegistrationSyncFailed alloc] initWithMachine:stateMachine] | ||
]]; | ||
|
||
NSData* data = [initialStates art_archive]; | ||
|
||
NSArray* unarchivedStates = [ARTPushActivationState art_unarchiveFromData:data]; | ||
|
||
XCTAssert([unarchivedStates[0] isKindOfClass:[ARTPushActivationStateNotActivated class]]); | ||
XCTAssert([unarchivedStates[1] isKindOfClass:[ARTPushActivationStateWaitingForPushDeviceDetails class]]); | ||
XCTAssert([unarchivedStates[2] isKindOfClass:[ARTPushActivationStateAfterRegistrationSyncFailed class]]); | ||
} | ||
|
||
@end |