incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [2/8] ios commit: Convert unit tests to ARC.
Date Tue, 02 Oct 2012 18:16:22 GMT
Convert unit tests to ARC.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/88bb5590
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/88bb5590
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/88bb5590

Branch: refs/heads/master
Commit: 88bb5590b7341baa2ee9ce95d6ecc2fc9497144a
Parents: c681026
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Tue Oct 2 13:51:30 2012 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Tue Oct 2 13:51:30 2012 -0400

----------------------------------------------------------------------
 CordovaLibTests/CDVFakeFileManager.m               |    8 +------
 CordovaLibTests/CDVFileTransferTests.m             |   16 +++++---------
 CordovaLibTests/CDVLocalStorageTests.m             |    2 +-
 CordovaLibTests/CDVWebViewTest.h                   |    2 +-
 CordovaLibTests/CDVWebViewTest.m                   |    7 ++---
 CordovaLibTests/CordovaLibApp/AppDelegate.m        |    1 -
 CordovaLibTests/CordovaLibApp/Cordova.plist        |   10 +++++---
 .../CordovaTests.xcodeproj/project.pbxproj         |    2 +
 8 files changed, 20 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/88bb5590/CordovaLibTests/CDVFakeFileManager.m
----------------------------------------------------------------------
diff --git a/CordovaLibTests/CDVFakeFileManager.m b/CordovaLibTests/CDVFakeFileManager.m
index 1aa7f12..50ecd43 100644
--- a/CordovaLibTests/CDVFakeFileManager.m
+++ b/CordovaLibTests/CDVFakeFileManager.m
@@ -30,15 +30,9 @@
     return self;
 }
 
-- (void)dealloc
-{
-    [_fileExistsBlock release];
-    [super dealloc];
-}
-
 + (id)managerWithFileExistsBlock:(CDVFileExistsBlock)fileExistsBlock
 {
-    return [[[CDVFakeFileManager alloc] initWithFileExistsBlock:fileExistsBlock] autorelease];
+    return [[CDVFakeFileManager alloc] initWithFileExistsBlock:fileExistsBlock];
 }
 
 - (BOOL)fileExistsAtPath:(NSString*)path

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/88bb5590/CordovaLibTests/CDVFileTransferTests.m
----------------------------------------------------------------------
diff --git a/CordovaLibTests/CDVFileTransferTests.m b/CordovaLibTests/CDVFileTransferTests.m
index 4f1c617..c8071a7 100644
--- a/CordovaLibTests/CDVFileTransferTests.m
+++ b/CordovaLibTests/CDVFileTransferTests.m
@@ -67,17 +67,14 @@ static NSData *readStream(NSInputStream* stream)
     _arguments = [[NSMutableArray alloc] initWithObjects:
         kDummyArgTarget, kDummyArgServer, kDummyArgFileKey, [NSNull null],
         [NSNull null], [NSNull null], [NSNull null], [NSNull null], [NSNull null], nil];
-    _dummyFileData = [[kDummyFileContents dataUsingEncoding:NSUTF8StringEncoding] retain];
+    _dummyFileData = [kDummyFileContents dataUsingEncoding:NSUTF8StringEncoding];
     _fileTransfer = [[CDVFileTransfer alloc] init];
 }
 
 - (void)tearDown
 {
-    [_arguments release];
     _arguments = nil;
-    [_dummyFileData release];
     _dummyFileData = nil;
-    [_fileTransfer release];
     _fileTransfer = nil;
     [super tearDown];
 }
@@ -109,10 +106,10 @@ static NSData *readStream(NSInputStream* stream)
 
 - (NSURLRequest*)requestForUpload
 {
-    CDVInvokedUrlCommand* command = [[[CDVInvokedUrlCommand alloc] initWithArguments:_arguments
-                                                                          callbackId:kDummyArgCallbackId
-                                                                           className:@"FileTransfer"
-                                                                          methodName:@"upload"]
autorelease];
+    CDVInvokedUrlCommand* command = [[CDVInvokedUrlCommand alloc] initWithArguments:_arguments
+                                                                         callbackId:kDummyArgCallbackId
+                                                                          className:@"FileTransfer"
+                                                                         methodName:@"upload"];
 
     return [_fileTransfer requestForUploadCommand:command fileData:_dummyFileData];
 }
@@ -157,7 +154,6 @@ static NSData *readStream(NSInputStream* stream)
 
 - (void)testUpload_missingFileData
 {
-    [_dummyFileData release];
     _dummyFileData = nil;
     STAssertNil([self requestForUpload], nil);
 }
@@ -194,7 +190,7 @@ static NSData *readStream(NSInputStream* stream)
         @"val3", @"key3", nil];
     [self setParams:params];
     NSURLRequest* request = [self requestForUpload];
-    NSString* payload = [[[NSString alloc] initWithData:[request HTTPBody] encoding:NSUTF8StringEncoding]
autorelease];
+    NSString* payload = [[NSString alloc] initWithData:[request HTTPBody] encoding:NSUTF8StringEncoding];
     // Check that the cookie is set, and that it is not in the payload like others in the
