Repository: cordova-lib Updated Branches: refs/heads/master 921a1fb66 -> d009464ef
CB-8086 Fixed framework tests. Installing and uninstalling frameworks now read AndroidManifest.xml to get the package name; the readFileSync fakes are updated to reflect this. Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/d009464e Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/d009464e Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/d009464e Branch: refs/heads/master Commit: d009464ef05016031da1d68ca33f5a29ccd775c9 Parents: 921a1fb Author: Max Woghiren <[email protected]> Authored: Mon Dec 1 01:44:40 2014 -0500 Committer: Max Woghiren <[email protected]> Committed: Mon Dec 1 01:44:40 2014 -0500 ---------------------------------------------------------------------- .../spec-plugman/platforms/android.spec.js | 23 +++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d009464e/cordova-lib/spec-plugman/platforms/android.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-plugman/platforms/android.spec.js b/cordova-lib/spec-plugman/platforms/android.spec.js index 0ead8bf..387f2cc 100644 --- a/cordova-lib/spec-plugman/platforms/android.spec.js +++ b/cordova-lib/spec-plugman/platforms/android.spec.js @@ -138,9 +138,12 @@ describe('android project handler', function() { android.purgeProjectFileCache(temp); }); it('with custom=true should update the main and library projects', function() { + var packageIdSuffix = "PlugmanTest"; + var packageId = "io.cordova." + packageIdSuffix; var frameworkElement = { attrib: { src: "LibraryPath", custom: true } }; - var subDir = path.resolve(temp, dummy_id, frameworkElement.attrib.src); + var subDir = path.resolve(temp, dummy_id, packageIdSuffix + '-' + frameworkElement.attrib.src); var mainProjectPropsFile = path.resolve(temp, "project.properties"); + var mainProjectManifestFile = path.resolve(temp, "AndroidManifest.xml"); var subProjectPropsFile = path.resolve(subDir, "project.properties"); var existsSync = spyOn( fs, 'existsSync').andReturn(true); @@ -152,7 +155,9 @@ describe('android project handler', function() { return '#Some comment\ntarget=android-19\nandroid.library.reference.1=ExistingLibRef1\nandroid.library.reference.2=ExistingLibRef2'; } else if (file === subProjectPropsFile) { return '#Some comment\ntarget=android-17\nandroid.library=true'; - } else { + } else if (file === mainProjectManifestFile) { + return '<manifest package="' + packageId + '">'; + }{ throw new Error("Trying to read from an unexpected file " + file + '\n expected: ' + mainProjectPropsFile + '\n' + subProjectPropsFile); } }) @@ -162,7 +167,7 @@ describe('android project handler', function() { android.parseProjectFile(temp).write(); expect(_.any(writeFileSync.argsForCall, function (callArgs) { - return callArgs[0] === mainProjectPropsFile && callArgs[1].indexOf('\nandroid.library.reference.3='+dummy_id+'/LibraryPath') > -1; + return callArgs[0] === mainProjectPropsFile && callArgs[1].indexOf('\nandroid.library.reference.3='+dummy_id+'/'+packageIdSuffix+'-LibraryPath') > -1; })).toBe(true, 'Reference to library not added'); expect(_.any(writeFileSync.argsForCall, function (callArgs) { return callArgs[0] === subProjectPropsFile && callArgs[1].indexOf('\ntarget=android-19') > -1; @@ -249,15 +254,21 @@ describe('android project handler', function() { android.purgeProjectFileCache(temp); }); it('should remove library reference from the main project', function () { + var packageIdSuffix = "PlugmanTest"; + var packageId = "io.cordova." + packageIdSuffix; var frameworkElement = { attrib: { src: "LibraryPath", custom: true } }; - var sub_dir = path.resolve(temp, dummy_id, frameworkElement.attrib.src); + var sub_dir = path.resolve(temp, dummy_id, packageIdSuffix + '-' + frameworkElement.attrib.src); var mainProjectProps = path.resolve(temp, "project.properties"); + var mainProjectManifest = path.resolve(temp, "AndroidManifest.xml"); var existsSync = spyOn(fs, 'existsSync').andReturn(true); var writeFileSync = spyOn(fs, 'writeFileSync'); var removeFile = spyOn(common, 'removeFile'); var readFileSync = spyOn(fs, 'readFileSync').andCallFake(function (file) { - if (path.normalize(file) === mainProjectProps) - return '#Some comment\ntarget=android-19\nandroid.library.reference.1=ExistingLibRef1\nandroid.library.reference.2='+dummy_id+'/LibraryPath\nandroid.library.reference.3=ExistingLibRef2\n'; + if (path.normalize(file) === mainProjectProps) { + return '#Some comment\ntarget=android-19\nandroid.library.reference.1=ExistingLibRef1\nandroid.library.reference.2='+dummy_id+'/'+packageIdSuffix+'-LibraryPath\nandroid.library.reference.3=ExistingLibRef2\n'; + } else if (path.normalize(file) === mainProjectManifest) { + return '<manifest package="' + packageId + '">'; + } }) var exec = spyOn(shell, 'exec'); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
