|
14 | 14 | #import "CCDirector.h" |
15 | 15 | #import "AppDelegate.h" |
16 | 16 |
|
| 17 | +@interface CCPackageDownload() |
| 18 | +- (NSString *)createTempName; |
| 19 | +@end |
| 20 | + |
17 | 21 | static NSUInteger __fileDownloadSize = 0; |
18 | 22 | static BOOL __support_range_request = YES; |
19 | 23 |
|
@@ -143,7 +147,7 @@ - (void)setUp |
143 | 147 | self.downloadReturned = NO; |
144 | 148 | self.downloadError = nil; |
145 | 149 | self.downloadSuccessful = NO; |
146 | | - self.shouldOverwriteDownloadedFile; |
| 150 | + [self shouldOverwriteDownloadedFile]; |
147 | 151 |
|
148 | 152 | self.package = [[CCPackage alloc] initWithName:@"testpackage" |
149 | 153 | resolution:@"phonehd" |
@@ -307,7 +311,7 @@ - (void)testPauseDownload |
307 | 311 |
|
308 | 312 | XCTAssertEqual(_package.status, CCPackageStatusDownloadPaused); |
309 | 313 | NSFileManager *fileManager = [NSFileManager defaultManager]; |
310 | | - NSString *tempName = [_download performSelector:@selector(createTempName)]; |
| 314 | + NSString *tempName = [_download createTempName]; |
311 | 315 |
|
312 | 316 | BOOL success = [fileManager fileExistsAtPath:[[_localURL.path stringByDeletingLastPathComponent] stringByAppendingPathComponent:tempName]] |
313 | 317 | || [fileManager fileExistsAtPath:_download.localURL.path]; |
@@ -341,7 +345,7 @@ - (void)setupPartialDownloadOnDisk |
341 | 345 | NSString *fileName = [_package.remoteURL lastPathComponent]; |
342 | 346 | NSString *pathToPackage = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"Resources-shared/Packages/%@", fileName] ofType:nil]; |
343 | 347 | NSData *data = [[NSData dataWithContentsOfFile:pathToPackage] subdataWithRange:NSMakeRange(0, 5000)]; |
344 | | - NSString *tempName = [_download performSelector:@selector(createTempName)]; |
| 348 | + NSString *tempName = [_download createTempName]; |
345 | 349 | [data writeToFile:[[_localURL.path stringByDeletingLastPathComponent] stringByAppendingPathComponent:tempName] atomically:YES]; |
346 | 350 | } |
347 | 351 |
|
|
0 commit comments