@@ -84,6 +84,9 @@ - (void)deleteGeneratedFiles
8484 [fileManager removeItemAtPath: _unzipFolderPath error: nil ];
8585}
8686
87+
88+ #pragma mark - Tests
89+
8790- (void )testUnzipping
8891{
8992 [self unzipUntilDelegateMethodsReturn: nil ];
@@ -107,16 +110,18 @@ - (void)testUnzippingOfNonExistingArchive
107110 XCTAssertFalse (_unzippingSuccessful);
108111}
109112
110- // This test is not working as SSZipArchive will return succes although file operations fail
113+ // This test is not working as SSZipArchive will return success although file operations fail
111114// This requires some modifications of SSZipArchive
115+ /*
112116- (void)testUnzippingOfInaccessibleUnzipFolder
113117{
114118 _installData.unzipURL = [NSURL fileURLWithPath:@"/temp/surelynotexistingfolder"];
115119
116- // [self unzipUntilDelegateMethodsReturn:];
120+ [self unzipUntilDelegateMethodsReturn:];
117121
118- // XCTAssertFalse(_unzippingSuccessful);
122+ XCTAssertFalse(_unzippingSuccessful);
119123}
124+ */
120125
121126- (void )testUnzipOfPasswordProtectedPackage
122127{
@@ -132,22 +137,8 @@ - (void)testUnzipOfPasswordProtectedPackage
132137 CCAssertEqualStrings (contentsOfSecretFile, @" unzipping successful" );
133138}
134139
135- - (void )unzipUntilDelegateMethodsReturn : (NSString *)password
136- {
137- self.condition = [[NSCondition alloc ] init ];
138- [_condition lock ];
139140
140- CCPackageUnzipper *unzipper = [[CCPackageUnzipper alloc ] initWithPackage: _package];
141- unzipper.password = password;
142- unzipper.delegate = self;
143- [unzipper unpackPackage ];
144-
145- while (!_unzipperReturned)
146- {
147- [_condition wait ];
148- }
149- [_condition unlock ];
150- }
141+ #pragma mark - CCPackageUnzipperDelegate
151142
152143- (void )unzipFinished : (CCPackageUnzipper *)packageUnzipper
153144{
@@ -165,4 +156,24 @@ - (void)unzipFailed:(CCPackageUnzipper *)packageUnzipper error:(NSError *)error
165156 [_condition signal ];
166157}
167158
159+
160+ #pragma mark - Helper
161+
162+ - (void )unzipUntilDelegateMethodsReturn : (NSString *)password
163+ {
164+ self.condition = [[NSCondition alloc ] init ];
165+ [_condition lock ];
166+
167+ CCPackageUnzipper *unzipper = [[CCPackageUnzipper alloc ] initWithPackage: _package];
168+ unzipper.password = password;
169+ unzipper.delegate = self;
170+ [unzipper unpackPackage ];
171+
172+ while (!_unzipperReturned)
173+ {
174+ [_condition wait ];
175+ }
176+ [_condition unlock ];
177+ }
178+
168179@end
0 commit comments