Repository: cordova-osx
Updated Branches:
  refs/heads/master 22cba9ef2 -> 8ac659c72


http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/8ac659c7/tests/cdv-test-project/plugins/cordova-plugin-whitelist/doc/zh/README.md
----------------------------------------------------------------------
diff --git 
a/tests/cdv-test-project/plugins/cordova-plugin-whitelist/doc/zh/README.md 
b/tests/cdv-test-project/plugins/cordova-plugin-whitelist/doc/zh/README.md
new file mode 100644
index 0000000..c2c7e11
--- /dev/null
+++ b/tests/cdv-test-project/plugins/cordova-plugin-whitelist/doc/zh/README.md
@@ -0,0 +1,148 @@
+<!--
+# license: 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-plugin-whitelist
+
+這個外掛程式實現一個用於導航在科爾多瓦 4.0 應用程式 web 
視圖的白名單策略
+
+## 支援的科爾多瓦平臺
+
+  * Android 4.0.0 或以上
+  * iOS 4.0.0 或以上
+
+## 導航白名單
+
+控制 web 視圖本身可以導航到的 Url。適用于頂級導航只。
+
+怪癖: 在 Android 上它也適用于 iframe 的非-結計畫。
+
+預設情況下,只有到`file://` Url 導航允許。若要允許其他å…
¶ä»– Url,必須將`<allow-navigation>`標籤添加到您的`config.xml`:
+
+    <!-- Allow links to example.com -->
+    <allow-navigation href="http://example.com/*"; />
+    
+    <!-- Wildcards are allowed for the protocol, as a prefix
+         to the host, or as a suffix to the path -->
+    <allow-navigation href="*://*.example.com/*" />
+    
+    <!-- A wildcard can be used to whitelist the entire network,
+         over HTTP and HTTPS.
+         *NOT RECOMMENDED* -->
+    <allow-navigation href="*" />
+    
+    <!-- The above is equivalent to these three declarations -->
+    <allow-navigation href="http://*/*"; />
+    <allow-navigation href="https://*/*"; />
+    <allow-navigation href="data:*" />
+    
+
+## 科爾多瓦-外掛程式-白名單
+
+控制應用程式允許讓系統打開的 Url。 預設情
況下,沒有外部 Url 允許。
+
+在 android 系統,這相當於發送類型 BROWSEABLE 的意圖。
+
+此白名單並不適用于只超連結和對`window.open 
()`調用的外掛程式.
+
+在`config.xml`中添加`<allow-intent>`標籤,像這樣:
+
+    <!-- Allow links to web pages to open in a browser -->
+    <allow-intent href="http://*/*"; />
+    <allow-intent href="https://*/*"; />
+    
+    <!-- Allow links to example.com to open in a browser -->
+    <allow-intent href="http://example.com/*"; />
+    
+    <!-- Wildcards are allowed for the protocol, as a prefix
+         to the host, or as a suffix to the path -->
+    <allow-intent href="*://*.example.com/*" />
+    
+    <!-- Allow SMS links to open messaging app -->
+    <allow-intent href="sms:*" />
+    
+    <!-- Allow tel: links to open the dialer -->
+    <allow-intent href="tel:*" />
+    
+    <!-- Allow geo: links to open maps -->
+    <allow-intent href="geo:*" />
+    
+    <!-- Allow all unrecognized URLs to open installed apps
+         *NOT RECOMMENDED* -->
+    <allow-intent href="*" />
+    
+
+## 網路請求白名單
+
+網路請求的控制項 (圖像,XHRs 等) 允許 
(通過科爾多瓦本機掛鉤)。
+
+注意: 我們建議你使用內容的安全性原則 
(見下文),這是更安全。 此白名單大多是為 webviews 不支援 
CSP 的歷史。
+
+在`config.xml`中添加`<access>`標記,像這樣:
+
+    <!-- Allow images, xhrs, etc. to google.com -->
+    <access origin="http://google.com"; />
+    <access origin="https://google.com"; />
+    
+    <!-- Access to the subdomain maps.google.com -->
+    <access origin="http://maps.google.com"; />
+    
+    <!-- Access to all the subdomains on google.com -->
+    <access origin="http://*.google.com"; />
+    
+    <!-- Enable requests to content: URLs -->
+    <access origin="content:///*" />
+    
+    <!-- Don't block any requests -->
+    <access origin="*" />
+    
+
+沒有任何`<access>`標籤,只到`file://` Url 允許請求。 但是,é 
è¨­çš„科爾多瓦應用程式包括`<access origin="*">` ,預設情況。
+
+怪癖: Android 還允許對 
HTTPs://ssl.gstatic.com/accessibility/javascript/android/ 請求預設情
況下,因為這是對講正常所需。
+
+### 內容安全政策
+
+網路請求的控制項 (圖像,XHRs 等) 允許 (通過 web 
視圖直接)。
+
+對 Android 和 iOS,網路請求白名單 (見上文) 是不能夠
過濾所有類型的請求 (例如`<video>` & Websocket 未被阻止)。 
那麼,除了白名單中,你應使用[內容安å…
¨æ€§åŽŸå‰‡](http://content-security-policy.com/) `< 元 >`標記您的所有é 
é¢ã€‚
+
+在 android 系統,對 CSP 系統 web 視圖的支援開始奇巧 
(但是是上使用 web 視圖人行橫道上的所有版本可用)。
+
+下面是一些示例 CSP 聲明為`.html`頁面:
+
+    <!-- Good default declaration:
+        * gap: is required only on iOS (when using UIWebView) and is needed 
for JS->native communication
+        * https://ssl.gstatic.com is required only on Android and is needed 
for TalkBack to function properly
+        * Disables use of eval() and inline scripts in order to mitigate risk 
of XSS vulnerabilities. To change this:
+            * Enable inline JS: add 'unsafe-inline' to default-src
+            * Enable eval(): add 'unsafe-eval' to default-src
+    -->
+    <meta http-equiv="Content-Security-Policy" content="default-src 'self' 
data: gap: https://ssl.gstatic.com; style-src 'self' 'unsafe-inline'; media-src 
*">
+    
+    <!-- Allow requests to foo.com -->
+    <meta http-equiv="Content-Security-Policy" content="default-src 'self' 
foo.com">
+    
+    <!-- Enable all requests, inline styles, and eval() -->
+    <meta http-equiv="Content-Security-Policy" content="default-src *; 
style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 
'unsafe-eval'">
+    
+    <!-- Allow XHRs via https only -->
+    <meta http-equiv="Content-Security-Policy" content="default-src 'self' 
https:">
+    
+    <!-- Allow iframe to https://cordova.apache.org/ -->
+    <meta http-equiv="Content-Security-Policy" content="default-src 'self'; 
frame-src 'self' https://cordova.apache.org";>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/8ac659c7/tests/cdv-test-project/plugins/cordova-plugin-whitelist/package.json
----------------------------------------------------------------------
diff --git 
a/tests/cdv-test-project/plugins/cordova-plugin-whitelist/package.json 
b/tests/cdv-test-project/plugins/cordova-plugin-whitelist/package.json
new file mode 100644
index 0000000..ca599b6
--- /dev/null
+++ b/tests/cdv-test-project/plugins/cordova-plugin-whitelist/package.json
@@ -0,0 +1,28 @@
+{
+  "name": "cordova-plugin-whitelist",
+  "version": "1.2.1",
+  "description": "Cordova Whitelist Plugin",
+  "cordova": {
+    "platforms": [
+      "android"
+    ]
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/apache/cordova-plugin-whitelist";
+  },
+  "keywords": [
+    "cordova",
+    "whitelist",
+    "ecosystem:cordova",
+    "cordova-android"
+  ],
+  "engines": [
+    {
+      "name": "cordova-android",
+      "version": ">=4.0.0"
+    }
+  ],
+  "author": "Apache Software Foundation",
+  "license": "Apache 2.0"
+}

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/8ac659c7/tests/cdv-test-project/plugins/cordova-plugin-whitelist/plugin.xml
----------------------------------------------------------------------
diff --git a/tests/cdv-test-project/plugins/cordova-plugin-whitelist/plugin.xml 
b/tests/cdv-test-project/plugins/cordova-plugin-whitelist/plugin.xml
new file mode 100644
index 0000000..a4f49a8
--- /dev/null
+++ b/tests/cdv-test-project/plugins/cordova-plugin-whitelist/plugin.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+
+<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0";
+           id="cordova-plugin-whitelist"
+      version="1.2.1">
+    <name>Whitelist</name>
+    <description>Cordova Network Whitelist Plugin</description>
+    <license>Apache 2.0</license>
+    <keywords>cordova,whitelist,policy</keywords>
+
+    <engines>
+      <engine name="cordova-android" version=">=4.0.0" />
+    </engines>
+
+    <platform name="android">
+        <config-file target="res/xml/config.xml" parent="/*">
+            <feature name="Whitelist" >
+                <param name="android-package" 
value="org.apache.cordova.whitelist.WhitelistPlugin"/>
+                <param name="onload" value="true" />
+            </feature>
+        </config-file>
+
+        <source-file src="src/android/WhitelistPlugin.java" 
target-dir="src/org/apache/cordova/whitelist" />
+
+        <js-module src="whitelist.js" name="whitelist">
+            <runs />
+        </js-module>
+               <info>
+               This plugin is only applicable for versions of cordova-android 
greater than 4.0. If you have a previous platform version, you do *not* need 
this plugin since the whitelist will be built in.
+          </info>
+    </platform>
+       
+
+
+</plugin>

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/8ac659c7/tests/cdv-test-project/plugins/cordova-plugin-whitelist/src/android/WhitelistPlugin.java
----------------------------------------------------------------------
diff --git 
a/tests/cdv-test-project/plugins/cordova-plugin-whitelist/src/android/WhitelistPlugin.java
 
b/tests/cdv-test-project/plugins/cordova-plugin-whitelist/src/android/WhitelistPlugin.java
new file mode 100644
index 0000000..4e4f57e
--- /dev/null
+++ 
b/tests/cdv-test-project/plugins/cordova-plugin-whitelist/src/android/WhitelistPlugin.java
@@ -0,0 +1,161 @@
+/*
+       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.
+*/
+
+package org.apache.cordova.whitelist;
+
+import org.apache.cordova.CordovaPlugin;
+import org.apache.cordova.ConfigXmlParser;
+import org.apache.cordova.Whitelist;
+import org.xmlpull.v1.XmlPullParser;
+
+import android.content.Context;
+import android.util.Log;
+
+public class WhitelistPlugin extends CordovaPlugin {
+    private static final String LOG_TAG = "WhitelistPlugin";
+    private Whitelist allowedNavigations;
+    private Whitelist allowedIntents;
+    private Whitelist allowedRequests;
+
+    // Used when instantiated via reflection by PluginManager
+    public WhitelistPlugin() {
+    }
+    // These can be used by embedders to allow Java-configuration of 
whitelists.
+    public WhitelistPlugin(Context context) {
+        this(new Whitelist(), new Whitelist(), null);
+        new CustomConfigXmlParser().parse(context);
+    }
+    public WhitelistPlugin(XmlPullParser xmlParser) {
+        this(new Whitelist(), new Whitelist(), null);
+        new CustomConfigXmlParser().parse(xmlParser);
+    }
+    public WhitelistPlugin(Whitelist allowedNavigations, Whitelist 
allowedIntents, Whitelist allowedRequests) {
+        if (allowedRequests == null) {
+            allowedRequests = new Whitelist();
+            allowedRequests.addWhiteListEntry("file:///*", false);
+            allowedRequests.addWhiteListEntry("data:*", false);
+        }
+        this.allowedNavigations = allowedNavigations;
+        this.allowedIntents = allowedIntents;
+        this.allowedRequests = allowedRequests;
+    }
+    @Override
+    public void pluginInitialize() {
+        if (allowedNavigations == null) {
+            allowedNavigations = new Whitelist();
+            allowedIntents = new Whitelist();
+            allowedRequests = new Whitelist();
+            new CustomConfigXmlParser().parse(webView.getContext());
+        }
+    }
+
+    private class CustomConfigXmlParser extends ConfigXmlParser {
+        @Override
+        public void handleStartTag(XmlPullParser xml) {
+            String strNode = xml.getName();
+            if (strNode.equals("content")) {
+                String startPage = xml.getAttributeValue(null, "src");
+                allowedNavigations.addWhiteListEntry(startPage, false);
+            } else if (strNode.equals("allow-navigation")) {
+                String origin = xml.getAttributeValue(null, "href");
+                if ("*".equals(origin)) {
+                    allowedNavigations.addWhiteListEntry("http://*/*";, false);
+                    allowedNavigations.addWhiteListEntry("https://*/*";, false);
+                    allowedNavigations.addWhiteListEntry("data:*", false);
+                } else {
+                    allowedNavigations.addWhiteListEntry(origin, false);
+                }
+            } else if (strNode.equals("allow-intent")) {
+                String origin = xml.getAttributeValue(null, "href");
+                allowedIntents.addWhiteListEntry(origin, false);
+            } else if (strNode.equals("access")) {
+                String origin = xml.getAttributeValue(null, "origin");
+                String subdomains = xml.getAttributeValue(null, "subdomains");
+                boolean external = (xml.getAttributeValue(null, 
"launch-external") != null);
+                if (origin != null) {
+                    if (external) {
+                        Log.w(LOG_TAG, "Found <access launch-external> within 
config.xml. Please use <allow-intent> instead.");
+                        allowedIntents.addWhiteListEntry(origin, (subdomains 
!= null) && (subdomains.compareToIgnoreCase("true") == 0));
+                    } else {
+                        if ("*".equals(origin)) {
+                            allowedRequests.addWhiteListEntry("http://*/*";, 
false);
+                            allowedRequests.addWhiteListEntry("https://*/*";, 
false);
+                        } else {
+                            allowedRequests.addWhiteListEntry(origin, 
(subdomains != null) && (subdomains.compareToIgnoreCase("true") == 0));
+                        }
+                    }
+                }
+            }
+        }
+        @Override
+        public void handleEndTag(XmlPullParser xml) {
+        }
+    }
+
+    @Override
+    public Boolean shouldAllowNavigation(String url) {
+        if (allowedNavigations.isUrlWhiteListed(url)) {
+            return true;
+        }
+        return null; // Default policy
+    }
+
+    @Override
+    public Boolean shouldAllowRequest(String url) {
+        if (Boolean.TRUE == shouldAllowNavigation(url)) {
+            return true;
+        }
+        if (allowedRequests.isUrlWhiteListed(url)) {
+            return true;
+        }
+        return null; // Default policy
+    }
+
+    @Override
+    public Boolean shouldOpenExternalUrl(String url) {
+        if (allowedIntents.isUrlWhiteListed(url)) {
+            return true;
+        }
+        return null; // Default policy
+    }
+
+    public Whitelist getAllowedNavigations() {
+        return allowedNavigations;
+    }
+
+    public void setAllowedNavigations(Whitelist allowedNavigations) {
+        this.allowedNavigations = allowedNavigations;
+    }
+
+    public Whitelist getAllowedIntents() {
+        return allowedIntents;
+    }
+
+    public void setAllowedIntents(Whitelist allowedIntents) {
+        this.allowedIntents = allowedIntents;
+    }
+
+    public Whitelist getAllowedRequests() {
+        return allowedRequests;
+    }
+
+    public void setAllowedRequests(Whitelist allowedRequests) {
+        this.allowedRequests = allowedRequests;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/8ac659c7/tests/cdv-test-project/plugins/cordova-plugin-whitelist/whitelist.js
----------------------------------------------------------------------
diff --git 
a/tests/cdv-test-project/plugins/cordova-plugin-whitelist/whitelist.js 
b/tests/cdv-test-project/plugins/cordova-plugin-whitelist/whitelist.js
new file mode 100644
index 0000000..74d7a99
--- /dev/null
+++ b/tests/cdv-test-project/plugins/cordova-plugin-whitelist/whitelist.js
@@ -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.
+ *
+*/
+
+if (!document.querySelector('meta[http-equiv=Content-Security-Policy]')) {
+    var msg = 'No Content-Security-Policy meta tag found. Please add one when 
using the cordova-plugin-whitelist plugin.';
+    console.error(msg);
+    setInterval(function() {
+        console.warn(msg);
+    }, 10000);
+}

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/8ac659c7/tests/cdv-test-project/plugins/fetch.json
----------------------------------------------------------------------
diff --git a/tests/cdv-test-project/plugins/fetch.json 
b/tests/cdv-test-project/plugins/fetch.json
new file mode 100644
index 0000000..bfc05e7
--- /dev/null
+++ b/tests/cdv-test-project/plugins/fetch.json
@@ -0,0 +1,10 @@
+{
+    "cordova-plugin-whitelist": {
+        "source": {
+            "type": "registry",
+            "id": "cordova-plugin-whitelist@1"
+        },
+        "is_top_level": true,
+        "variables": {}
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/8ac659c7/tests/cdv-test-project/plugins/osx.json
----------------------------------------------------------------------
diff --git a/tests/cdv-test-project/plugins/osx.json 
b/tests/cdv-test-project/plugins/osx.json
new file mode 100644
index 0000000..2270d61
--- /dev/null
+++ b/tests/cdv-test-project/plugins/osx.json
@@ -0,0 +1,15 @@
+{
+    "prepare_queue": {
+        "installed": [],
+        "uninstalled": []
+    },
+    "config_munge": {
+        "files": {}
+    },
+    "installed_plugins": {
+        "cordova-plugin-whitelist": {
+            "PACKAGE_NAME": "org.apache.cordova.test"
+        }
+    },
+    "dependent_plugins": {}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/8ac659c7/tests/cdv-test-project/res/test-64x64.png
----------------------------------------------------------------------
diff --git a/tests/cdv-test-project/res/test-64x64.png 
b/tests/cdv-test-project/res/test-64x64.png
new file mode 100644
index 0000000..430bdc5
Binary files /dev/null and b/tests/cdv-test-project/res/test-64x64.png differ

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/8ac659c7/tests/cdv-test-project/www/css/index.css
----------------------------------------------------------------------
diff --git a/tests/cdv-test-project/www/css/index.css 
b/tests/cdv-test-project/www/css/index.css
new file mode 100644
index 0000000..51daa79
--- /dev/null
+++ b/tests/cdv-test-project/www/css/index.css
@@ -0,0 +1,115 @@
+/*
+ * 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.
+ */
+* {
+    -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link 
selection, adjust last value opacity 0 to 1.0 */
+}
+
+body {
+    -webkit-touch-callout: none;                /* prevent callout to copy 
image, etc when tap to hold */
+    -webkit-text-size-adjust: none;             /* prevent webkit from 
resizing text to fit */
+    -webkit-user-select: none;                  /* prevent copy paste, to 
allow, change 'none' to 'text' */
+    background-color:#E4E4E4;
+    background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
+    background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
+    background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
+    background-image:-webkit-gradient(
+        linear,
+        left top,
+        left bottom,
+        color-stop(0, #A7A7A7),
+        color-stop(0.51, #E4E4E4)
+    );
+    background-attachment:fixed;
+    font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, 
sans-serif;
+    font-size:12px;
+    height:100%;
+    margin:0px;
+    padding:0px;
+    text-transform:uppercase;
+    width:100%;
+}
+
+/* Portrait layout (default) */
+.app {
+    background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */
+    position:absolute;             /* position in the center of the screen */
+    left:50%;
+    top:50%;
+    height:50px;                   /* text area height */
+    width:225px;                   /* text area width */
+    text-align:center;
+    padding:180px 0px 0px 0px;     /* image height is 200px (bottom 20px are 
overlapped with text) */
+    margin:-115px 0px 0px -112px;  /* offset vertical: half of image height 
and text area height */
+                                   /* offset horizontal: half of text area 
width */
+}
+
+/* Landscape layout (with min-width) */
+@media screen and (min-aspect-ratio: 1/1) and (min-width:400px) {
+    .app {
+        background-position:left center;
+        padding:75px 0px 75px 170px;  /* padding-top + padding-bottom + text 
area = image height */
+        margin:-90px 0px 0px -198px;  /* offset vertical: half of image height 
*/
+                                      /* offset horizontal: half of image 
width and text area width */
+    }
+}
+
+h1 {
+    font-size:24px;
+    font-weight:normal;
+    margin:0px;
+    overflow:visible;
+    padding:0px;
+    text-align:center;
+}
+
+.event {
+    border-radius:4px;
+    -webkit-border-radius:4px;
+    color:#FFFFFF;
+    font-size:12px;
+    margin:0px 30px;
+    padding:2px 0px;
+}
+
+.event.listening {
+    background-color:#333333;
+    display:block;
+}
+
+.event.received {
+    background-color:#4B946A;
+    display:none;
+}
+
+@keyframes fade {
+    from { opacity: 1.0; }
+    50% { opacity: 0.4; }
+    to { opacity: 1.0; }
+}
+ 
+@-webkit-keyframes fade {
+    from { opacity: 1.0; }
+    50% { opacity: 0.4; }
+    to { opacity: 1.0; }
+}
+ 
+.blink {
+    animation:fade 3000ms infinite;
+    -webkit-animation:fade 3000ms infinite;
+}

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/8ac659c7/tests/cdv-test-project/www/img/logo.png
----------------------------------------------------------------------
diff --git a/tests/cdv-test-project/www/img/logo.png 
b/tests/cdv-test-project/www/img/logo.png
new file mode 100644
index 0000000..9519e7d
Binary files /dev/null and b/tests/cdv-test-project/www/img/logo.png differ

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/8ac659c7/tests/cdv-test-project/www/index.html
----------------------------------------------------------------------
diff --git a/tests/cdv-test-project/www/index.html 
b/tests/cdv-test-project/www/index.html
new file mode 100644
index 0000000..646f9cb
--- /dev/null
+++ b/tests/cdv-test-project/www/index.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<!--
+    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.
+-->
+<html>
+    <head>
+        <!--
+        Customize this policy to fit your own app's needs. For more guidance, 
see:
+            
https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
+        Some notes:
+            * gap: is required only on iOS (when using UIWebView) and is 
needed for JS->native communication
+            * https://ssl.gstatic.com is required only on Android and is 
needed for TalkBack to function properly
+            * Disables use of inline scripts in order to mitigate risk of XSS 
vulnerabilities. To change this:
+                * Enable inline JS: add 'unsafe-inline' to default-src
+        -->
+        <meta http-equiv="Content-Security-Policy" content="default-src 'self' 
data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 
'unsafe-inline'; media-src *">
+        <meta name="format-detection" content="telephone=no">
+        <meta name="msapplication-tap-highlight" content="no">
+        <meta name="viewport" content="user-scalable=no, initial-scale=1, 
maximum-scale=1, minimum-scale=1, width=device-width">
+        <link rel="stylesheet" type="text/css" href="css/index.css">
+        <title>Hello World</title>
+    </head>
+    <body>
+        <div class="app">
+            <h1>Apache Cordova</h1>
+            <div id="deviceready" class="blink">
+                <p class="event listening">Connecting to Device</p>
+                <p class="event received">Device is Ready</p>
+            </div>
+        </div>
+        <script type="text/javascript" src="cordova.js"></script>
+        <script type="text/javascript" src="js/index.js"></script>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/8ac659c7/tests/cdv-test-project/www/js/index.js
----------------------------------------------------------------------
diff --git a/tests/cdv-test-project/www/js/index.js 
b/tests/cdv-test-project/www/js/index.js
new file mode 100644
index 0000000..c31cd83
--- /dev/null
+++ b/tests/cdv-test-project/www/js/index.js
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+var app = {
+    // Application Constructor
+    initialize: function() {
+        this.bindEvents();
+    },
+    // Bind Event Listeners
+    //
+    // Bind any events that are required on startup. Common events are:
+    // 'load', 'deviceready', 'offline', and 'online'.
+    bindEvents: function() {
+        document.addEventListener('deviceready', this.onDeviceReady, false);
+    },
+    // deviceready Event Handler
+    //
+    // The scope of 'this' is the event. In order to call the 'receivedEvent'
+    // function, we must explicitly call 'app.receivedEvent(...);'
+    onDeviceReady: function() {
+        app.receivedEvent('deviceready');
+    },
+    // Update DOM on a Received Event
+    receivedEvent: function(id) {
+        var parentElement = document.getElementById(id);
+        var listeningElement = parentElement.querySelector('.listening');
+        var receivedElement = parentElement.querySelector('.received');
+
+        listeningElement.setAttribute('style', 'display:none;');
+        receivedElement.setAttribute('style', 'display:block;');
+
+        console.log('Received Event: ' + id);
+    }
+};
+
+app.initialize();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/8ac659c7/tests/spec/platform.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/platform.spec.js b/tests/spec/platform.spec.js
new file mode 100644
index 0000000..5738f34
--- /dev/null
+++ b/tests/spec/platform.spec.js
@@ -0,0 +1,80 @@
+/*
+ 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.
+ */
+
+var shell = require('shelljs'),
+    spec = __dirname,
+    path = require('path'),
+    util = require('util'),
+    fs = require('fs');
+
+    var cordova_bin = path.join(spec, '../..', 'bin');
+    var test_projectPath = path.join(spec, '../', 'cdv-test-project');
+    var test_platformPath = path.join(test_projectPath, 'platforms', 'osx');
+
+    var tmp = require('tmp').dirSync().name;
+
+function initProject() {
+    // remove existing folder
+    var pPath = path.join(test_projectPath, 'platforms');
+    shell.rm('-rf', pPath);
+}
+
+describe('platform add', function() {
+
+    beforeEach(function() {
+        initProject();
+
+        shell.cd(test_projectPath);
+        var command = 'cordova platform add ../../';
+        console.log('executing "%s" in "%s"', command, shell.pwd());
+        var return_code = shell.exec(command, { silent: false}).code;
+        expect(return_code).toBe(0);
+    });
+
+    it('should have a config.xml', function() {
+        var configXmlPath = path.join(test_platformPath, 'HelloCordova', 
'config.xml');
+        expect(fs.existsSync(configXmlPath)).toBe(true);
+    });
+
+    it('should have the correct icons', function() {
+
+        var platformIcons = [
+            {name: 'icon-16x16.png', width: 16, height: 16},
+            {name: 'icon-32x32.png', width: 32, height: 32},
+            {name: 'icon-64x64.png', width: 64, height: 64},
+            {name: 'icon-128x128.png', width: 128, height: 128},
+            {name: 'icon-256x256.png', width: 256, height: 256},
+            {name: 'icon-512x512.png', width: 512, height: 512}
+        ];
+
+        var appIconsPath = path.join(test_platformPath, 
'HelloCordova','Images.xcassets','AppIcon.appiconset');
+        var srcIcon = path.join(test_projectPath, 'res', 'test-64x64.png');
+        platformIcons.forEach(function(iconDef) {
+            var iconPath = path.join(appIconsPath, iconDef.name);
+            expect(fs.existsSync(iconPath)).toBe(true);
+
+            // check if the icons are the same as the one specified in the 
config.xml
+            var cmd = util.format('cmp "%s" "%s"', srcIcon, iconPath);
+            var return_code = shell.exec(cmd, { silent: false}).code;
+            expect(return_code).toBe(0);
+
+        });
+    });
+
+});


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to