Repository: cordova-osx Updated Branches: refs/heads/master e648de696 -> 6370c1e13
trivial: reformat Project: http://git-wip-us.apache.org/repos/asf/cordova-osx/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-osx/commit/6d835bf3 Tree: http://git-wip-us.apache.org/repos/asf/cordova-osx/tree/6d835bf3 Diff: http://git-wip-us.apache.org/repos/asf/cordova-osx/diff/6d835bf3 Branch: refs/heads/master Commit: 6d835bf33757635ef69423a8a1c5f751f2321892 Parents: e648de6 Author: Tobias Bocanegra <[email protected]> Authored: Thu Jan 7 17:38:55 2016 -0800 Committer: Tobias Bocanegra <[email protected]> Committed: Thu Jan 7 17:38:55 2016 -0800 ---------------------------------------------------------------------- tests/CordovaLibTests/CDVBase64Tests.m | 12 ++---- tests/CordovaLibTests/CDVStartPageTests.m | 9 ++-- tests/CordovaLibTests/CDVWebViewTest.m | 43 ++++++++------------ .../CordovaLibTests.xcodeproj/project.pbxproj | 4 ++ 4 files changed, 27 insertions(+), 41 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6d835bf3/tests/CordovaLibTests/CDVBase64Tests.m ---------------------------------------------------------------------- diff --git a/tests/CordovaLibTests/CDVBase64Tests.m b/tests/CordovaLibTests/CDVBase64Tests.m index 0d44c2a..69bf256 100644 --- a/tests/CordovaLibTests/CDVBase64Tests.m +++ b/tests/CordovaLibTests/CDVBase64Tests.m @@ -26,22 +26,19 @@ @implementation CDVBase64Tests -- (void)setUp -{ +- (void) setUp { [super setUp]; // setup code here } -- (void)tearDown -{ +- (void) tearDown { // Tear-down code here. [super tearDown]; } -- (void)testBase64Encode -{ +- (void) testBase64Encode { NSString* decodedString = @"abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&"; NSData* decodedData = [decodedString dataUsingEncoding:NSUTF8StringEncoding]; @@ -51,8 +48,7 @@ XCTAssertTrue([expectedEncodedString isEqualToString:actualEncodedString]); } -- (void)testBase64Decode -{ +- (void) testBase64Decode { NSString* encodedString = @"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY3ODkwIUAjJCVeJg=="; NSString* decodedString = @"abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&"; NSData* encodedData = [decodedString dataUsingEncoding:NSUTF8StringEncoding]; http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6d835bf3/tests/CordovaLibTests/CDVStartPageTests.m ---------------------------------------------------------------------- diff --git a/tests/CordovaLibTests/CDVStartPageTests.m b/tests/CordovaLibTests/CDVStartPageTests.m index 1e0c7b1..4eec690 100644 --- a/tests/CordovaLibTests/CDVStartPageTests.m +++ b/tests/CordovaLibTests/CDVStartPageTests.m @@ -27,18 +27,15 @@ @implementation CDVStartPageTest -- (void)setUp -{ +- (void) setUp { [super setUp]; } -- (void)tearDown -{ +- (void) tearDown { [super tearDown]; } -- (void)testDefaultStartPage -{ +- (void) testDefaultStartPage { [self viewController]; NSString* geHREF = @"window.location.href"; NSString* href = [self.webView stringByEvaluatingJavaScriptFromString:geHREF]; http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6d835bf3/tests/CordovaLibTests/CDVWebViewTest.m ---------------------------------------------------------------------- diff --git a/tests/CordovaLibTests/CDVWebViewTest.m b/tests/CordovaLibTests/CDVWebViewTest.m index 9545853..9d4e794 100644 --- a/tests/CordovaLibTests/CDVWebViewTest.m +++ b/tests/CordovaLibTests/CDVWebViewTest.m @@ -20,42 +20,37 @@ #import "CDVWebViewTest.h" #import "AppDelegate.h" -#import "MainViewController.h" @interface CDVWebViewTest () // Runs the run loop until the webview has finished loading. -- (void)waitForPageLoad; +- (void) waitForPageLoad; @end @implementation CDVWebViewTest @synthesize startPage; -- (void)setUp -{ +- (void) setUp { [super setUp]; } -- (void)tearDown -{ +- (void) tearDown { // Enforce that the view controller is released between tests to ensure // tests don't affect each other. -// [self.appDelegate destroyViewController]; + // [self.appDelegate destroyViewController]; [super tearDown]; } -- (AppDelegate*)appDelegate -{ +- (AppDelegate*) appDelegate { return [[NSApplication sharedApplication] delegate]; } -- (CDVViewController*)viewController -{ +- (CDVViewController*) viewController { // Lazily create the view controller so that tests that do not require it // are not slowed down by it. if (self.appDelegate.viewController == nil) { - - [self.appDelegate createViewController: self.startPage]; + + [self.appDelegate createViewController:self.startPage]; // Things break if tearDown is called before the page has finished // loading (a JS error happens and an alert pops up), so enforce a wait @@ -67,27 +62,23 @@ return self.appDelegate.viewController; } -- (WebView*)webView -{ +- (WebView*) webView { return self.viewController.webView; } -- (id)pluginInstance:(NSString*)pluginName -{ +- (id) pluginInstance:(NSString*) pluginName { id ret = [self.viewController getCommandInstance:pluginName]; XCTAssertNotNil(ret, @"Missing plugin %@", pluginName); return ret; } -- (void)reloadWebView -{ +- (void) reloadWebView { [self.appDelegate destroyViewController]; [self viewController]; } -- (void)waitForConditionName:(NSString*)conditionName block:(BOOL (^)())block -{ +- (void) waitForConditionName:(NSString*) conditionName block:(BOOL (^)()) block { // Number of seconds to wait for a condition to become true before giving up. const NSTimeInterval kConditionTimeout = 5.0; // Useful when debugging so that it does not timeout after one loop. @@ -100,20 +91,18 @@ [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; NSTimeInterval elapsed = -[startTime timeIntervalSinceNow]; XCTAssertTrue(i < kMinIterations || elapsed < kConditionTimeout, - @"Timed out waiting for condition %@", conditionName); + @"Timed out waiting for condition %@", conditionName); ++i; } } -- (void)waitForPageLoad -{ +- (void) waitForPageLoad { [self waitForConditionName:@"PageLoad" block:^{ - return [@"true" isEqualToString :[self evalJs:@"window.pageIsLoaded"]]; + return [@"true" isEqualToString:[self evalJs:@"window.pageIsLoaded"]]; }]; } -- (NSString*)evalJs:(NSString*)code -{ +- (NSString*) evalJs:(NSString*) code { return [self.webView stringByEvaluatingJavaScriptFromString:code]; } http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6d835bf3/tests/CordovaLibTests/CordovaLibTests.xcodeproj/project.pbxproj ---------------------------------------------------------------------- diff --git a/tests/CordovaLibTests/CordovaLibTests.xcodeproj/project.pbxproj b/tests/CordovaLibTests/CordovaLibTests.xcodeproj/project.pbxproj index 067d7c2..c8fcdfd 100644 --- a/tests/CordovaLibTests/CordovaLibTests.xcodeproj/project.pbxproj +++ b/tests/CordovaLibTests/CordovaLibTests.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ 70DAA9221908E80C00AF3749 /* www in Resources */ = {isa = PBXBuildFile; fileRef = 70DAA9201908E80C00AF3749 /* www */; }; 70DAA9231908E80C00AF3749 /* config.xml in Resources */ = {isa = PBXBuildFile; fileRef = 70DAA9211908E80C00AF3749 /* config.xml */; }; 70DAA9251908E82600AF3749 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 70DAA9241908E82600AF3749 /* WebKit.framework */; }; + CC6A0B56B7165F2929A4F2EF /* CDVBridgeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC6A07C34FC25839C2500136 /* CDVBridgeTests.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -69,6 +70,7 @@ 70DAA9241908E82600AF3749 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 70DAA9271908E93500AF3749 /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = "<group>"; }; 70DAA9281908E93500AF3749 /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = "<group>"; }; + CC6A07C34FC25839C2500136 /* CDVBridgeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVBridgeTests.m; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -150,6 +152,7 @@ 70718D7F190A4201002ADC5F /* CDVBase64Tests.m */, 70DAA8E61908E05900AF3749 /* CDVStartPageTests.m */, 70BD675518FF9DAE00A1EFCF /* Supporting Files */, + CC6A07C34FC25839C2500136 /* CDVBridgeTests.m */, ); name = CordovaLibTests; sourceTree = "<group>"; @@ -334,6 +337,7 @@ 70DAA8EA1908E07E00AF3749 /* CDVWebViewTest.m in Sources */, 70718D80190A4201002ADC5F /* CDVBase64Tests.m in Sources */, 70DAA8E71908E05900AF3749 /* CDVStartPageTests.m in Sources */, + CC6A0B56B7165F2929A4F2EF /* CDVBridgeTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
