You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by tr...@apache.org on 2016/01/08 22:03:22 UTC
[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 <tr...@adobe.com>
Authored: Fri Jan 8 13:02:41 2016 -0800
Committer: Tobias Bocanegra <tr...@adobe.com>
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 <XCTest/XCTest.h>
+#import <Cordova/CDVViewController.h>
+#import <Cordova/CDVBridge.h>
+
+#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 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
-#
-# 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.
-#
--->
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment version="1070" identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9059"/>
- <plugIn identifier="com.apple.WebKitIBPlugin" version="9059"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
+ <plugIn identifier="com.apple.WebKitIBPlugin" version="9531"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MainViewController" colorLabel="IBBuiltInLabel-Green">
@@ -38,8 +18,8 @@
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<menu title="AMainMenu" systemMenu="main" id="29">
<items>
- <menuItem id="56">
- <menu key="submenu" systemMenu="apple" id="57">
+ <menuItem title="TestApp" id="56">
+ <menu key="submenu" title="TestApp" systemMenu="apple" id="57">
<items>
<menuItem title="About TestApp" id="58">
<modifierMask key="keyEquivalentModifierMask"/>
@@ -73,51 +53,236 @@
<action selector="unhideAllApplications:" target="-1" id="370"/>
</connections>
</menuItem>
+ <menuItem title="Toggle Full Screen" keyEquivalent="f" id="afF-KY-ioe">
+ <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
+ </menuItem>
<menuItem isSeparatorItem="YES" id="149">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
- <menuItem title="Quit TestApp" keyEquivalent="q" id="136"/>
+ <menuItem title="Quit TestApp" keyEquivalent="q" id="136">
+ <connections>
+ <action selector="terminate:" target="-3" id="449"/>
+ </connections>
+ </menuItem>
</items>
</menu>
</menuItem>
- <menuItem title="File" id="83"/>
- <menuItem title="Edit" id="217"/>
- <menuItem title="Format" id="375">
+ <menuItem title="Edit" id="Cuj-Ku-KLH">
<modifierMask key="keyEquivalentModifierMask"/>
- </menuItem>
- <menuItem title="View" id="295">
- <menu key="submenu" title="View" id="296">
+ <menu key="submenu" title="Edit" id="aEw-si-bZ9">
<items>
- <menuItem title="Enter Full Screen" keyEquivalent="f" id="afF-KY-ioe">
- <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
+ <menuItem title="Undo" keyEquivalent="z" id="bB3-m1-G67">
<connections>
- <action selector="toggleFullScreen:" target="-1" id="dWi-nX-EnS"/>
+ <action selector="undo:" target="-1" id="znz-M6-CkT"/>
</connections>
</menuItem>
- </items>
- </menu>
- </menuItem>
- <menuItem title="Window" id="19">
- <menu key="submenu" title="Window" systemMenu="window" id="24">
- <items>
- <menuItem title="Minimize" keyEquivalent="m" id="23">
+ <menuItem title="Redo" keyEquivalent="Z" id="wv2-7m-lNq">
<connections>
- <action selector="performMiniaturize:" target="-1" id="37"/>
+ <action selector="redo:" target="-1" id="lfa-be-sS1"/>
</connections>
</menuItem>
- <menuItem title="Zoom" id="239">
+ <menuItem isSeparatorItem="YES" id="CrU-Rp-WKj"/>
+ <menuItem title="Cut" keyEquivalent="x" id="EtL-Um-pdt">
<connections>
- <action selector="performZoom:" target="-1" id="240"/>
+ <action selector="cut:" target="-1" id="cGO-aw-OhN"/>
</connections>
</menuItem>
- <menuItem isSeparatorItem="YES" id="92">
- <modifierMask key="keyEquivalentModifierMask" command="YES"/>
+ <menuItem title="Copy" keyEquivalent="c" id="n2b-BO-njU">
+ <connections>
+ <action selector="copy:" target="-1" id="gry-3c-FAx"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste" keyEquivalent="v" id="NCl-e3-Ejz">
+ <connections>
+ <action selector="paste:" target="-1" id="P8B-UN-Hwq"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste and Match Style" keyEquivalent="V" id="a4e-ee-vMC">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="pasteAsPlainText:" target="-1" id="aFc-9V-tTX"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Delete" id="bcC-VI-ovZ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="delete:" target="-1" id="dv6-oe-nwz"/>
+ </connections>
</menuItem>
- <menuItem title="Bring All to Front" id="5">
+ <menuItem title="Select All" keyEquivalent="a" id="822-bT-wlP">
<connections>
- <action selector="arrangeInFront:" target="-1" id="39"/>
+ <action selector="selectAll:" target="-1" id="gex-Uh-Fli"/>
</connections>
</menuItem>
+ <menuItem isSeparatorItem="YES" id="fH0-1W-fPd"/>
+ <menuItem title="Find" id="7n5-Yr-uah">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Find" id="UVj-b8-djq">
+ <items>
+ <menuItem title="Find…" tag="1" keyEquivalent="f" id="0pm-2d-Aar">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="2ge-rY-LzS"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="F4Q-Wd-hfe">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="mfF-NY-gdP"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find Next" tag="2" keyEquivalent="g" id="MF3-8t-C7d">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="l2X-lX-hyR"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find Previous" tag="3" keyEquivalent="G" id="FlS-Gx-2Wc">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="1z6-BI-KBP"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="EPv-RF-ZHp">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="T4N-ua-7c2"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Jump to Selection" keyEquivalent="j" id="Ri1-YX-Dz8">
+ <connections>
+ <action selector="centerSelectionInVisibleArea:" target="-1" id="Yn6-aI-S3j"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Spelling and Grammar" id="BgM-Ms-5J2">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Spelling" id="60l-vO-2zb">
+ <items>
+ <menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="AN8-pG-Ptf">
+ <connections>
+ <action selector="showGuessPanel:" target="-1" id="geY-R6-rUC"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Check Document Now" keyEquivalent=";" id="oPa-7c-I96">
+ <connections>
+ <action selector="checkSpelling:" target="-1" id="WJQ-nA-Rvb"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="bfz-nN-j90"/>
+ <menuItem title="Check Spelling While Typing" id="0Wy-D4-XaJ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleContinuousSpellChecking:" target="-1" id="2N0-UK-06d"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Check Grammar With Spelling" id="dA4-H5-vVU">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleGrammarChecking:" target="-1" id="ga8-cr-QmC"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Correct Spelling Automatically" id="Ros-zX-cEU">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticSpellingCorrection:" target="-1" id="uqH-je-de3"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Substitutions" id="Ngf-kj-yxK">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Substitutions" id="hPM-Ux-zKP">
+ <items>
+ <menuItem title="Show Substitutions" id="0H3-11-5mY">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="orderFrontSubstitutionsPanel:" target="-1" id="CdD-qb-Wao"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="ZY3-Us-DI9"/>
+ <menuItem title="Smart Copy/Paste" id="ypU-Ea-iLy">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleSmartInsertDelete:" target="-1" id="PpH-yZ-pgh"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Quotes" id="7DR-cp-gbl">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="KCO-nz-Fao"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Dashes" id="6gP-Sf-4TY">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticDashSubstitution:" target="-1" id="j2x-wG-aqR"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Links" id="Xdk-2x-JzT">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticLinkDetection:" target="-1" id="XeE-Jv-WBv"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Data Detectors" id="FwE-Os-MnT">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticDataDetection:" target="-1" id="tA2-b2-JNs"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Text Replacement" id="2H8-M8-0cG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticTextReplacement:" target="-1" id="HbF-Gg-f1g"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Transformations" id="UdY-bt-AKN">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Transformations" id="Le4-lf-pgk">
+ <items>
+ <menuItem title="Make Upper Case" id="qjj-HZ-sCC">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="uppercaseWord:" target="-1" id="Eja-id-YLw"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Make Lower Case" id="Emh-IJ-XmZ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="lowercaseWord:" target="-1" id="5Ob-bE-p86"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Capitalize" id="DbO-Kj-Pnz">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="capitalizeWord:" target="-1" id="8RI-vC-rTp"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Speech" id="iLO-pw-EuL">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Speech" id="WxN-wz-q1m">
+ <items>
+ <menuItem title="Start Speaking" id="zpf-RK-6FX">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="startSpeaking:" target="-1" id="fhT-5j-rzo"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Stop Speaking" id="O3I-Jg-vq1">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="stopSpeaking:" target="-1" id="pEy-44-ctT"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
</items>
</menu>
</menuItem>
@@ -135,11 +300,11 @@
</menuItem>
</items>
</menu>
- <window title="TestApp" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="371">
+ <window title="TestApp" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="371" customClass="CDVMainWindow">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowCollectionBehavior key="collectionBehavior" fullScreenPrimary="YES"/>
<rect key="contentRect" x="335" y="299" width="640" height="480"/>
- <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<value key="minSize" type="size" width="640" height="480"/>
<view key="contentView" horizontalHuggingPriority="1000" verticalHuggingPriority="1000" horizontalCompressionResistancePriority="1" verticalCompressionResistancePriority="1" id="372" userLabel="Content View">
<rect key="frame" x="0.0" y="0.0" width="640" height="480"/>
@@ -147,7 +312,6 @@
<subviews>
<webView horizontalHuggingPriority="1" verticalHuggingPriority="1" horizontalCompressionResistancePriority="1" verticalCompressionResistancePriority="1" translatesAutoresizingMaskIntoConstraints="NO" id="536">
<rect key="frame" x="0.0" y="0.0" width="640" height="480"/>
- <animations/>
<webPreferences key="preferences" defaultFontSize="12" defaultFixedFontSize="12" plugInsEnabled="NO" javaEnabled="NO">
<nil key="identifier"/>
</webPreferences>
@@ -165,7 +329,6 @@
<constraint firstItem="536" firstAttribute="leading" secondItem="372" secondAttribute="leading" id="726"/>
<constraint firstItem="536" firstAttribute="top" secondItem="372" secondAttribute="top" id="727"/>
</constraints>
- <animations/>
</view>
<connections>
<outlet property="delegate" destination="-2" id="743"/>
@@ -177,6 +340,10 @@
</connections>
</customObject>
<customObject id="420" customClass="NSFontManager"/>
- <customObject id="739" customClass="CDVWebViewDelegate"/>
+ <customObject id="739" customClass="CDVWebViewDelegate">
+ <connections>
+ <outlet property="viewController" destination="-2" id="hHb-52-h7U"/>
+ </connections>
+ </customObject>
</objects>
</document>
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 @@
</author>
<content src="index.html"/>
<access origin="*"/>
+ <feature name="TestPlugin">
+ <param name="ios-package" value="TestPlugin" />
+ </feature>
</widget>
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 @@
<meta charset="utf-8">
- <!-- iPad/iPhone specific css below, add after your main css >
- <link rel="stylesheet" media="only screen and (max-device-width: 1024px)" href="ipad.css" type="text/css" />
- <link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="iphone.css" type="text/css" />
- -->
- <!-- If your application is targeting iOS BEFORE 4.0 you MUST put json2.js from http://www.JSON.org/json2.js into your www directory and include it here -->
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
+ <script type="text/javascript" charset="utf-8" src="tests.js"></script>
<script type="text/javascript">
-
- // If you want to prevent dragging, uncomment this section
- /*
- function preventBehavior(e)
- {
- e.preventDefault();
- };
- document.addEventListener("touchmove", preventBehavior, false);
- */
-
- /* If you are supporting your own protocol, the var invokeString will contain any arguments to the app launch.
- see http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
- for more details -jm */
- /*
- function handleOpenURL(url)
- {
- // TODO: do something with the url passed in.
- }
- */
-
function onBodyLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
- /* When this function is called, Cordova has been initialized and is ready to roll */
- /* If you are supporting your own protocol, the var invokeString will contain any arguments to the app launch.
- see http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
- for more details -jm */
function onDeviceReady() {
// Used by unit tests to tell when the page is loaded.
window.pageIsLoaded = true;
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6370c1e1/tests/CordovaLibTests/CordovaLibApp/www/plugins/test-plugin.js
----------------------------------------------------------------------
diff --git a/tests/CordovaLibTests/CordovaLibApp/www/plugins/test-plugin.js b/tests/CordovaLibTests/CordovaLibApp/www/plugins/test-plugin.js
new file mode 100644
index 0000000..16827f7
--- /dev/null
+++ b/tests/CordovaLibTests/CordovaLibApp/www/plugins/test-plugin.js
@@ -0,0 +1,41 @@
+/*
+ *
+ * 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-osx-test.specs', function(require, exports, module) {
+
+ var argscheck = require('cordova/argscheck'),
+ channel = require('cordova/channel'),
+ utils = require('cordova/utils'),
+ exec = require('cordova/exec'),
+ cordova = require('cordova');
+
+ function Specs() {
+
+ console.log('hello test');
+ }
+
+ Specs.prototype.echo = function(successCallback, errorCallback, obj) {
+ exec(successCallback, errorCallback, 'TestPlugin', 'echo', [obj]);
+ };
+
+ module.exports = new Specs();
+
+});
+
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6370c1e1/tests/CordovaLibTests/CordovaLibApp/www/tests.js
----------------------------------------------------------------------
diff --git a/tests/CordovaLibTests/CordovaLibApp/www/tests.js b/tests/CordovaLibTests/CordovaLibApp/www/tests.js
new file mode 100644
index 0000000..2f65b7b
--- /dev/null
+++ b/tests/CordovaLibTests/CordovaLibApp/www/tests.js
@@ -0,0 +1,97 @@
+/*
+ * 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.
+ */
+
+
+function echoTests() {
+ var payloads = {
+ 'string': "Hello, World",
+ 'empty-string': "",
+ 'one': 1,
+ 'zero': 0,
+ 'true': true,
+ 'false': false,
+ 'double': 3.141,
+ 'array': ['a','b','c'],
+ 'nested-array': ['a','b','c', [1,2,3]],
+ 'object': {a:'a', b:'b'}
+ // 'nested-object': {a:'a', b:'b', c:{d:'d'}} (does not work yet, CB-10308)
+ };
+
+ var tests = [];
+ var numCompleted = 0;
+ var numFailed = 0;
+ function completed() {
+ numCompleted++;
+ if (numCompleted === tests.length) {
+ window.jsTests.echo.result = numFailed === 0;
+ }
+ }
+
+ var Test = function(name, payload) {
+ this.payload = payload;
+ this.name = name;
+ this.result = '';
+ };
+ var _success = function(ret) {
+ var result = JSON.stringify(ret);
+ var expected = JSON.stringify(this.payload);
+ if (result === expected) {
+ console.log('success of ' + this.name);
+ this.result = true;
+ } else {
+ console.log(this.name + ' failed. Expected ' + expected +' but got ' + result);
+ this.result = false;
+ numFailed++;
+ }
+ completed();
+ };
+
+ var _failure = function(e) {
+ console.log('failure of ' + this.name);
+ this.result = false;
+ numFailed++;
+ completed();
+ };
+
+ Test.prototype.run = function() {
+ plugins.Test.echo(_success.bind(this), _failure.bind(this), this.payload);
+ };
+
+
+ for (var name in payloads) {
+ var test = new Test(name, payloads[name]);
+ tests.push(test);
+ test.run();
+ }
+}
+
+function runTests() {
+
+ console.log('running tests...');
+ echoTests();
+ return 'echo';
+
+}
+
+window.jsTests = {
+
+ echo: {
+ result: ''
+ }
+};
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6370c1e1/tests/CordovaLibTests/CordovaLibTests.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/tests/CordovaLibTests/CordovaLibTests.xcodeproj/project.pbxproj b/tests/CordovaLibTests/CordovaLibTests.xcodeproj/project.pbxproj
index c8fcdfd..1e62650 100644
--- a/tests/CordovaLibTests/CordovaLibTests.xcodeproj/project.pbxproj
+++ b/tests/CordovaLibTests/CordovaLibTests.xcodeproj/project.pbxproj
@@ -22,7 +22,8 @@
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 */; };
+ CC6A0B0363F2D72B476E94F2 /* TestPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = CC6A04A9E370B440AFF78213 /* TestPlugin.m */; };
+ CC6A0B56B7165F2929A4F2EF /* CDVPluginsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC6A07C34FC25839C2500136 /* CDVPluginsTests.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -70,7 +71,9 @@
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>"; };
+ CC6A04A9E370B440AFF78213 /* TestPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestPlugin.m; sourceTree = "<group>"; };
+ CC6A07C34FC25839C2500136 /* CDVPluginsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVPluginsTests.m; sourceTree = "<group>"; };
+ CC6A0D7BC56F51517A3FADE7 /* TestPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestPlugin.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -147,12 +150,14 @@
70BD675418FF9DAE00A1EFCF /* CordovaLibTests */ = {
isa = PBXGroup;
children = (
+ 70BD675518FF9DAE00A1EFCF /* Supporting Files */,
70DAA8E81908E07E00AF3749 /* CDVWebViewTest.h */,
70DAA8E91908E07E00AF3749 /* CDVWebViewTest.m */,
70718D7F190A4201002ADC5F /* CDVBase64Tests.m */,
70DAA8E61908E05900AF3749 /* CDVStartPageTests.m */,
- 70BD675518FF9DAE00A1EFCF /* Supporting Files */,
- CC6A07C34FC25839C2500136 /* CDVBridgeTests.m */,
+ CC6A07C34FC25839C2500136 /* CDVPluginsTests.m */,
+ CC6A0D7BC56F51517A3FADE7 /* TestPlugin.h */,
+ CC6A04A9E370B440AFF78213 /* TestPlugin.m */,
);
name = CordovaLibTests;
sourceTree = "<group>";
@@ -337,7 +342,8 @@
70DAA8EA1908E07E00AF3749 /* CDVWebViewTest.m in Sources */,
70718D80190A4201002ADC5F /* CDVBase64Tests.m in Sources */,
70DAA8E71908E05900AF3749 /* CDVStartPageTests.m in Sources */,
- CC6A0B56B7165F2929A4F2EF /* CDVBridgeTests.m in Sources */,
+ CC6A0B56B7165F2929A4F2EF /* CDVPluginsTests.m in Sources */,
+ CC6A0B0363F2D72B476E94F2 /* TestPlugin.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6370c1e1/tests/CordovaLibTests/TestPlugin.h
----------------------------------------------------------------------
diff --git a/tests/CordovaLibTests/TestPlugin.h b/tests/CordovaLibTests/TestPlugin.h
new file mode 100644
index 0000000..3e1e5ba
--- /dev/null
+++ b/tests/CordovaLibTests/TestPlugin.h
@@ -0,0 +1,27 @@
+/*
+ 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 <Foundation/Foundation.h>
+#import <Cordova/CDVPlugin.h>
+
+@interface TestPlugin : CDVPlugin
+
+- (void) echo:(CDVInvokedUrlCommand*)command __unused;
+
+@end
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/6370c1e1/tests/CordovaLibTests/TestPlugin.m
----------------------------------------------------------------------
diff --git a/tests/CordovaLibTests/TestPlugin.m b/tests/CordovaLibTests/TestPlugin.m
new file mode 100644
index 0000000..51acac6
--- /dev/null
+++ b/tests/CordovaLibTests/TestPlugin.m
@@ -0,0 +1,47 @@
+/*
+ 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 "TestPlugin.h"
+
+@implementation TestPlugin {
+
+}
+
+- (void) pluginInitialize {
+ [super pluginInitialize];
+ NSLog(@"test plugin initialized.");
+ return;
+}
+
+- (void) echo:(CDVInvokedUrlCommand*) command {
+ id arg0 = [command argumentAtIndex:0];
+ NSLog(@"TestPlugin.echo(%@)", arg0);
+
+// CDVPluginResult* pluginResult;
+// if ([arg0 isKindOfClass:[NSString class]]) {
+// pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:arg0];
+// }
+//
+//
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:arg0];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+}
+
+
+@end
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org