Skip to content

Commit 87a59ec

Browse files
committed
CCPackageDownloadManager cleansed of installData.
1 parent ee00155 commit 87a59ec

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

UnitTests/CCPackageDownloadManagerTests.m

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
#import "CCDirector.h"
1414
#import "AppDelegate.h"
1515
#import "CCUnitTestAssertions.h"
16-
#import "CCPackageInstallData.h"
17-
#import "CCPackage+InstallData.h"
1816

1917
@interface CCPackageDownloadManagerTestURLProtocol : NSURLProtocol @end
2018

@@ -142,7 +140,7 @@ - (void)testCancelDownload
142140
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeInterval:0.5 sinceDate:[NSDate date]]];
143141

144142
NSFileManager *fileManager = [NSFileManager defaultManager];
145-
XCTAssertFalse([fileManager fileExistsAtPath:[package1 installData].localDownloadURL.path]);
143+
XCTAssertFalse([fileManager fileExistsAtPath:package1.localDownloadURL.path]);
146144
}
147145

148146
- (void)testPauseAndResumeAllDownloads
@@ -193,8 +191,8 @@ - (void)assertPackagesDownloadedAndContentsAreAsExpected:(NSArray *)packages
193191
NSFileManager *fileManager = [NSFileManager defaultManager];
194192
for (CCPackage *aPackage in packages)
195193
{
196-
XCTAssertTrue([fileManager fileExistsAtPath:[aPackage installData].localDownloadURL.path]);
197-
CCAssertEqualStrings(aPackage.name, [NSString stringWithContentsOfFile:[aPackage installData].localDownloadURL.path encoding:NSUTF8StringEncoding error:nil]);
194+
XCTAssertTrue([fileManager fileExistsAtPath:aPackage.localDownloadURL.path]);
195+
CCAssertEqualStrings(aPackage.name, [NSString stringWithContentsOfFile:aPackage.localDownloadURL.path encoding:NSUTF8StringEncoding error:nil]);
198196
}
199197
}
200198

@@ -204,9 +202,6 @@ - (void)assertPackagesDownloadedAndContentsAreAsExpected:(NSArray *)packages
204202
- (CCPackage *)completePackageWithName:(NSString *)name
205203
{
206204
CCPackage *package = [[CCPackage alloc] initWithName:name resolution:@"phonehd" os:@"iOS" remoteURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://package.fake/%@", name]]];
207-
CCPackageInstallData *installData = [[CCPackageInstallData alloc] init];
208-
[package setInstallData:installData];
209-
210205
return package;
211206
}
212207

cocos2d/CCPackageDownloadManager.m

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
#import "CCPackage.h"
33
#import "CCPackageDownload.h"
44
#import "CCPackageDownloadManagerDelegate.h"
5-
#import "CCPackageInstallData.h"
6-
#import "CCPackage+InstallData.h"
75
#import "CCPackageConstants.h"
86
#import "ccMacros.h"
7+
#import "CCPackage_private.h"
98

109

1110
@interface CCPackageDownloadManager()
@@ -87,10 +86,7 @@ - (void)enqueuePackageForDownload:(CCPackage *)package
8786
CCPackageDownload *packageDownload = [[CCPackageDownload alloc] initWithPackage:package
8887
localURL:[NSURL fileURLWithPath:[_downloadPath stringByAppendingPathComponent:fileName]]];
8988

90-
CCPackageInstallData *installData = [package installData];
91-
NSAssert(installData != nil, @"installData must not be nil");
92-
installData.localDownloadURL = [NSURL fileURLWithPath:[_downloadPath stringByAppendingPathComponent:fileName]];
93-
89+
package.localDownloadURL = [NSURL fileURLWithPath:[_downloadPath stringByAppendingPathComponent:fileName]];
9490
packageDownload.delegate = self;
9591

9692
[_downloads addObject:packageDownload];

0 commit comments

Comments
 (0)