Fix unarchiving unit tests

This commit is contained in:
Zorg committed 2016-03-26 02:20:34 -04:00
1 parent 8e4498adaf
commit fb32c8e18a
6 files changed
+17 -14

No files matched your search

+2
View File
@@ -164,6 +164,7 @@
726E07671CA61648001A286B /* SUBinaryDeltaCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8E20FD68CC7005AE3F6 /* SUBinaryDeltaCommon.m */; };
726E07691CA616A4001A286B /* libxar.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 726E07681CA616A4001A286B /* libxar.tbd */; };
726E076B1CA616B3001A286B /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 726E076A1CA616B3001A286B /* libbz2.tbd */; };
726E076D1CA66180001A286B /* SUBinaryDeltaUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E9380FD69271005AE3F6 /* SUBinaryDeltaUnarchiver.m */; };
726E4A0E1C86881600C57C6A /* SUStandardUserDriverUIDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 726E4A0D1C86881600C57C6A /* SUStandardUserDriverUIDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
726E4A101C86B5A200C57C6A /* SUStandardUserDriverRemoteDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 726E4A0F1C86B5A200C57C6A /* SUStandardUserDriverRemoteDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
726E4A1B1C86C88F00C57C6A /* TestAppHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E4A1A1C86C88F00C57C6A /* TestAppHelper.m */; };
@@ -1880,6 +1881,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
726E076D1CA66180001A286B /* SUBinaryDeltaUnarchiver.m in Sources */,
72A6F9871C94C4AE005F404C /* SUDiskImageUnarchiver.m in Sources */,
72A6F9861C94C49C005F404C /* SUPipedUnarchiver.m in Sources */,
72A6F9841C94C3FE005F404C /* SUBinaryDeltaApply.m in Sources */,
+5 -1
View File
@@ -12,10 +12,14 @@
#import <Foundation/Foundation.h>
#import "SUUnarchiverProtocol.h"
NS_ASSUME_NONNULL_BEGIN
@interface SUBinaryDeltaUnarchiver : NSObject <SUUnarchiver>
- (instancetype)initWithArchivePath:(NSString *)archivePath updateHostBundlePath:(NSString *)updateHostBundlePath delegate:(id <SUUnarchiverDelegate>)delegate;
- (instancetype)initWithArchivePath:(NSString *)archivePath updateHostBundlePath:(NSString *)updateHostBundlePath delegate:(nullable id <SUUnarchiverDelegate>)delegate;
@end
NS_ASSUME_NONNULL_END
#endif
+1 -1
View File
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface SUUnarchiver : NSObject
+ (nullable id <SUUnarchiver>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword delegate:(nullable id <SUUnarchiverDelegate>)delegate;
+ (nullable id <SUUnarchiver>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword delegate:(nullable id <SUUnarchiverDelegate>)delegate;
@end
+4 -2
View File
@@ -18,7 +18,7 @@
@implementation SUUnarchiver
+ (nullable id <SUUnarchiver>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword delegate:(nullable id <SUUnarchiverDelegate>)delegate
+ (nullable id <SUUnarchiver>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword delegate:(nullable id <SUUnarchiverDelegate>)delegate
{
if ([SUPipedUnarchiver canUnarchivePath:path]) {
return [[SUPipedUnarchiver alloc] initWithArchivePath:path delegate:delegate];
@@ -27,7 +27,9 @@
return [[SUDiskImageUnarchiver alloc] initWithArchivePath:path decryptionPassword:decryptionPassword delegate:delegate];
} else if ([SUBinaryDeltaUnarchiver canUnarchivePath:path]) {
return [[SUBinaryDeltaUnarchiver alloc] initWithArchivePath:path updateHostBundlePath:hostPath delegate:delegate];
assert(hostPath != nil);
NSString *nonNullHostPath = hostPath;
return [[SUBinaryDeltaUnarchiver alloc] initWithArchivePath:path updateHostBundlePath:nonNullHostPath delegate:delegate];
}
return nil;
+4 -10
View File
@@ -14,17 +14,13 @@ class SUUnarchiverTest: XCTestCase, SUUnarchiverDelegate
var unarchivedExpectation: XCTestExpectation? = nil
var unarchivedResult: Bool = false
func unarchiver(unarchiver: SUUnarchiver!, extractedProgress progress: Double)
{
}
func unarchiverDidFail(unarchiver: SUUnarchiver!)
func unarchiverDidFail()
{
self.unarchivedResult = false
self.unarchivedExpectation!.fulfill()
}
func unarchiverDidFinish(unarchiver: SUUnarchiver!)
func unarchiverDidFinish()
{
self.unarchivedResult = true
self.unarchivedExpectation!.fulfill()
@@ -49,10 +45,8 @@ class SUUnarchiverTest: XCTestCase, SUUnarchiverDelegate
self.unarchivedExpectation = super.expectationWithDescription("Unarchived Application (format: \(archiveExtension))")
let unarchiver = SUUnarchiver(forPath: tempArchiveURL.path!, updatingHostBundlePath: nil, withPassword: self.password)
unarchiver.delegate = self
unarchiver.start()
let unarchiver = SUUnarchiver.unarchiverForPath(tempArchiveURL.path!, updatingHostBundlePath: nil, decryptionPassword: self.password, delegate: self)
unarchiver!.start()
super.waitForExpectationsWithTimeout(7.0, handler: nil)
@@ -3,6 +3,7 @@
//
#import "SUUnarchiver.h"
#import "SUUnarchiverProtocol.h"
#import "SUPipedUnarchiver.h"
#import "SUBinaryDeltaCommon.h"
#import "SUFileManager.h"