options dict.
     STAssertTrue([@"cookieval" isEqualToString:[request valueForHTTPHeaderField:@"Cookie"]],
nil);
     STAssertEquals([payload rangeOfString:@"cookieval"].length, 0U, nil);

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/88bb5590/CordovaLibTests/CDVLocalStorageTests.m
----------------------------------------------------------------------
diff --git a/CordovaLibTests/CDVLocalStorageTests.m b/CordovaLibTests/CDVLocalStorageTests.m
index 91bfbd2..c921693 100644
--- a/CordovaLibTests/CDVLocalStorageTests.m
+++ b/CordovaLibTests/CDVLocalStorageTests.m
@@ -49,7 +49,7 @@
 
 - (CDVLocalStorage*)localStorage
 {
-    return [self pluginForClass:[CDVLocalStorage class]];
+    return [self pluginInstance:@"LocalStorage"];
 }
 
 - (void)deleteOriginals:(BOOL)originals backups:(BOOL)backups

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/88bb5590/CordovaLibTests/CDVWebViewTest.h
----------------------------------------------------------------------
diff --git a/CordovaLibTests/CDVWebViewTest.h b/CordovaLibTests/CDVWebViewTest.h
index d3b5875..21d7203 100644
--- a/CordovaLibTests/CDVWebViewTest.h
+++ b/CordovaLibTests/CDVWebViewTest.h
@@ -32,7 +32,7 @@
 - (UIWebView*)webView;
 
 // Returns the already registered plugin object for the given class.
-- (id)pluginForClass:(Class)cls;
+- (id)pluginInstance:(NSString*)pluginName;
 // Destroys the existing webview and creates a new one.
 - (void)reloadWebView;
 // Runs the run loop until the given block returns true, or until a timeout

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/88bb5590/CordovaLibTests/CDVWebViewTest.m
----------------------------------------------------------------------
diff --git a/CordovaLibTests/CDVWebViewTest.m b/CordovaLibTests/CDVWebViewTest.m
index d97ee95..c0cb173 100644
--- a/CordovaLibTests/CDVWebViewTest.m
+++ b/CordovaLibTests/CDVWebViewTest.m
@@ -74,12 +74,11 @@
     return self.viewController.webView;
 }
 
-- (id)pluginForClass:(Class)cls
+- (id)pluginInstance:(NSString*)pluginName
 {
-    NSString* className = NSStringFromClass(cls);
-    id ret = [self.viewController.pluginObjects objectForKey:className];
+    id ret = [self.viewController getCommandInstance:pluginName];
 
-    STAssertNotNil(ret, @"Missing plugin %@", className);
+    STAssertNotNil(ret, @"Missing plugin %@", pluginName);
     return ret;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/88bb5590/CordovaLibTests/CordovaLibApp/AppDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaLibTests/CordovaLibApp/AppDelegate.m b/CordovaLibTests/CordovaLibApp/AppDelegate.m
index 7a1b92c..f8e93e4 100644
--- a/CordovaLibTests/CordovaLibApp/AppDelegate.m
+++ b/CordovaLibTests/CordovaLibApp/AppDelegate.m
@@ -55,7 +55,6 @@
     // Clean up circular refs so that the view controller will actually be released.
     [self.viewController dispose];
     self.viewController = nil;
-    self.window.rootViewController = nil;
 }
 
 - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/88bb5590/CordovaLibTests/CordovaLibApp/Cordova.plist
----------------------------------------------------------------------
diff --git a/CordovaLibTests/CordovaLibApp/Cordova.plist b/CordovaLibTests/CordovaLibApp/Cordova.plist
index 2bbdcf9..61e39ea 100644
--- a/CordovaLibTests/CordovaLibApp/Cordova.plist
+++ b/CordovaLibTests/CordovaLibApp/Cordova.plist
@@ -2,10 +2,10 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
-    <key>KeyboardDisplayRequiresUserAction</key>
-    <true/>
-    <key>SuppressesIncrementalRendering</key>
-    <false/>
+	<key>KeyboardDisplayRequiresUserAction</key>
+	<true/>
+	<key>SuppressesIncrementalRendering</key>
+	<false/>
 	<key>UIWebViewBounce</key>
 	<true/>
 	<key>TopActivityIndicator</key>
@@ -30,6 +30,8 @@
 	<array/>
 	<key>Plugins</key>
 	<dict>
+		<key>LocalStorage</key>
+		<string>CDVLocalStorage</string>
 		<key>Device</key>
 		<string>CDVDevice</string>
 		<key>Logger</key>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/88bb5590/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj b/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj
index 52c13c2..cfbcac9 100644
--- a/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj
+++ b/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj
@@ -583,6 +583,7 @@
 					armv7,
 				);
 				BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CordovaLibApp.app/CordovaLibApp";
+				CLANG_ENABLE_OBJC_ARC = YES;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(SDKROOT)/Developer/Library/Frameworks",
 					"$(DEVELOPER_LIBRARY_DIR)/Frameworks",
@@ -617,6 +618,7 @@
 					armv7,
 				);
 				BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/CordovaLibApp.app/CordovaLibApp";
+				CLANG_ENABLE_OBJC_ARC = YES;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(SDKROOT)/Developer/Library/Frameworks",
 					"$(DEVELOPER_LIBRARY_DIR)/Frameworks",


Mime
View raw message