Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9083E18713 for ; Fri, 8 Jan 2016 21:03:21 +0000 (UTC) Received: (qmail 67325 invoked by uid 500); 8 Jan 2016 21:03:21 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 67296 invoked by uid 500); 8 Jan 2016 21:03:21 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 67286 invoked by uid 99); 8 Jan 2016 21:03:21 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jan 2016 21:03:21 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0926FE050C; Fri, 8 Jan 2016 21:03:21 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: tripod@apache.org To: commits@cordova.apache.org Date: Fri, 08 Jan 2016 21:03:22 -0000 Message-Id: In-Reply-To: <740dac5e0cc144c88250cb6700fbbc18@git.apache.org> References: <740dac5e0cc144c88250cb6700fbbc18@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/2] mac commit: CB-10308 Unable to parse multi dimensional arrays with more than 2 levels CB-10308 Unable to parse multi dimensional arrays with more than 2 levels - adding tests Project: http://git-wip-us.apache.org/repos/asf/cordova-osx/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-osx/commit/6370c1e1 Tree: http://git-wip-us.apache.org/repos/asf/cordova-osx/tree/6370c1e1 Diff: http://git-wip-us.apache.org/repos/asf/cordova-osx/diff/6370c1e1 Branch: refs/heads/master Commit: 6370c1e13b98f0a7d91e3b8ba6fed3bb72f334c6 Parents: 6d835bf Author: Tobias Bocanegra Authored: Fri Jan 8 13:02:41 2016 -0800 Committer: Tobias Bocanegra Committed: Fri Jan 8 13:02:41 2016 -0800 ---------------------------------------------------------------------- tests/CordovaLibTests/CDVPluginsTests.m | 56 ++++ tests/CordovaLibTests/CDVStartPageTests.m | 12 - tests/CordovaLibTests/CDVWebViewTest.h | 2 + tests/CordovaLibTests/CDVWebViewTest.m | 9 +- .../CordovaLibTests/CordovaLibApp/AppDelegate.m | 4 +- .../CordovaLibApp/MainViewController.xib | 275 +++++++++++++++---- tests/CordovaLibTests/CordovaLibApp/config.xml | 3 + .../CordovaLibApp/www/cordova_plugins.js | 34 +++ .../CordovaLibApp/www/index.html | 34 +-- .../CordovaLibApp/www/plugins/test-plugin.js | 41 +++ .../CordovaLibTests/CordovaLibApp/www/tests.js | 97 +++++++ .../CordovaLibTests.xcodeproj/project.pbxproj | 16 +- tests/CordovaLibTests/TestPlugin.h | 27 ++ tests/CordovaLibTests/TestPlugin.m | 47 ++++ 14 files changed, 549 insertions(+), 108 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6370c1e1/tests/CordovaLibTests/CDVPluginsTests.m ---------------------------------------------------------------------- diff --git a/tests/CordovaLibTests/CDVPluginsTests.m b/tests/CordovaLibTests/CDVPluginsTests.m new file mode 100644 index 0000000..1fcf814 --- /dev/null +++ b/tests/CordovaLibTests/CDVPluginsTests.m @@ -0,0 +1,56 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +#import +#import +#import + +#import "CDVWebViewTest.h" + +@interface CDVPluginsTest : CDVWebViewTest +@end + +@implementation CDVPluginsTest + +- (void) setUp { + [super setUp]; +} + +- (void) tearDown { + [super tearDown]; +} + +- (void) testEcho { + [self viewController]; + + NSString* testId = [self.webView stringByEvaluatingJavaScriptFromString:@"runTests()"]; + + NSLog(@"waiting for test %@", testId); + NSString *jsString = [NSString stringWithFormat:@"window.jsTests['%@'].result", testId]; + + __block NSString *result; + [self waitForConditionName:testId block:^{ + result = [self evalJs:jsString]; + return (BOOL) (result.length > 0); + }]; + XCTAssertTrue([result isEqualToString:@"true"], @"test should succeed"); +} + + +@end http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6370c1e1/tests/CordovaLibTests/CDVStartPageTests.m ---------------------------------------------------------------------- diff --git a/tests/CordovaLibTests/CDVStartPageTests.m b/tests/CordovaLibTests/CDVStartPageTests.m index 4eec690..77dea9e 100644 --- a/tests/CordovaLibTests/CDVStartPageTests.m +++ b/tests/CordovaLibTests/CDVStartPageTests.m @@ -42,16 +42,4 @@ XCTAssertTrue([href hasSuffix:@"index.html"], @"href should point to index.html"); } - -// currently fails - -//- (void)testParametersInStartPage -//{ -// self.startPage = @"index.html?delta=true"; -// [self reloadWebView]; -// NSString* geHREF = @"window.location.href"; -// NSString* href = [self.webView stringByEvaluatingJavaScriptFromString:geHREF]; -// STAssertTrue([href hasSuffix:@"index.html?delta=true"], @"href should point to index.html?delta=true"); -//} - @end http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6370c1e1/tests/CordovaLibTests/CDVWebViewTest.h ---------------------------------------------------------------------- diff --git a/tests/CordovaLibTests/CDVWebViewTest.h b/tests/CordovaLibTests/CDVWebViewTest.h index 3d03428..0f4c622 100644 --- a/tests/CordovaLibTests/CDVWebViewTest.h +++ b/tests/CordovaLibTests/CDVWebViewTest.h @@ -38,6 +38,8 @@ // Runs the run loop until the given block returns true, or until a timeout // occurs. - (void)waitForConditionName:(NSString*)conditionName block:(BOOL (^)())block; +- (void) waitForPageLoad; + // Convenience function for stringByEvaluatingJavaScriptFromString. - (NSString*)evalJs:(NSString*)code; @end http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6370c1e1/tests/CordovaLibTests/CDVWebViewTest.m ---------------------------------------------------------------------- diff --git a/tests/CordovaLibTests/CDVWebViewTest.m b/tests/CordovaLibTests/CDVWebViewTest.m index 9d4e794..3e26993 100644 --- a/tests/CordovaLibTests/CDVWebViewTest.m +++ b/tests/CordovaLibTests/CDVWebViewTest.m @@ -53,8 +53,7 @@ [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 - // here. + // loading (a JS error happens and an alert pops up), so enforce a wait here [self waitForPageLoad]; } @@ -90,8 +89,10 @@ while (!block()) { [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; NSTimeInterval elapsed = -[startTime timeIntervalSinceNow]; - XCTAssertTrue(i < kMinIterations || elapsed < kConditionTimeout, - @"Timed out waiting for condition %@", conditionName); + if (i > kMinIterations && elapsed > kConditionTimeout) { + XCTFail(@"Timed out waiting for condition %@", conditionName); + break; + } ++i; } } http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6370c1e1/tests/CordovaLibTests/CordovaLibApp/AppDelegate.m ---------------------------------------------------------------------- diff --git a/tests/CordovaLibTests/CordovaLibApp/AppDelegate.m b/tests/CordovaLibTests/CordovaLibApp/AppDelegate.m index d818e2b..2f9336d 100644 --- a/tests/CordovaLibTests/CordovaLibApp/AppDelegate.m +++ b/tests/CordovaLibTests/CordovaLibApp/AppDelegate.m @@ -6,9 +6,9 @@ to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6370c1e1/tests/CordovaLibTests/CordovaLibApp/MainViewController.xib ---------------------------------------------------------------------- diff --git a/tests/CordovaLibTests/CordovaLibApp/MainViewController.xib b/tests/CordovaLibTests/CordovaLibApp/MainViewController.xib index c9f3cea..9917551 100644 --- a/tests/CordovaLibTests/CordovaLibApp/MainViewController.xib +++ b/tests/CordovaLibTests/CordovaLibApp/MainViewController.xib @@ -1,29 +1,9 @@ - - + - - + + @@ -38,8 +18,8 @@ - - + + @@ -73,51 +53,236 @@ + + + - + + + + + - - - + - - - + - - + - + - - - - - - - + - + - + + - + - - + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -135,11 +300,11 @@ - + - + @@ -147,7 +312,6 @@ - @@ -165,7 +329,6 @@ - @@ -177,6 +340,10 @@ - + + + + + http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6370c1e1/tests/CordovaLibTests/CordovaLibApp/config.xml ---------------------------------------------------------------------- diff --git a/tests/CordovaLibTests/CordovaLibApp/config.xml b/tests/CordovaLibTests/CordovaLibApp/config.xml index aca923b..8bc1431 100644 --- a/tests/CordovaLibTests/CordovaLibApp/config.xml +++ b/tests/CordovaLibTests/CordovaLibApp/config.xml @@ -45,4 +45,7 @@ + + + http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6370c1e1/tests/CordovaLibTests/CordovaLibApp/www/cordova_plugins.js ---------------------------------------------------------------------- diff --git a/tests/CordovaLibTests/CordovaLibApp/www/cordova_plugins.js b/tests/CordovaLibTests/CordovaLibApp/www/cordova_plugins.js new file mode 100644 index 0000000..dc4f44b --- /dev/null +++ b/tests/CordovaLibTests/CordovaLibApp/www/cordova_plugins.js @@ -0,0 +1,34 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +cordova.define('cordova/plugin_list', function (require, exports, module) { + module.exports = [{ + 'file': 'plugins/test-plugin.js', + 'id': 'cordova-plugin-osx-test.specs', + 'pluginId': 'cordova-plugin-osx-test', + 'clobbers': [ + 'plugins.Test' + ] + } + ]; + module.exports.metadata = { + 'cordova-plugin-osx-test': '1.0.0' + } +}); http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6370c1e1/tests/CordovaLibTests/CordovaLibApp/www/index.html ---------------------------------------------------------------------- diff --git a/tests/CordovaLibTests/CordovaLibApp/www/index.html b/tests/CordovaLibTests/CordovaLibApp/www/index.html index 715cc45..e51c14f 100644 --- a/tests/CordovaLibTests/CordovaLibApp/www/index.html +++ b/tests/CordovaLibTests/CordovaLibApp/www/index.html @@ -9,9 +9,9 @@ # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -27,42 +27,14 @@ - - +