You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/09/12 20:14:55 UTC

[27/40] git commit: [CB-4430] Add tests for lib-file support on Android.

[CB-4430] Add tests for lib-file support on Android.


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

Branch: refs/heads/ffos
Commit: db43ef2522d3330b25927c7e482c3e663547f783
Parents: c5bdcf0
Author: Andrew Grieve <ag...@chromium.org>
Authored: Wed Sep 4 13:58:04 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Sep 4 13:58:51 2013 -0400

----------------------------------------------------------------------
 spec/install.spec.js                             |  2 +-
 spec/platforms/android.spec.js                   | 17 +++++++++++++++++
 spec/plugins/DummyPlugin/plugin.xml              |  1 +
 spec/plugins/DummyPlugin/src/android/TestLib.jar |  0
 spec/uninstall.spec.js                           |  4 ++--
 5 files changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/db43ef25/spec/install.spec.js
----------------------------------------------------------------------
diff --git a/spec/install.spec.js b/spec/install.spec.js
index 04fd7c2..1639fce 100644
--- a/spec/install.spec.js
+++ b/spec/install.spec.js
@@ -108,7 +108,7 @@ describe('install', function() {
         });
         it('should queue up actions as appropriate for that plugin and call process on the action stack', function() {
             install('android', temp, dummyplugin, plugins_dir, {});
-            expect(actions_push.calls.length).toEqual(3);
+            expect(actions_push.calls.length).toEqual(4);
             expect(c_a).toHaveBeenCalledWith(jasmine.any(Function), [jasmine.any(Object), path.join(plugins_dir, dummyplugin), temp, dummy_id], jasmine.any(Function), [jasmine.any(Object), temp, dummy_id]);
             expect(proc).toHaveBeenCalled();
         });

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/db43ef25/spec/platforms/android.spec.js
----------------------------------------------------------------------
diff --git a/spec/platforms/android.spec.js b/spec/platforms/android.spec.js
index cecb191..cafa730 100644
--- a/spec/platforms/android.spec.js
+++ b/spec/platforms/android.spec.js
@@ -23,6 +23,7 @@ var xml_path     = path.join(dummyplugin, 'plugin.xml')
 var platformTag = plugin_et.find('./platform[@name="android"]');
 var dummy_id = plugin_et._root.attrib['id'];
 var valid_source = platformTag.findall('./source-file'),
+    valid_libs = platformTag.findall('./lib-file'),
     assets = plugin_et.findall('./asset'),
     configChanges = platformTag.findall('./config-file');
 
@@ -65,6 +66,14 @@ describe('android project handler', function() {
         afterEach(function() {
             shell.rm('-rf', temp);
         });
+        describe('of <lib-file> elements', function() {
+            it("should copy jar files to project/libs", function () {
+                var s = spyOn(common, 'copyFile');
+
+                android['lib-file'].install(valid_libs[0], dummyplugin, temp);
+                expect(s).toHaveBeenCalledWith(dummyplugin, 'src/android/TestLib.jar', temp, path.join('libs', 'TestLib.jar'));
+            });
+        });
         describe('of <source-file> elements', function() {
             beforeEach(function() {
                 shell.cp('-rf', android_one_project, temp);
@@ -106,6 +115,14 @@ describe('android project handler', function() {
         afterEach(function() {
             shell.rm('-rf', temp);
         });
+        describe('of <lib-file> elements', function(done) {
+            it('should remove jar files', function () {
+                var s = spyOn(common, 'removeFile');
+                android['lib-file'].install(valid_libs[0], dummyplugin, temp);
+                android['lib-file'].uninstall(valid_libs[0], temp, dummy_id);
+                expect(s).toHaveBeenCalledWith(temp, path.join('libs', 'TestLib.jar'));
+            });
+        });
         describe('of <source-file> elements', function() {
             it('should remove stuff by calling common.deleteJava', function(done) {
                 var s = spyOn(common, 'deleteJava');

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/db43ef25/spec/plugins/DummyPlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/DummyPlugin/plugin.xml b/spec/plugins/DummyPlugin/plugin.xml
index 61e4e52..fad5072 100644
--- a/spec/plugins/DummyPlugin/plugin.xml
+++ b/spec/plugins/DummyPlugin/plugin.xml
@@ -64,6 +64,7 @@
 
         <source-file src="src/android/DummyPlugin.java"
                 target-dir="src/com/phonegap/plugins/dummyplugin" />
+        <lib-file src="src/android/TestLib.jar" />
     </platform>
 
     <!-- blackberry10 -->

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/db43ef25/spec/plugins/DummyPlugin/src/android/TestLib.jar
----------------------------------------------------------------------
diff --git a/spec/plugins/DummyPlugin/src/android/TestLib.jar b/spec/plugins/DummyPlugin/src/android/TestLib.jar
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/db43ef25/spec/uninstall.spec.js
----------------------------------------------------------------------
diff --git a/spec/uninstall.spec.js b/spec/uninstall.spec.js
index 0b6dd0c..74ef25f 100644
--- a/spec/uninstall.spec.js
+++ b/spec/uninstall.spec.js
@@ -54,7 +54,7 @@ describe('uninstallPlatform', function() {
         });
         it('should queue up actions as appropriate for that plugin and call process on the action stack', function() {
             uninstall.uninstallPlatform('android', temp, dummyplugin, plugins_dir, {});
-            expect(actions_push.calls.length).toEqual(3);
+            expect(actions_push.calls.length).toEqual(4);
             expect(c_a).toHaveBeenCalledWith(jasmine.any(Function), [jasmine.any(Object), temp, dummy_id], jasmine.any(Function), [jasmine.any(Object), path.join(plugins_dir, dummyplugin), temp, dummy_id]);
             expect(proc).toHaveBeenCalled();
         });
@@ -210,7 +210,7 @@ describe('uninstall', function() {
         });
         it('should queue up actions as appropriate for that plugin and call process on the action stack', function() {
             uninstall('android', temp, dummyplugin, plugins_dir, {});
-            expect(actions_push.calls.length).toEqual(3);
+            expect(actions_push.calls.length).toEqual(4);
             expect(c_a).toHaveBeenCalledWith(jasmine.any(Function), [jasmine.any(Object), temp, dummy_id], jasmine.any(Function), [jasmine.any(Object), path.join(plugins_dir, dummyplugin), temp, dummy_id]);
             expect(proc).toHaveBeenCalled();
         });