fixed up some more ios tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/b23eeb17 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/b23eeb17 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/b23eeb17 Branch: refs/heads/future Commit: b23eeb17ad4132da367f63aa5774b05e398f45ca Parents: e777979 Author: Tim Kim <[email protected]> Authored: Wed Apr 10 14:40:37 2013 -0700 Committer: Tim Kim <[email protected]> Committed: Wed Apr 10 14:40:37 2013 -0700 ---------------------------------------------------------------------- platforms/ios.js | 2 +- test/android-one-uninstall.js | 1 - test/ios-config-xml-install.js | 71 ++++++++++++++++++++----- test/plugins/ChildBrowser/plugin-old.xml | 24 ++++---- test/plugins/WebNotifications/plugin.xml | 4 +- 5 files changed, 72 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/b23eeb17/platforms/ios.js ---------------------------------------------------------------------- diff --git a/platforms/ios.js b/platforms/ios.js index dad76d4..a39ddd4 100644 --- a/platforms/ios.js +++ b/platforms/ios.js @@ -163,9 +163,9 @@ exports.handlePlugin = function (action, project_dir, plugin_dir, plugin_et, var frameworks && frameworks.forEach(function (framework) { var src = framework.attrib['src'], weak = framework.attrib['weak']; - if (action == 'install') { var opt = { weak: (weak && weak.toLowerCase() == 'true') }; + console.log(src + ' ' + opt.weak); xcodeproj.addFramework(src, opt); } else { xcodeproj.removeFramework(src); http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/b23eeb17/test/android-one-uninstall.js ---------------------------------------------------------------------- diff --git a/test/android-one-uninstall.js b/test/android-one-uninstall.js index 927d54a..6cd557d 100644 --- a/test/android-one-uninstall.js +++ b/test/android-one-uninstall.js @@ -66,7 +66,6 @@ exports['should remove the js file'] = function (test) { plugin_loader.handlePrepare(test_project_dir, pluginsPath, wwwPath, 'android'); android.handlePlugin('uninstall', test_project_dir, test_plugin_dir, plugin_et); - console.log(fs.readdirSync(wwwPath)); test.ok(!fs.existsSync(jsPath)); test.done(); } http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/b23eeb17/test/ios-config-xml-install.js ---------------------------------------------------------------------- diff --git a/test/ios-config-xml-install.js b/test/ios-config-xml-install.js index 2a65268..215c68b 100644 --- a/test/ios-config-xml-install.js +++ b/test/ios-config-xml-install.js @@ -73,11 +73,11 @@ exports['should install webless plugin'] = function (test) { } exports['should move the js file'] = function (test) { - // run the platform-specific function var pluginsPath = path.join(test_dir, 'plugins'); - var wwwPath = path.join(test_dir, 'projects', 'ios', 'www'); + var wwwPath = path.join(test_dir, 'projects', 'ios-config-xml', 'www'); var jsPath = path.join(test_dir, 'projects', 'ios-config-xml', 'www', 'childbrowser.js'); + // run the platform-specific function ios.handlePlugin('install', test_project_dir, test_plugin_dir, plugin_et, { APP_ID: 12345 }); plugin_loader.handlePrepare(test_project_dir, pluginsPath, wwwPath, 'ios'); @@ -87,39 +87,58 @@ exports['should move the js file'] = function (test) { } exports['should move the source files'] = function (test) { + var pluginsPath = path.join(test_dir, 'plugins'); + var wwwPath = path.join(test_dir, 'projects', 'ios-config-xml', 'www'); + var preserveDirPath = path.join(srcDir, 'src', 'ios'); + // run the platform-specific function ios.handlePlugin('install', test_project_dir, test_plugin_dir, plugin_et, { APP_ID: 12345 }); - + plugin_loader.handlePrepare(test_project_dir, pluginsPath, wwwPath, 'ios'); + test.ok(fs.existsSync(srcDir + '/ChildBrowserCommand.m')) test.ok(fs.existsSync(srcDir + '/ChildBrowserViewController.m')) - test.ok(fs.existsSync(srcDir + '/preserveDirs/PreserveDirsTest.m')) + test.ok(fs.existsSync(preserveDirPath + '/preserveDirs/PreserveDirsTest.m')) test.ok(fs.existsSync(srcDir + '/targetDir/TargetDirTest.m')) test.done(); } exports['should move the header files'] = function (test) { - // run the platform-specific function - ios.handlePlugin('install', test_project_dir, test_plugin_dir, plugin_et, { APP_ID: 12345 }); + var pluginsPath = path.join(test_dir, 'plugins'); + var wwwPath = path.join(test_dir, 'projects', 'ios-config-xml', 'www'); + var preserveDirPath = path.join(srcDir, 'src', 'ios'); + // run the platform-specific function + ios.handlePlugin('install', test_project_dir, test_plugin_dir, plugin_et, { APP_ID: 12345 }); + plugin_loader.handlePrepare(test_project_dir, pluginsPath, wwwPath, 'ios'); + test.ok(fs.statSync(srcDir + '/ChildBrowserCommand.h')); test.ok(fs.statSync(srcDir + '/ChildBrowserViewController.h')); - test.ok(fs.statSync(srcDir + '/preserveDirs/PreserveDirsTest.h')); + test.ok(fs.statSync(preserveDirPath + '/preserveDirs/PreserveDirsTest.h')); test.ok(fs.statSync(srcDir + '/targetDir/TargetDirTest.h')); test.done(); } + exports['should move the xib file'] = function (test) { - // run the platform-specific function - ios.handlePlugin('install', test_project_dir, test_plugin_dir, plugin_et, { APP_ID: 12345 }); + var pluginsPath = path.join(test_dir, 'plugins'); + var wwwPath = path.join(test_dir, 'projects', 'ios-config-xml', 'www'); + // run the platform-specific function + ios.handlePlugin('install', test_project_dir, test_plugin_dir, plugin_et, { APP_ID: 12345 }); + plugin_loader.handlePrepare(test_project_dir, pluginsPath, wwwPath, 'ios'); + test.ok(fs.statSync(resDir + '/ChildBrowserViewController.xib')); test.done(); } exports['should move the bundle'] = function (test) { + var pluginsPath = path.join(test_dir, 'plugins'); + var wwwPath = path.join(test_dir, 'projects', 'ios-config-xml', 'www'); + // run the platform-specific function ios.handlePlugin('install', test_project_dir, test_plugin_dir, plugin_et, { APP_ID: 12345 }); - + plugin_loader.handlePrepare(test_project_dir, pluginsPath, wwwPath, 'ios'); + var bundle = fs.statSync(resDir + '/ChildBrowser.bundle'); test.ok(bundle.isDirectory()); @@ -128,6 +147,8 @@ exports['should move the bundle'] = function (test) { exports['should edit config.xml'] = function (test) { // setting up WebNotification (with config.xml) + var pluginsPath = path.join(test_dir, 'plugins'); + var wwwPath = path.join(test_dir, 'projects', 'ios-config-xml', 'www'); var dummy_plugin_dir = path.join(test_dir, 'plugins', 'WebNotifications') var dummy_xml_path = path.join(test_dir, 'plugins', 'WebNotifications', 'plugin.xml') @@ -136,7 +157,8 @@ exports['should edit config.xml'] = function (test) { // run the platform-specific function ios.handlePlugin('install', test_project_dir, dummy_plugin_dir, dummy_plugin_et); - + plugin_loader.handlePrepare(test_project_dir, pluginsPath, wwwPath, 'ios'); + var configXmlPath = path.join(test_project_dir, 'SampleApp', 'config.xml'); var pluginsTxt = fs.readFileSync(configXmlPath, 'utf-8'), pluginsDoc = new et.ElementTree(et.XML(pluginsTxt)), @@ -152,6 +174,8 @@ exports['should edit config.xml'] = function (test) { exports['should edit config.xml even when using old <plugins-plist> approach'] = function (test) { // setting up PGSQLitePlugin (with config.xml) + var pluginsPath = path.join(test_dir, 'plugins'); + var wwwPath = path.join(test_dir, 'projects', 'ios-config-xml', 'www'); var dummy_plugin_dir = path.join(test_dir, 'plugins', 'ChildBrowser') var dummy_xml_path = path.join(dummy_plugin_dir, 'plugin-old.xml') @@ -160,6 +184,7 @@ exports['should edit config.xml even when using old <plugins-plist> approach'] = // run the platform-specific function ios.handlePlugin('install', test_project_dir, dummy_plugin_dir, dummy_plugin_et, { APP_ID: 12345 }); + plugin_loader.handlePrepare(test_project_dir, pluginsPath, wwwPath, 'ios'); var configXmlPath = path.join(test_project_dir, 'SampleApp', 'config.xml'); var pluginsTxt = fs.readFileSync(configXmlPath, 'utf-8'), @@ -176,9 +201,13 @@ exports['should edit config.xml even when using old <plugins-plist> approach'] = } exports['should edit the pbxproj file'] = function (test) { + var pluginsPath = path.join(test_dir, 'plugins'); + var wwwPath = path.join(test_dir, 'projects', 'ios-config-xml', 'www'); + // run the platform-specific function ios.handlePlugin('install', test_project_dir, test_plugin_dir, plugin_et, { APP_ID: 12345 }); - + plugin_loader.handlePrepare(test_project_dir, pluginsPath, wwwPath, 'ios'); + var projPath = test_project_dir + '/SampleApp.xcodeproj/project.pbxproj'; obj = xcode.project(projPath).parseSync(); @@ -191,8 +220,13 @@ exports['should edit the pbxproj file'] = function (test) { } exports['should add the framework references to the pbxproj file'] = function (test) { - // run the platform-specific function + var pluginsPath = path.join(test_dir, 'plugins'); + var wwwPath = path.join(test_dir, 'projects', 'ios-config-xml', 'www'); + + // run the platform-specific function ios.handlePlugin('install', test_project_dir, test_plugin_dir, plugin_et, { APP_ID: 12345 }); + plugin_loader.handlePrepare(test_project_dir, pluginsPath, wwwPath, 'ios'); + var projPath = test_project_dir + '/SampleApp.xcodeproj/project.pbxproj', projContents = fs.readFileSync(projPath, 'utf8'), projLines = projContents.split("\n"), @@ -211,8 +245,16 @@ exports['should add the framework references to the pbxproj file'] = function (t } exports['should add the framework references with weak option to the pbxproj file'] = function (test) { + var pluginsPath = path.join(test_dir, 'plugins'); + var wwwPath = path.join(test_dir, 'projects', 'ios-config-xml', 'www'); + var dummy_plugin_dir = path.join(test_dir, 'plugins', 'ChildBrowser') + var dummy_xml_path = path.join(test_dir, 'plugins', 'ChildBrowser', 'plugin.xml') + var dummy_plugin_et = new et.ElementTree(et.XML(fs.readFileSync(dummy_xml_path, 'utf-8'))); + // run the platform-specific function - ios.handlePlugin('install', test_project_dir, test_plugin_dir, plugin_et, { APP_ID: 12345 }); + ios.handlePlugin('install', test_project_dir, dummy_plugin_dir, dummy_plugin_et, { APP_ID: 12345 }); + plugin_loader.handlePrepare(test_project_dir, pluginsPath, wwwPath, 'ios'); + var projPath = test_project_dir + '/SampleApp.xcodeproj/project.pbxproj', projContents = fs.readFileSync(projPath, 'utf8'), projLines = projContents.split("\n"), @@ -234,6 +276,7 @@ exports['should add the framework references with weak option to the pbxproj fil test.equal(non_weak_references.length, 4); test.ok(non_weak_references[0].indexOf(weak_linked) == -1); + test.done(); } http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/b23eeb17/test/plugins/ChildBrowser/plugin-old.xml ---------------------------------------------------------------------- diff --git a/test/plugins/ChildBrowser/plugin-old.xml b/test/plugins/ChildBrowser/plugin-old.xml index a3d7643..67a3a50 100644 --- a/test/plugins/ChildBrowser/plugin-old.xml +++ b/test/plugins/ChildBrowser/plugin-old.xml @@ -62,18 +62,18 @@ <plugins-plist key="com.phonegap.plugins.childbrowser" string="ChildBrowserCommand" /> - <resource-file src="ChildBrowser.bundle" /> - <resource-file src="ChildBrowserViewController.xib" /> - - <header-file src="ChildBrowserCommand.h" /> - <header-file src="ChildBrowserViewController.h" /> - <header-file src="preserveDirs/PreserveDirsTest.h" preserve-dirs="true" /> - <header-file src="TargetDirTest.h" target-dir="targetDir"/> - - <source-file src="ChildBrowserCommand.m" /> - <source-file src="ChildBrowserViewController.m" /> - <source-file src="preserveDirs/PreserveDirsTest.m" preserve-dirs="true" /> - <header-file src="TargetDirTest.m" target-dir="targetDir"/> + <resource-file src="src/ios/ChildBrowser.bundle" /> + <resource-file src="src/ios/ChildBrowserViewController.xib" /> + + <header-file src="src/ios/ChildBrowserCommand.h" /> + <header-file src="src/ios/ChildBrowserViewController.h" /> + <header-file src="src/ios/preserveDirs/PreserveDirsTest.h" preserve-dirs="true" /> + <header-file src="src/ios/TargetDirTest.h" target-dir="targetDir"/> + + <source-file src="src/ios/ChildBrowserCommand.m" /> + <source-file src="src/ios/ChildBrowserViewController.m" /> + <source-file src="src/ios/preserveDirs/PreserveDirsTest.m" preserve-dirs="true" /> + <header-file src="src/ios/TargetDirTest.m" target-dir="targetDir"/> <!-- framework for testing (not actual dependency of ChildBrowser --> <framework src="libsqlite3.dylib" /> http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/b23eeb17/test/plugins/WebNotifications/plugin.xml ---------------------------------------------------------------------- diff --git a/test/plugins/WebNotifications/plugin.xml b/test/plugins/WebNotifications/plugin.xml index 788173b..d6528a0 100644 --- a/test/plugins/WebNotifications/plugin.xml +++ b/test/plugins/WebNotifications/plugin.xml @@ -37,9 +37,9 @@ value="WebNotifications"/> </config-file> - <header-file src="WebNotifications.h" /> + <header-file src="src/ios/WebNotifications.h" /> - <source-file src="WebNotifications.m" /> + <source-file src="src/ios/WebNotifications.m" /> </platform> </plugin>
