cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [4/4] cordova-common git commit: CB-13145 : added getFrameworks to unit test
Date Wed, 30 Aug 2017 05:44:57 GMT
CB-13145 : added getFrameworks to unit test


Project: http://git-wip-us.apache.org/repos/asf/cordova-common/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-common/commit/00577f81
Tree: http://git-wip-us.apache.org/repos/asf/cordova-common/tree/00577f81
Diff: http://git-wip-us.apache.org/repos/asf/cordova-common/diff/00577f81

Branch: refs/heads/master
Commit: 00577f8151547e1cb7809901db1ddf012f9a3a78
Parents: 5d67858
Author: Audrey So <audreyso@apache.org>
Authored: Fri Aug 25 13:26:40 2017 -0700
Committer: Steve Gill <stevengill97@gmail.com>
Committed: Tue Aug 29 22:42:42 2017 -0700

----------------------------------------------------------------------
 spec/PluginInfo/PluginInfo.spec.js            |  27 +++++-
 spec/fixtures/plugins/org.test.src/plugin.xml | 102 +++++++++++++++++++++
 2 files changed, 126 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-common/blob/00577f81/spec/PluginInfo/PluginInfo.spec.js
----------------------------------------------------------------------
diff --git a/spec/PluginInfo/PluginInfo.spec.js b/spec/PluginInfo/PluginInfo.spec.js
index f35147d..5fdaf87 100644
--- a/spec/PluginInfo/PluginInfo.spec.js
+++ b/spec/PluginInfo/PluginInfo.spec.js
@@ -19,14 +19,22 @@
 
 var PluginInfo = require('../../src/PluginInfo/PluginInfo');
 var path = require('path');
-
 var pluginsDir = path.join(__dirname, '../fixtures/plugins');
 
 describe('PluginInfo', function () {
     it('Test 001 : should read a plugin.xml file', function () {
         /* eslint-disable no-unused-vars */
-        var p, prefs, assets, deps, configFiles, infos, srcFiles;
-        var headerFiles, libFiles, resourceFiles;
+        var p;
+        var prefs;
+        var assets;
+        var deps;
+        var configFiles;
+        var infos;
+        var srcFiles;
+        var headerFiles;
+        var libFiles;
+        var resourceFiles;
+        var getFrameworks;
         expect(function () {
             p = new PluginInfo(path.join(pluginsDir, 'ChildBrowser'));
             prefs = p.getPreferences('android');
@@ -37,6 +45,7 @@ describe('PluginInfo', function () {
             srcFiles = p.getSourceFiles('android');
             headerFiles = p.getHeaderFiles('android');
             libFiles = p.getLibFiles('android');
+            getFrameworks = p.getFrameworks('android');
             resourceFiles = p.getResourceFiles('android');
         }).not.toThrow();
         expect(p).toBeDefined();
@@ -49,4 +58,16 @@ describe('PluginInfo', function () {
             new PluginInfo('/non/existent/dir'); /* eslint no-new : 0 */
         }).toThrow();
     });
+
+    it('Test 003: replace framework src', function () {
+        var p = new PluginInfo(path.join(pluginsDir, 'org.test.src'));
+        var result = p.getFrameworks('android', {cli_variables: { FCM_VERSION: '9.0.0' }});
+        expect(result[2].src).toBe('com.google.firebase:firebase-messaging:9.0.0');
+    });
+
+    it('Test 004: framework src uses default variable', function () {
+        var p = new PluginInfo(path.join(pluginsDir, 'org.test.src'));
+        var result = p.getFrameworks('android', {});
+        expect(result[2].src).toBe('com.google.firebase:firebase-messaging:11.0.1');
+    });
 });

http://git-wip-us.apache.org/repos/asf/cordova-common/blob/00577f81/spec/fixtures/plugins/org.test.src/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/fixtures/plugins/org.test.src/plugin.xml b/spec/fixtures/plugins/org.test.src/plugin.xml
new file mode 100644
index 0000000..6d1aa91
--- /dev/null
+++ b/spec/fixtures/plugins/org.test.src/plugin.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:amazon="http://schemas.android.com/apk/lib/com.amazon.device.ads" xmlns:rim="http://www.blackberry.com/ns/widgets"
id="phonegap-plugin-push" version="2.0.0">
+  <name>PushPlugin</name>
+  <description>
+    This plugin allows your application to receive push notifications on Android, iOS and
Windows devices.
+    Android uses Firebase Cloud Messaging.
+    iOS uses Apple APNS Notifications.
+    Windows uses Microsoft WNS Notifications.
+  </description>
+  <license>MIT</license>
+  <js-module src="www/push.js" name="PushNotification">
+    <clobbers target="PushNotification"/>
+  </js-module>
+  <engines>
+    <engine name="cordova" version=">=7.0.0"/>
+    <engine name="cordova-android" version=">=6.2.1"/>
+    <engine name="cordova-ios" version=">=4.4.0"/>
+  </engines>
+
+  <platform name="android">
+      <feature name="PushNotification">
+        <param name="android-package" value="com.adobe.phonegap.push.PushPlugin"/>
+      </feature>
+    <config-file target="AndroidManifest.xml" parent="/manifest">
+      <uses-permission android:name="android.permission.INTERNET"/>
+      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+      <uses-permission android:name="android.permission.WAKE_LOCK"/>
+      <uses-permission android:name="android.permission.VIBRATE"/>
+    </config-file>
+        <preference name="FCM_VERSION" default="11.0.1" />
+<config-file target="res/xml/config.xml" parent="/*">
+<string>$FCM_VERSION</string>
+</config-file>
+    <config-file target="AndroidManifest.xml" parent="/manifest/application">
+      <activity android:name="com.adobe.phonegap.push.PushHandlerActivity" android:exported="true"
android:permission="${applicationId}.permission.PushHandlerActivity"/>
+      <receiver android:name="com.adobe.phonegap.push.BackgroundActionButtonHandler"/>
+      <receiver android:name="com.adobe.phonegap.push.PushDismissedHandler"/>
+      <service android:name="com.adobe.phonegap.push.FCMService">
+        <intent-filter>
+          <action android:name="com.google.firebase.MESSAGING_EVENT"/>
+        </intent-filter>
+      </service>
+      <service android:name="com.adobe.phonegap.push.PushInstanceIDListenerService">
+        <intent-filter>
+          <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
+        </intent-filter>
+      </service>
+    </config-file>
+    <framework src="com.android.support:support-v13:25.1.0"/>
+    <framework src="me.leolin:ShortcutBadger:1.1.17@aar"/>
+    <framework src="com.google.firebase:firebase-messaging:$FCM_VERSION"/>
+    <framework src="push.gradle" custom="true" type="gradleReference"/>
+    <source-file src="src/android/com/adobe/phonegap/push/FCMService.java" target-dir="src/com/adobe/phonegap/push/"/>
+    <source-file src="src/android/com/adobe/phonegap/push/PushConstants.java" target-dir="src/com/adobe/phonegap/push/"/>
+    <source-file src="src/android/com/adobe/phonegap/push/PushHandlerActivity.java" target-dir="src/com/adobe/phonegap/push/"/>
+    <source-file src="src/android/com/adobe/phonegap/push/PushInstanceIDListenerService.java"
target-dir="src/com/adobe/phonegap/push/"/>
+    <source-file src="src/android/com/adobe/phonegap/push/PushPlugin.java" target-dir="src/com/adobe/phonegap/push/"/>
+    <source-file src="src/android/com/adobe/phonegap/push/PermissionUtils.java" target-dir="src/com/adobe/phonegap/push/"/>
+    <source-file src="src/android/com/adobe/phonegap/push/BackgroundActionButtonHandler.java"
target-dir="src/com/adobe/phonegap/push/"/>
+    <source-file src="src/android/com/adobe/phonegap/push/PushDismissedHandler.java" target-dir="src/com/adobe/phonegap/push/"/>
+  </platform>
+
+  <platform name="browser">
+    <js-module src="www/browser/push.js" name="BrowserPush">
+      <clobbers target="PushNotification"/>
+    </js-module>
+    <asset src="src/browser/ServiceWorker.js" target="ServiceWorker.js"/>
+    <asset src="src/browser/manifest.json" target="manifest.json"/>
+  </platform>
+  <platform name="ios">
+    <config-file target="config.xml" parent="/*">
+      <feature name="PushNotification">
+        <param name="ios-package" value="PushPlugin"/>
+      </feature>
+    </config-file>
+    <config-file target="*-Info.plist" parent="UIBackgroundModes">
+      <array>
+        <string>remote-notification</string>
+      </array>
+    </config-file>
+    <config-file target="*-Debug.plist" parent="aps-environment">
+      <string>development</string>
+    </config-file>
+    <config-file target="*-Release.plist" parent="aps-environment">
+      <string>production</string>
+    </config-file>
+    <source-file src="src/ios/AppDelegate+notification.m"/>
+    <source-file src="src/ios/PushPlugin.m"/>
+    <header-file src="src/ios/AppDelegate+notification.h"/>
+    <header-file src="src/ios/PushPlugin.h"/>
+    <framework src="FirebaseMessaging" type="podspec" spec="~> 2.0.0"/>
+  </platform>
+  <platform name="windows">
+    <hook type="after_plugin_install" src="hooks/windows/setToastCapable.js"/>
+    <js-module src="src/windows/PushPluginProxy.js" name="PushPlugin">
+      <runs/>
+    </js-module>
+    <config-file target="config.xml" parent="/*">
+      <preference name="WindowsToastCapable" value="true"/>
+    </config-file>
+  </platform>
+</plugin>
\ No newline at end of file


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


Mime
View raw message