mirror of
https://github.com/apache/cordova-android.git
synced 2026-01-30 00:05:28 +08:00
Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97ad4d84ce | ||
|
|
446202d2a9 | ||
|
|
81ed0d8d09 | ||
|
|
32ce970ee4 | ||
|
|
fe450e357c | ||
|
|
214934cc03 | ||
|
|
1c710f8459 | ||
|
|
e3430a916c | ||
|
|
ea1f041e11 | ||
|
|
0fe6d9f367 | ||
|
|
46e7359372 | ||
|
|
41cace9a96 | ||
|
|
4638331cb4 | ||
|
|
e339a7583c | ||
|
|
0b7570c9ee | ||
|
|
a85acfcfc5 | ||
|
|
3d4ccbec23 | ||
|
|
2f66ec60db | ||
|
|
f1cfe2b07b | ||
|
|
6160ca6e30 | ||
|
|
b621c3e4c4 | ||
|
|
64d2ae9ad4 | ||
|
|
39fc45b8d8 | ||
|
|
fd954adc81 | ||
|
|
8b379cbf56 | ||
|
|
59c0b04602 | ||
|
|
11b3cf3bfd | ||
|
|
9254f5a8a5 | ||
|
|
e5b68f4a3c | ||
|
|
95babc01e3 | ||
|
|
4dd792a49f | ||
|
|
207c50e500 | ||
|
|
763e34e861 | ||
|
|
b895a0c335 | ||
|
|
c5767eb545 | ||
|
|
94fb79c17f | ||
|
|
6856b02aa7 | ||
|
|
04f812c136 | ||
|
|
8783cf03b2 | ||
|
|
4e1156e083 | ||
|
|
1d6e1d416b | ||
|
|
fd02e5a07e | ||
|
|
937056fcaf | ||
|
|
41ed18684d | ||
|
|
96d4a22215 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -14,11 +14,16 @@ framework/assets/www/.DS_Store
|
||||
framework/assets/www/cordova-*.js
|
||||
framework/assets/www/phonegap-*.js
|
||||
framework/libs
|
||||
framework/javadoc-public
|
||||
framework/javadoc-private
|
||||
test/libs
|
||||
example
|
||||
./test
|
||||
test/bin
|
||||
test/assets/www/.tmp*
|
||||
test/assets/www/cordova.js
|
||||
test/cordova/plugins/org.apache.cordova.device/www/device.js
|
||||
test/cordova/plugins/org.apache.cordova.device/src/android/Device.java
|
||||
tmp/**
|
||||
.metadata
|
||||
tmp/**/*
|
||||
|
||||
@@ -20,6 +20,88 @@
|
||||
-->
|
||||
## Release Notes for Cordova (Android) ##
|
||||
|
||||
### 3.3.0 (Dec 2013) ###
|
||||
|
||||
44 commits by 11 authors, Changes include:
|
||||
|
||||
* Set VERSION to 3.3.0 (via coho)
|
||||
* Update JS snapshot to version 3.3.0 (via coho)
|
||||
* CB-5481 Fix for Cordova trying to get config.xml from the wrong namespace
|
||||
* Forgot Apache Headers on MessageTest
|
||||
* Set VERSION to 3.3.0-rc1 (via coho)
|
||||
* Update JS snapshot to version 3.3.0-rc1 (via coho)
|
||||
* prevent ClassNotFound exception for emtpy class name
|
||||
* CB-5487: Remote Debugging is on when your Android app is debuggable.
|
||||
* Updating the README
|
||||
* Making the object less chatty
|
||||
* Updating tests to KitKat, and making the tests more thread-safe
|
||||
* Incrementing API target
|
||||
* CB-5445: Adding onScrollChanged and the ScrollEvent object. (Forgot to add the WebView)
|
||||
* CB-5445: Adding onScrollChanged and the ScrollEvent object
|
||||
* Updated CordovaWebView to experiment with onScrollChanged messages
|
||||
* Moving the console.log out of run() method
|
||||
* CB-5422: Don't require JAVA_HOME to be defined
|
||||
* Thanks for Benn Mapes for making this process easy. Updating the Android API level.
|
||||
* CB-5490: add javadoc target to ant script
|
||||
* CB-5471: add deprecation javadoc/annotation
|
||||
* Add javadoc comments to source classes
|
||||
* CB-5255: Checking in the Google Check, TODO: Add Amazon FireOS check
|
||||
* CB-5232 Change create script to use Cordova as a library.
|
||||
* Remove Application settings from framework/AndroidManifest.xml
|
||||
* CB-5346: remove dependency on device plugin
|
||||
* CB-5346: delete a stale file that isn't needed
|
||||
* Updating instructions to indicate that the device plugin is required to be installed via plugman
|
||||
* Fixing plugins configuration, Device shouldn't be checked in here
|
||||
* Removing device plugin
|
||||
* Removing the plugins directory after the plugins were incorrectly removed
|
||||
* This should use plugman to install plugins. Adding path depenencies for plugins is wrong, and shouldn't be done
|
||||
* CB-5349: fixed regression in update script
|
||||
* CB-5346 Fix and cleanup broken Android unit test
|
||||
* CB-5307 Remove references to Callback and Incubator
|
||||
* CB-5302: Massive movement to get tests working again
|
||||
* Set VERSION to 3.3.0-dev (via coho)
|
||||
* CB-5301 add missing license headers
|
||||
* [CB-4996] Fix paths with spaces while launching on emulator and device
|
||||
* CB-5284 Fixing the version from coho
|
||||
* Fixing the VERSION file, it got auto-incremented by coho by accident
|
||||
* Update JS snapshot to version 2.10.0-dev (via coho)
|
||||
* Set VERSION to 2.10.0-dev (via coho)
|
||||
* CB-5209 Win: Cannot build Android app if project path contains spaces
|
||||
* CB-5209: Dirty, Dirty Fix for Building. This works, but needs to be prettier.
|
||||
|
||||
### 3.2.0 (Nov 2013) ####
|
||||
|
||||
27 commits by 7 authors, Changes include:
|
||||
|
||||
Set VERSION to 3.2.0 (via coho)
|
||||
* Update JS snapshot to version 3.2.0 (via coho)
|
||||
* CB-5301 add missing license headers
|
||||
* CB-5349: fixed regression in update script
|
||||
* Set VERSION to 3.2.0-rc1 (via coho)
|
||||
* Update JS snapshot to version 3.2.0-rc1 (via coho)
|
||||
* CB-5193 Fix Android WebSQL sometime throwing SECURITY_ERR.
|
||||
* CB-5191 Deprecate <url-filter>
|
||||
* Updating shelljs to 0.2.6. Copy now preserves mode bits.
|
||||
* CB-4872 - moved version script to promise model
|
||||
* CB-4872 - make sure to copy over version scripts to project
|
||||
* [CB-4872] - added android version scripts
|
||||
* CB-5117: Output confirmation message if check_reqs passes.
|
||||
* Refactoring Android project-level and platform scripts to use Q.js
|
||||
* Updating to latest shelljs, old version doesn't preserve +x bits
|
||||
* Remove cordova.xml fallback from Config.java (it was removed from PluginManager for 3.0)
|
||||
* CB-5080 Find resources in a way that works with aapt's --rename-manifest-package
|
||||
* Update JS snapshot to version 3.2.0-dev (via coho)
|
||||
* Remove a couple incorrect lines from RELEASENOTES.md
|
||||
* CB-4961: shell.js returns the full path on ls, rebuilding the full path isn't really needed
|
||||
* Updating README.md to have latest Android SDK
|
||||
* CB-4527: This was an easy fix, since the script deletes batch files
|
||||
* [CB-4892] Fix create script only escaping the first space instead of all spaces.
|
||||
* Fix update script to clobber cordova.js file (missing -f)
|
||||
* Add missing copyright header for Whitelist.java.
|
||||
* [CB-4832] Add 3.1.0 RELEASENOTES.md
|
||||
* Update JS snapshot to version 3.2.0-dev (via coho)
|
||||
* Set VERSION to 3.2.0-dev (via coho)
|
||||
|
||||
### 3.1.0 (Sept 2013) ###
|
||||
|
||||
55 commits from 9 authors. Highlights include:
|
||||
|
||||
@@ -21,8 +21,11 @@
|
||||
|
||||
var check_reqs = require('./lib/check_reqs');
|
||||
|
||||
check_reqs.run().done(null, function(err) {
|
||||
console.log(err);
|
||||
process.exit(2);
|
||||
});
|
||||
|
||||
check_reqs.run().done(
|
||||
function success() {
|
||||
console.log('Looks like your environment fully supports cordova-android development!');
|
||||
}, function fail(err) {
|
||||
console.log(err);
|
||||
process.exit(2);
|
||||
}
|
||||
);
|
||||
|
||||
17
bin/create
17
bin/create
@@ -20,20 +20,17 @@
|
||||
*/
|
||||
var path = require('path');
|
||||
var create = require('./lib/create');
|
||||
var args = process.argv;
|
||||
var args = require('./lib/simpleargs').getArgs(process.argv);
|
||||
|
||||
// Support basic help commands
|
||||
if(args.length < 3 || (args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
|
||||
args[2] == 'help' || args[2] == '-help' || args[2] == '/help')) {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'create')) + ' <path_to_new_project> <package_name> <project_name>');
|
||||
if (args['--help'] || args._.length === 0) {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'create')) + ' <path_to_new_project> <package_name> <project_name> [<template_path>] [--shared]');
|
||||
console.log(' <path_to_new_project>: Path to your new Cordova Android project');
|
||||
console.log(' <package_name>: Package name, following reverse-domain style convention');
|
||||
console.log(' <project_name>: Project name');
|
||||
console.log(' <template_path>: Path to a custom application template to use');
|
||||
console.log(' --shared will use the CordovaLib project directly instead of making a copy.');
|
||||
process.exit(1);
|
||||
} else {
|
||||
create.createProject(args[2], args[3], args[4], args[5]).done(null, function(err) {
|
||||
console.error(err);
|
||||
process.exit(2);
|
||||
});
|
||||
}
|
||||
|
||||
create.createProject(args._[0], args._[1], args._[2], args._[3], args['--shared']).done();
|
||||
|
||||
|
||||
@@ -33,8 +33,10 @@ module.exports.get_target = function() {
|
||||
return target.split('=')[1].replace('\n', '').replace('\r', '').replace(' ', '');
|
||||
} else if (fs.existsSync(path.join(ROOT, 'project.properties'))) {
|
||||
// if no target found, we're probably in a project and project.properties is in ROOT.
|
||||
var target = shell.grep(/target=android-[\d+]/, path.join(ROOT, 'project.properties'));
|
||||
return target.split('=')[1].replace('\n', '').replace('\r', '').replace(' ', '');
|
||||
// this is called on the project itself, and can support Google APIs AND Vanilla Android
|
||||
var target = shell.grep(/target=android-[\d+]/, path.join(ROOT, 'project.properties')) ||
|
||||
shell.grep(/target=Google Inc.:Google APIs:[\d+]/, path.join(ROOT, 'project.properties'));
|
||||
return target.split('=')[1].replace('\n', '').replace('\r', '');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,16 +52,18 @@ module.exports.check_ant = function() {
|
||||
|
||||
// Returns a promise.
|
||||
module.exports.check_java = function() {
|
||||
if(process.env.JAVA_HOME) {
|
||||
var d = Q.defer();
|
||||
child_process.exec('java -version', function(err, stdout, stderr) {
|
||||
if(err) d.reject(new Error('ERROR : executing command \'java\', make sure you java environment is set up. Including your JDK and JRE.' + err));
|
||||
else d.resolve();
|
||||
});
|
||||
return d.promise;
|
||||
} else {
|
||||
return Q.reject(new Error('ERROR : Make sure JAVA_HOME is set, as well as paths to your JDK and JRE for java.'));
|
||||
}
|
||||
var d = Q.defer();
|
||||
child_process.exec('java -version', function(err, stdout, stderr) {
|
||||
if(err) {
|
||||
var msg =
|
||||
'Failed to run \'java -version\', make sure your java environment is set up\n' +
|
||||
'including JDK and JRE.\n' +
|
||||
'Your JAVA_HOME variable is ' + process.env.JAVA_HOME + '\n';
|
||||
d.reject(new Error(msg + err));
|
||||
}
|
||||
else d.resolve();
|
||||
});
|
||||
return d.promise;
|
||||
}
|
||||
|
||||
// Returns a promise.
|
||||
@@ -87,8 +91,6 @@ module.exports.check_android = function() {
|
||||
|
||||
// Returns a promise.
|
||||
module.exports.run = function() {
|
||||
return Q.all([this.check_ant(), this.check_java(), this.check_android()]).then(function() {
|
||||
console.log('Looks like your environment fully supports cordova-android development!');
|
||||
});
|
||||
return Q.all([this.check_ant(), this.check_java(), this.check_android()]);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,14 +29,13 @@ var shell = require('shelljs'),
|
||||
// Returns a promise.
|
||||
function exec(command, opt_cwd) {
|
||||
var d = Q.defer();
|
||||
try {
|
||||
child_process.exec(command, { cwd: opt_cwd }, function(err, stdout, stderr) {
|
||||
if (err) d.reject(err);
|
||||
else d.resolve(stdout);
|
||||
});
|
||||
} catch(e) {
|
||||
return Q.reject('Command error on execution: ' + command + '\n' + e);
|
||||
}
|
||||
console.log('Running: ' + command);
|
||||
child_process.exec(command, { cwd: opt_cwd }, function(err, stdout, stderr) {
|
||||
stdout && console.log(stdout);
|
||||
stderr && console.error(stderr);
|
||||
if (err) d.reject(err);
|
||||
else d.resolve(stdout);
|
||||
});
|
||||
return d.promise;
|
||||
}
|
||||
|
||||
@@ -47,32 +46,45 @@ function setShellFatal(value, func) {
|
||||
shell.config.fatal = oldVal;
|
||||
}
|
||||
|
||||
// Returns a promise.
|
||||
function ensureJarIsBuilt(version, target_api) {
|
||||
var isDevVersion = /-dev$/.test(version);
|
||||
if (isDevVersion || !fs.existsSync(path.join(ROOT, 'framework', 'cordova-' + version + '.jar')) && fs.existsSync(path.join(ROOT, 'framework'))) {
|
||||
var valid_target = check_reqs.get_target();
|
||||
console.log('Building cordova-' + version + '.jar');
|
||||
// update the cordova-android framework for the desired target
|
||||
return exec('android --silent update lib-project --target "' + target_api + '" --path "' + path.join(ROOT, 'framework') + '"')
|
||||
.then(function() {
|
||||
// compile cordova.js and cordova.jar
|
||||
return exec('ant jar', path.join(ROOT, 'framework'));
|
||||
});
|
||||
}
|
||||
return Q();
|
||||
function getFrameworkDir(projectPath, shared) {
|
||||
return shared ? path.join(ROOT, 'framework') : path.join(projectPath, 'CordovaLib');
|
||||
}
|
||||
|
||||
function copyJsAndJar(projectPath, version) {
|
||||
function copyJsAndLibrary(projectPath, shared, projectName) {
|
||||
var nestedCordovaLibPath = getFrameworkDir(projectPath, false);
|
||||
shell.cp('-f', path.join(ROOT, 'framework', 'assets', 'www', 'cordova.js'), path.join(projectPath, 'assets', 'www', 'cordova.js'));
|
||||
// Don't fail if there are no old jars.
|
||||
setShellFatal(false, function() {
|
||||
shell.ls(path.join(projectPath, 'libs', 'cordova-*.jar')).forEach(function(oldJar) {
|
||||
console.log("Deleting " + oldJar);
|
||||
shell.rm('-f', path.join(oldJar));
|
||||
shell.rm('-f', oldJar);
|
||||
});
|
||||
// Delete old library project if it existed.
|
||||
if (shared) {
|
||||
shell.rm('-rf', nestedCordovaLibPath);
|
||||
} else {
|
||||
// Delete only the src, since eclipse can't handle its .project file being deleted.
|
||||
shell.rm('-rf', path.join(nestedCordovaLibPath, 'src'));
|
||||
}
|
||||
});
|
||||
shell.cp('-f', path.join(ROOT, 'framework', 'cordova-' + version + '.jar'), path.join(projectPath, 'libs', 'cordova-' + version + '.jar'));
|
||||
if (!shared) {
|
||||
shell.mkdir('-p', nestedCordovaLibPath);
|
||||
shell.cp('-f', path.join(ROOT, 'framework', 'AndroidManifest.xml'), nestedCordovaLibPath);
|
||||
shell.cp('-f', path.join(ROOT, 'framework', 'project.properties'), nestedCordovaLibPath);
|
||||
shell.cp('-r', path.join(ROOT, 'framework', 'src'), nestedCordovaLibPath);
|
||||
// Create an eclipse project file and set the name of it to something unique.
|
||||
// Without this, you can't import multiple CordovaLib projects into the same workspace.
|
||||
var eclipseProjectFilePath = path.join(nestedCordovaLibPath, '.project');
|
||||
if (!fs.existsSync(eclipseProjectFilePath)) {
|
||||
var data = '<?xml version="1.0" encoding="UTF-8"?><projectDescription><name>' + projectName + '-' + 'CordovaLib</name></projectDescription>';
|
||||
fs.writeFileSync(eclipseProjectFilePath, data, 'utf8');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function runAndroidUpdate(projectPath, target_api, shared) {
|
||||
var targetFrameworkDir = getFrameworkDir(projectPath, shared);
|
||||
return exec('android update project --subprojects --path "' + projectPath + '" --target ' + target_api + ' --library "' + path.relative(projectPath, targetFrameworkDir) + '"');
|
||||
}
|
||||
|
||||
function copyScripts(projectPath) {
|
||||
@@ -104,7 +116,7 @@ function copyScripts(projectPath) {
|
||||
* Returns a promise.
|
||||
*/
|
||||
|
||||
exports.createProject = function(project_path, package_name, project_name, project_template_dir) {
|
||||
exports.createProject = function(project_path, package_name, project_name, project_template_dir, use_shared_project) {
|
||||
var VERSION = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
|
||||
|
||||
// Set default values for path, package and name
|
||||
@@ -142,9 +154,6 @@ exports.createProject = function(project_path, package_name, project_name, proje
|
||||
console.log('\tName: ' + project_name);
|
||||
console.log('\tAndroid target: ' + target_api);
|
||||
|
||||
// build from source. distro should have these files
|
||||
return ensureJarIsBuilt(VERSION, target_api);
|
||||
}).then(function() {
|
||||
console.log('Copying template files...');
|
||||
|
||||
setShellFatal(true, function() {
|
||||
@@ -156,7 +165,7 @@ exports.createProject = function(project_path, package_name, project_name, proje
|
||||
|
||||
// copy cordova.js, cordova.jar and res/xml
|
||||
shell.cp('-r', path.join(ROOT, 'framework', 'res', 'xml'), path.join(project_path, 'res'));
|
||||
copyJsAndJar(project_path, VERSION);
|
||||
copyJsAndLibrary(project_path, use_shared_project, safe_activity_name);
|
||||
|
||||
// interpolate the activity name and package
|
||||
shell.mkdir('-p', activity_dir);
|
||||
@@ -172,8 +181,7 @@ exports.createProject = function(project_path, package_name, project_name, proje
|
||||
copyScripts(project_path);
|
||||
});
|
||||
// Link it to local android install.
|
||||
console.log('Running "android update project"');
|
||||
return exec('android --silent update project --target "'+target_api+'" --path "'+ project_path+'"');
|
||||
return runAndroidUpdate(project_path, target_api, use_shared_project);
|
||||
}).then(function() {
|
||||
console.log('Project successfully created.');
|
||||
});
|
||||
@@ -181,16 +189,17 @@ exports.createProject = function(project_path, package_name, project_name, proje
|
||||
|
||||
// Returns a promise.
|
||||
exports.updateProject = function(projectPath) {
|
||||
var version = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
|
||||
// Check that requirements are met and proper targets are installed
|
||||
return check_reqs.run()
|
||||
.then(function() {
|
||||
var version = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
|
||||
var target_api = check_reqs.get_target();
|
||||
return ensureJarIsBuilt(version, target_api);
|
||||
}).then(function() {
|
||||
copyJsAndJar(projectPath, version);
|
||||
copyJsAndLibrary(projectPath, false, null);
|
||||
copyScripts(projectPath);
|
||||
console.log('Android project is now at version ' + version);
|
||||
return runAndroidUpdate(projectPath, target_api, false)
|
||||
.then(function() {
|
||||
console.log('Android project is now at version ' + version);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
32
bin/lib/simpleargs.js
Normal file
32
bin/lib/simpleargs.js
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
exports.getArgs = function(argv) {
|
||||
var ret = {};
|
||||
var posArgs = [];
|
||||
for (var i = 2, arg; arg = argv[i] || i < argv.length; ++i) {
|
||||
if (/^--/.exec(arg)) {
|
||||
ret[arg] = true;
|
||||
} else {
|
||||
posArgs.push(arg);
|
||||
}
|
||||
}
|
||||
ret._ = posArgs;
|
||||
return ret;
|
||||
};
|
||||
@@ -5,9 +5,9 @@
|
||||
:: 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
|
||||
@@ -18,7 +18,7 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0build"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: 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
|
||||
@@ -18,7 +18,7 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0clean"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'clean' script in 'cordova' folder, aborting...>&2
|
||||
|
||||
4
bin/templates/cordova/lib/build.js
vendored
4
bin/templates/cordova/lib/build.js
vendored
@@ -37,10 +37,10 @@ module.exports.run = function(build_type) {
|
||||
var cmd;
|
||||
switch(build_type) {
|
||||
case '--debug' :
|
||||
cmd = 'ant debug -f ' + path.join(ROOT, 'build.xml');
|
||||
cmd = 'ant debug -f "' + path.join(ROOT, 'build.xml') + '"';
|
||||
break;
|
||||
case '--release' :
|
||||
cmd = 'ant release -f ' + path.join(ROOT, 'build.xml');
|
||||
cmd = 'ant release -f "' + path.join(ROOT, 'build.xml') + '"';
|
||||
break;
|
||||
case '--nobuild' :
|
||||
console.log('Skipping build...');
|
||||
|
||||
2
bin/templates/cordova/lib/clean.js
vendored
2
bin/templates/cordova/lib/clean.js
vendored
@@ -28,7 +28,7 @@ var exec = require('./exec'),
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.run = function() {
|
||||
return exec('ant clean -f ' + path.join(ROOT, 'build.xml'));
|
||||
return exec('ant clean -f "' + path.join(ROOT, 'build.xml') + '"');
|
||||
}
|
||||
|
||||
module.exports.help = function() {
|
||||
|
||||
2
bin/templates/cordova/lib/device.js
vendored
2
bin/templates/cordova/lib/device.js
vendored
@@ -64,7 +64,7 @@ module.exports.install = function(target) {
|
||||
var apk_path = build.get_apk();
|
||||
launchName = appinfo.getActivityName();
|
||||
console.log('Installing app on device...');
|
||||
var cmd = 'adb -s ' + target + ' install -r ' + apk_path;
|
||||
var cmd = 'adb -s ' + target + ' install -r "' + apk_path + '"';
|
||||
return exec(cmd);
|
||||
}).then(function(output) {
|
||||
if (output.match(/Failure/)) return Q.reject('ERROR: Failed to install apk to device: ' + output);
|
||||
|
||||
2
bin/templates/cordova/lib/emulator.js
vendored
2
bin/templates/cordova/lib/emulator.js
vendored
@@ -305,7 +305,7 @@ module.exports.install = function(target) {
|
||||
|
||||
console.log('Installing app on emulator...');
|
||||
var apk_path = build.get_apk();
|
||||
return exec('adb -s ' + target + ' install -r ' + apk_path);
|
||||
return exec('adb -s ' + target + ' install -r "' + apk_path + '"');
|
||||
}).then(function(output) {
|
||||
if (output.match(/Failure/)) {
|
||||
return Q.reject('Failed to install apk to emulator: ' + output);
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: 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
|
||||
@@ -18,7 +18,7 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0log"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'log' script in 'cordova' folder, aborting...>&2
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: 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
|
||||
@@ -18,7 +18,7 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0run"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'run' script in 'cordova' folder, aborting...>&2
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
*/
|
||||
|
||||
// Coho updates this line:
|
||||
var VERSION = "3.2.0-dev";
|
||||
var VERSION = "3.3.0";
|
||||
|
||||
console.log(VERSION);
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
:: 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
|
||||
@@ -18,7 +18,7 @@
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0version"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
node %script_path% %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'version' script in 'cordova' folder, aborting...>&2
|
||||
|
||||
15
bin/update
15
bin/update
@@ -19,18 +19,13 @@
|
||||
under the License.
|
||||
*/
|
||||
var path = require('path');
|
||||
var args = process.argv;
|
||||
var create = require('./lib/create');
|
||||
var args = require('./lib/simpleargs').getArgs(process.argv);
|
||||
|
||||
// Support basic help commands
|
||||
if(args.length < 3 || (args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
|
||||
args[2] == 'help' || args[2] == '-help' || args[2] == '/help')) {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'update')) + ' <path_to_project>');
|
||||
if (args['--help'] || args._.length === 0) {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'update')) + ' <path_to_project> [--shared]');
|
||||
console.log(' --shared will use the CordovaLib project directly instead of making a copy.');
|
||||
process.exit(1);
|
||||
} else {
|
||||
create.updateProject(args[2]).done(null, function(err) {
|
||||
console.error(err);
|
||||
process.exit(2);
|
||||
});
|
||||
}
|
||||
create.updateProject(args._[0], args['--shared']).done();
|
||||
|
||||
|
||||
@@ -17,43 +17,7 @@
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:windowSoftInputMode="adjustPan"
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.apache.cordova" android:versionName="1.0" android:versionCode="1">
|
||||
<supports-screens
|
||||
android:largeScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:smallScreens="true"
|
||||
android:resizeable="true"
|
||||
android:anyDensity="true"
|
||||
/>
|
||||
<!-- android:xlargeScreens="true" screen supported only after Android-9 -->
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_SMS" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.RECORD_VIDEO"/>
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
|
||||
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
<uses-feature android:name="android.hardware.camera.autofocus" />
|
||||
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name"
|
||||
android:debuggable="true">
|
||||
<activity android:name="org.apache.cordova.DroidGap" android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
<uses-sdk android:minSdkVersion="8" />
|
||||
</manifest>
|
||||
|
||||
40
framework/assets/www/cordova.js
vendored
40
framework/assets/www/cordova.js
vendored
@@ -1,5 +1,5 @@
|
||||
// Platform: android
|
||||
// 3.2.0-dev-5ad41a7
|
||||
// 3.3.0
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
@@ -19,7 +19,7 @@
|
||||
under the License.
|
||||
*/
|
||||
;(function() {
|
||||
var CORDOVA_JS_BUILD_LABEL = '3.2.0-dev-5ad41a7';
|
||||
var CORDOVA_JS_BUILD_LABEL = '3.3.0';
|
||||
// file: lib/scripts/require.js
|
||||
|
||||
/*jshint -W079 */
|
||||
@@ -34,7 +34,7 @@ var require,
|
||||
requireStack = [],
|
||||
// Map of module ID -> index into requireStack of modules currently being built.
|
||||
inProgressModules = {},
|
||||
SEPERATOR = ".";
|
||||
SEPARATOR = ".";
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ var require,
|
||||
var resultantId = id;
|
||||
//Its a relative path, so lop off the last portion and add the id (minus "./")
|
||||
if (id.charAt(0) === ".") {
|
||||
resultantId = module.id.slice(0, module.id.lastIndexOf(SEPERATOR)) + SEPERATOR + id.slice(2);
|
||||
resultantId = module.id.slice(0, module.id.lastIndexOf(SEPARATOR)) + SEPARATOR + id.slice(2);
|
||||
}
|
||||
return require(resultantId);
|
||||
};
|
||||
@@ -552,7 +552,7 @@ function include(parent, objects, clobber, merge) {
|
||||
include(result, obj.children, clobber, merge);
|
||||
}
|
||||
} catch(e) {
|
||||
utils.alert('Exception building cordova JS globals: ' + e + ' for key "' + key + '"');
|
||||
utils.alert('Exception building Cordova JS globals: ' + e + ' for key "' + key + '"');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1074,6 +1074,36 @@ module.exports = androidExec;
|
||||
|
||||
});
|
||||
|
||||
// file: lib/common/exec/proxy.js
|
||||
define("cordova/exec/proxy", function(require, exports, module) {
|
||||
|
||||
|
||||
// internal map of proxy function
|
||||
var CommandProxyMap = {};
|
||||
|
||||
module.exports = {
|
||||
|
||||
// example: cordova.commandProxy.add("Accelerometer",{getCurrentAcceleration: function(successCallback, errorCallback, options) {...},...);
|
||||
add:function(id,proxyObj) {
|
||||
console.log("adding proxy for " + id);
|
||||
CommandProxyMap[id] = proxyObj;
|
||||
return proxyObj;
|
||||
},
|
||||
|
||||
// cordova.commandProxy.remove("Accelerometer");
|
||||
remove:function(id) {
|
||||
var proxy = CommandProxyMap[id];
|
||||
delete CommandProxyMap[id];
|
||||
CommandProxyMap[id] = null;
|
||||
return proxy;
|
||||
},
|
||||
|
||||
get:function(service,action) {
|
||||
return ( CommandProxyMap[service] ? CommandProxyMap[service][action] : null );
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// file: lib/common/init.js
|
||||
define("cordova/init", function(require, exports, module) {
|
||||
|
||||
|
||||
@@ -95,6 +95,13 @@
|
||||
<target name="-post-compile">
|
||||
</target>
|
||||
-->
|
||||
<target name="-pre-clean">
|
||||
<!-- delete generated javadoc -->
|
||||
<delete dir="javadoc-public" failonerror="false" />
|
||||
<delete dir="javadoc-private" failonerror="false" />
|
||||
<!-- delete generated jar -->
|
||||
<delete file="cordova-${version}.jar" failonerror="false" />
|
||||
</target>
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
@@ -120,7 +127,31 @@
|
||||
that includes all JavaScript code.
|
||||
-->
|
||||
<target name="jar" depends="-compile">
|
||||
<jar jarfile="cordova-${version}.jar" basedir="bin/classes" excludes="org/apache/cordova/R.class,org/apache/cordova/R$*.class"/>
|
||||
<jar
|
||||
basedir="bin/classes"
|
||||
excludes="org/apache/cordova/R.class,org/apache/cordova/R$*.class"
|
||||
jarfile="cordova-${version}.jar" />
|
||||
</target>
|
||||
|
||||
<target name="javadoc">
|
||||
<delete dir="javadoc-public" failonerror="false" />
|
||||
<javadoc
|
||||
access="public"
|
||||
destdir="javadoc-public"
|
||||
classpath="${sdk.dir}/platforms/${target}/android.jar">
|
||||
<packageset dir="src">
|
||||
<include name="org/apache/cordova/**" />
|
||||
</packageset>
|
||||
</javadoc>
|
||||
<delete dir="javadoc-private" failonerror="false" />
|
||||
<javadoc
|
||||
access="private"
|
||||
destdir="javadoc-private"
|
||||
classpath="${sdk.dir}/platforms/${target}/android.jar">
|
||||
<packageset dir="src">
|
||||
<include name="org/apache/cordova/**" />
|
||||
</packageset>
|
||||
</javadoc>
|
||||
</target>
|
||||
|
||||
<!-- tests for Java files -->
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
# Indicates whether an apk should be generated for each density.
|
||||
split.density=false
|
||||
# Project target.
|
||||
target=android-18
|
||||
target=android-19
|
||||
apk-configurations=
|
||||
renderscript.opt.level=O0
|
||||
android.library=true
|
||||
|
||||
@@ -68,10 +68,15 @@ public class Config {
|
||||
return;
|
||||
}
|
||||
|
||||
// First checking the class namespace for config.xml
|
||||
int id = action.getResources().getIdentifier("config", "xml", action.getClass().getPackage().getName());
|
||||
if (id == 0) {
|
||||
LOG.i("CordovaLog", "config.xml missing. Ignoring...");
|
||||
return;
|
||||
// If we couldn't find config.xml there, we'll look in the namespace from AndroidManifest.xml
|
||||
id = action.getResources().getIdentifier("config", "xml", action.getPackageName());
|
||||
if (id == 0) {
|
||||
LOG.i("CordovaLog", "config.xml missing. Ignoring...");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Add implicitly allowed URLs
|
||||
@@ -208,7 +213,7 @@ public class Config {
|
||||
* Determine if URL is in approved list of URLs to load.
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
* @return true if whitelisted
|
||||
*/
|
||||
public static boolean isUrlWhiteListed(String url) {
|
||||
if (self == null) {
|
||||
|
||||
@@ -63,13 +63,14 @@ import android.widget.LinearLayout;
|
||||
* html file that contains the application.
|
||||
*
|
||||
* As an example:
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
* package org.apache.cordova.examples;
|
||||
* import android.os.Bundle;
|
||||
* import org.apache.cordova.*;
|
||||
*
|
||||
* public class Example extends CordovaActivity {
|
||||
* @Override
|
||||
* @Override
|
||||
* public void onCreate(Bundle savedInstanceState) {
|
||||
* super.onCreate(savedInstanceState);
|
||||
*
|
||||
@@ -85,9 +86,11 @@ import android.widget.LinearLayout;
|
||||
* super.loadUrl("file:///android_asset/www/index.html", 3000); // show splash screen 3 sec before loading app
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* Properties: The application can be configured using the following properties:
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
* // Display a native loading dialog when loading app. Format for value = "Title,Message".
|
||||
* // (String - default=null)
|
||||
* super.setStringProperty("loadingDialog", "Wait,Loading Demo...");
|
||||
@@ -114,15 +117,19 @@ import android.widget.LinearLayout;
|
||||
*
|
||||
* // Enable app to keep running in background. (Boolean - default=true)
|
||||
* super.setBooleanProperty("keepRunning", false);
|
||||
* </pre>
|
||||
*
|
||||
* Cordova.xml configuration:
|
||||
*
|
||||
* <pre>
|
||||
* Cordova uses a configuration file at res/xml/cordova.xml to specify the following settings.
|
||||
*
|
||||
* Approved list of URLs that can be loaded into Cordova
|
||||
* <access origin="http://server regexp" subdomains="true" />
|
||||
* <access origin="http://server regexp" subdomains="true" />
|
||||
* Log level: ERROR, WARN, INFO, DEBUG, VERBOSE (default=ERROR)
|
||||
* <log level="DEBUG" />
|
||||
*
|
||||
* <log level="DEBUG" />
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
public class CordovaActivity extends Activity implements CordovaInterface {
|
||||
public static String TAG = "CordovaActivity";
|
||||
@@ -291,7 +298,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
|
||||
/**
|
||||
* Get the Android activity.
|
||||
*
|
||||
* @return
|
||||
* @return the Activity
|
||||
*/
|
||||
public Activity getActivity() {
|
||||
return this;
|
||||
@@ -544,7 +551,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
|
||||
*
|
||||
* @param name
|
||||
* @param defaultValue
|
||||
* @return
|
||||
* @return the boolean value of the named property
|
||||
*/
|
||||
public boolean getBooleanProperty(String name, boolean defaultValue) {
|
||||
Bundle bundle = this.getIntent().getExtras();
|
||||
@@ -575,7 +582,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
|
||||
*
|
||||
* @param name
|
||||
* @param defaultValue
|
||||
* @return
|
||||
* @return the int value for the named property
|
||||
*/
|
||||
public int getIntegerProperty(String name, int defaultValue) {
|
||||
Bundle bundle = this.getIntent().getExtras();
|
||||
@@ -600,7 +607,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
|
||||
*
|
||||
* @param name
|
||||
* @param defaultValue
|
||||
* @return
|
||||
* @return the String value for the named property
|
||||
*/
|
||||
public String getStringProperty(String name, String defaultValue) {
|
||||
Bundle bundle = this.getIntent().getExtras();
|
||||
@@ -620,7 +627,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
|
||||
*
|
||||
* @param name
|
||||
* @param defaultValue
|
||||
* @return
|
||||
* @return the double value for the named property
|
||||
*/
|
||||
public double getDoubleProperty(String name, double defaultValue) {
|
||||
Bundle bundle = this.getIntent().getExtras();
|
||||
@@ -642,10 +649,14 @@ public class CordovaActivity extends Activity implements CordovaInterface {
|
||||
|
||||
/**
|
||||
* Set boolean property on activity.
|
||||
* This method has been deprecated in 3.0 and will be removed at a future
|
||||
* time. Please use config.xml instead.
|
||||
*
|
||||
* @param name
|
||||
* @param value
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public void setBooleanProperty(String name, boolean value) {
|
||||
Log.d(TAG, "Setting boolean properties in CordovaActivity will be deprecated in 3.0 on July 2013, please use config.xml");
|
||||
this.getIntent().putExtra(name.toLowerCase(), value);
|
||||
@@ -653,10 +664,14 @@ public class CordovaActivity extends Activity implements CordovaInterface {
|
||||
|
||||
/**
|
||||
* Set int property on activity.
|
||||
* This method has been deprecated in 3.0 and will be removed at a future
|
||||
* time. Please use config.xml instead.
|
||||
*
|
||||
* @param name
|
||||
* @param value
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public void setIntegerProperty(String name, int value) {
|
||||
Log.d(TAG, "Setting integer properties in CordovaActivity will be deprecated in 3.0 on July 2013, please use config.xml");
|
||||
this.getIntent().putExtra(name.toLowerCase(), value);
|
||||
@@ -664,10 +679,14 @@ public class CordovaActivity extends Activity implements CordovaInterface {
|
||||
|
||||
/**
|
||||
* Set string property on activity.
|
||||
* This method has been deprecated in 3.0 and will be removed at a future
|
||||
* time. Please use config.xml instead.
|
||||
*
|
||||
* @param name
|
||||
* @param value
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public void setStringProperty(String name, String value) {
|
||||
Log.d(TAG, "Setting string properties in CordovaActivity will be deprecated in 3.0 on July 2013, please use config.xml");
|
||||
this.getIntent().putExtra(name.toLowerCase(), value);
|
||||
@@ -675,10 +694,14 @@ public class CordovaActivity extends Activity implements CordovaInterface {
|
||||
|
||||
/**
|
||||
* Set double property on activity.
|
||||
* This method has been deprecated in 3.0 and will be removed at a future
|
||||
* time. Please use config.xml instead.
|
||||
*
|
||||
* @param name
|
||||
* @param value
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public void setDoubleProperty(String name, double value) {
|
||||
Log.d(TAG, "Setting double properties in CordovaActivity will be deprecated in 3.0 on July 2013, please use config.xml");
|
||||
this.getIntent().putExtra(name.toLowerCase(), value);
|
||||
@@ -799,6 +822,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
|
||||
* @param serviceType
|
||||
* @param className
|
||||
*/
|
||||
@Deprecated
|
||||
public void addService(String serviceType, String className) {
|
||||
if (this.appView != null && this.appView.pluginManager != null) {
|
||||
this.appView.pluginManager.addService(serviceType, className);
|
||||
@@ -997,7 +1021,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
|
||||
* Determine if URL is in approved list of URLs to load.
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
* @return true if the url is whitelisted
|
||||
*/
|
||||
public boolean isUrlWhiteListed(String url) {
|
||||
return Config.isUrlWhiteListed(url);
|
||||
@@ -1028,8 +1052,10 @@ public class CordovaActivity extends Activity implements CordovaInterface {
|
||||
/**
|
||||
* Get Activity context.
|
||||
*
|
||||
* @return
|
||||
* @return self
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public Context getContext() {
|
||||
LOG.d(TAG, "This will be deprecated December 2012");
|
||||
return this;
|
||||
|
||||
@@ -47,6 +47,14 @@ import android.widget.RelativeLayout;
|
||||
|
||||
/**
|
||||
* This class is the WebChromeClient that implements callbacks for our web view.
|
||||
* The kind of callbacks that happen here are on the chrome outside the document,
|
||||
* such as onCreateWindow(), onConsoleMessage(), onProgressChanged(), etc. Related
|
||||
* to but different than CordovaWebViewClient.
|
||||
*
|
||||
* @see <a href="http://developer.android.com/reference/android/webkit/WebChromeClient.html">WebChromeClient</a>
|
||||
* @see <a href="http://developer.android.com/guide/webapps/webview.html">WebView guide</a>
|
||||
* @see CordovaWebViewClient
|
||||
* @see CordovaWebView
|
||||
*/
|
||||
public class CordovaChromeClient extends WebChromeClient {
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public interface CordovaInterface {
|
||||
/**
|
||||
* Get the Android activity.
|
||||
*
|
||||
* @return
|
||||
* @return the Activity
|
||||
*/
|
||||
public abstract Activity getActivity();
|
||||
|
||||
|
||||
@@ -37,6 +37,9 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@@ -56,12 +59,16 @@ import android.webkit.WebView;
|
||||
import android.webkit.WebSettings.LayoutAlgorithm;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
/*
|
||||
* This class is our web view.
|
||||
*
|
||||
* @see <a href="http://developer.android.com/guide/webapps/webview.html">WebView guide</a>
|
||||
* @see <a href="http://developer.android.com/reference/android/webkit/WebView.html">WebView</a>
|
||||
*/
|
||||
public class CordovaWebView extends WebView {
|
||||
|
||||
|
||||
public static final String TAG = "CordovaWebView";
|
||||
|
||||
public static final String CORDOVA_VERSION = "3.2.0-dev";
|
||||
public static final String CORDOVA_VERSION = "3.3.0";
|
||||
|
||||
private ArrayList<Integer> keyDownCodes = new ArrayList<Integer>();
|
||||
private ArrayList<Integer> keyUpCodes = new ArrayList<Integer>();
|
||||
@@ -210,7 +217,9 @@ public class CordovaWebView extends WebView {
|
||||
this.setup();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set the WebViewClient, but provide special case handling for IceCreamSandwich.
|
||||
*/
|
||||
private void initWebViewClient(CordovaInterface cordova) {
|
||||
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB ||
|
||||
android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.JELLY_BEAN_MR1)
|
||||
@@ -275,6 +284,28 @@ public class CordovaWebView extends WebView {
|
||||
settings.setDatabaseEnabled(true);
|
||||
settings.setDatabasePath(databasePath);
|
||||
|
||||
|
||||
//Determine whether we're in debug or release mode, and turn on Debugging!
|
||||
try {
|
||||
final String packageName = this.cordova.getActivity().getPackageName();
|
||||
final PackageManager pm = this.cordova.getActivity().getPackageManager();
|
||||
ApplicationInfo appInfo;
|
||||
|
||||
appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
|
||||
|
||||
if((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0 &&
|
||||
android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT)
|
||||
{
|
||||
setWebContentsDebuggingEnabled(true);
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.d(TAG, "You have one job! To turn on Remote Web Debugging! YOU HAVE FAILED! ");
|
||||
e.printStackTrace();
|
||||
} catch (NameNotFoundException e) {
|
||||
Log.d(TAG, "This should never happen: Your application's package can't be found.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
settings.setGeolocationDatabasePath(databasePath);
|
||||
|
||||
// Enable DOM storage
|
||||
@@ -315,10 +346,10 @@ public class CordovaWebView extends WebView {
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to decide wether or not you need to request the
|
||||
* Override this method to decide whether or not you need to request the
|
||||
* focus when your application start
|
||||
*
|
||||
* @return
|
||||
* @return true unless this method is overriden to return a different value
|
||||
*/
|
||||
protected boolean shouldRequestFocusOnInit() {
|
||||
return true;
|
||||
@@ -511,6 +542,15 @@ public class CordovaWebView extends WebView {
|
||||
this.loadUrlIntoView(url);
|
||||
}
|
||||
|
||||
|
||||
public void onScrollChanged(int l, int t, int oldl, int oldt)
|
||||
{
|
||||
super.onScrollChanged(l, t, oldl, oldt);
|
||||
//We should post a message that the scroll changed
|
||||
ScrollEvent myEvent = new ScrollEvent(l, t, oldl, oldt, this);
|
||||
this.postMessage("onScrollChanged", myEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send JavaScript statement back to JavaScript.
|
||||
* (This is a convenience method)
|
||||
@@ -636,7 +676,7 @@ public class CordovaWebView extends WebView {
|
||||
*
|
||||
* @param name
|
||||
* @param defaultValue
|
||||
* @return
|
||||
* @return the String value for the named property
|
||||
*/
|
||||
public String getProperty(String name, String defaultValue) {
|
||||
Bundle bundle = this.cordova.getActivity().getIntent().getExtras();
|
||||
@@ -876,7 +916,7 @@ public class CordovaWebView extends WebView {
|
||||
{
|
||||
WebHistoryItem item = currentList.getItemAtIndex(i);
|
||||
String url = item.getUrl();
|
||||
LOG.d(TAG, "The URL at index: " + Integer.toString(i) + "is " + url );
|
||||
LOG.d(TAG, "The URL at index: " + Integer.toString(i) + " is " + url );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -890,7 +930,7 @@ public class CordovaWebView extends WebView {
|
||||
String url = item.getUrl();
|
||||
String currentUrl = this.getUrl();
|
||||
LOG.d(TAG, "The current URL is: " + currentUrl);
|
||||
LOG.d(TAG, "The URL at item 0 is:" + url);
|
||||
LOG.d(TAG, "The URL at item 0 is: " + url);
|
||||
return currentUrl.equals(url);
|
||||
}
|
||||
return false;
|
||||
@@ -943,7 +983,7 @@ public class CordovaWebView extends WebView {
|
||||
* if the video overlay is showing then we need to know
|
||||
* as it effects back button handling
|
||||
*
|
||||
* @return
|
||||
* @return true if custom view is showing
|
||||
*/
|
||||
public boolean isCustomViewShowing() {
|
||||
return mCustomView != null;
|
||||
|
||||
@@ -45,6 +45,15 @@ import android.webkit.WebViewClient;
|
||||
|
||||
/**
|
||||
* This class is the WebViewClient that implements callbacks for our web view.
|
||||
* The kind of callbacks that happen here are regarding the rendering of the
|
||||
* document instead of the chrome surrounding it, such as onPageStarted(),
|
||||
* shouldOverrideUrlLoading(), etc. Related to but different than
|
||||
* CordovaChromeClient.
|
||||
*
|
||||
* @see <a href="http://developer.android.com/reference/android/webkit/WebViewClient.html">WebViewClient</a>
|
||||
* @see <a href="http://developer.android.com/guide/webapps/webview.html">WebView guide</a>
|
||||
* @see CordovaChromeClient
|
||||
* @see CordovaWebView
|
||||
*/
|
||||
public class CordovaWebViewClient extends WebViewClient {
|
||||
|
||||
|
||||
@@ -17,10 +17,18 @@
|
||||
under the License.
|
||||
*/
|
||||
|
||||
// We moved everything to CordovaActivity
|
||||
|
||||
package org.apache.cordova;
|
||||
|
||||
/**
|
||||
* This used to be the class that should be extended by application
|
||||
* developers, but everything has been moved to CordovaActivity. So
|
||||
* you should extend CordovaActivity instead of DroidGap. This class
|
||||
* will be removed at a future time.
|
||||
*
|
||||
* @see CordovaActivity
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public class DroidGap extends CordovaActivity {
|
||||
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class LOG {
|
||||
* Determine if log level will be logged
|
||||
*
|
||||
* @param logLevel
|
||||
* @return
|
||||
* @return true if the parameter passed in is greater than or equal to the current log level
|
||||
*/
|
||||
public static boolean isLoggable(int logLevel) {
|
||||
return (logLevel >= LOGLEVEL);
|
||||
|
||||
@@ -35,7 +35,7 @@ import android.webkit.WebView;
|
||||
public class NativeToJsMessageQueue {
|
||||
private static final String LOG_TAG = "JsMessageQueue";
|
||||
|
||||
// This must match the default value in incubator-cordova-js/lib/android/exec.js
|
||||
// This must match the default value in cordova-js/lib/android/exec.js
|
||||
private static final int DEFAULT_BRIDGE_MODE = 2;
|
||||
|
||||
// Set this to true to force plugin results to be encoding as
|
||||
|
||||
@@ -107,13 +107,13 @@ public class PluginEntry {
|
||||
* Get the class.
|
||||
*
|
||||
* @param clazz
|
||||
* @return
|
||||
* @return a reference to the named class
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
private Class getClassByName(final String clazz) throws ClassNotFoundException {
|
||||
Class c = null;
|
||||
if (clazz != null) {
|
||||
if ((clazz != null) && !("".equals(clazz))) {
|
||||
c = Class.forName(clazz);
|
||||
}
|
||||
return c;
|
||||
|
||||
@@ -110,11 +110,16 @@ public class PluginManager {
|
||||
* Load plugins from res/xml/config.xml
|
||||
*/
|
||||
public void loadPlugins() {
|
||||
// First checking the class namespace for config.xml
|
||||
int id = this.ctx.getActivity().getResources().getIdentifier("config", "xml", this.ctx.getActivity().getClass().getPackage().getName());
|
||||
if (id == 0) {
|
||||
this.pluginConfigurationMissing();
|
||||
//We have the error, we need to exit without crashing!
|
||||
return;
|
||||
// If we couldn't find config.xml there, we'll look in the namespace from AndroidManifest.xml
|
||||
id = this.ctx.getActivity().getResources().getIdentifier("config", "xml", this.ctx.getActivity().getPackageName());
|
||||
if (id == 0) {
|
||||
this.pluginConfigurationMissing();
|
||||
//We have the error, we need to exit without crashing!
|
||||
return;
|
||||
}
|
||||
}
|
||||
XmlResourceParser xml = this.ctx.getActivity().getResources().getXml(id);
|
||||
int eventType = -1;
|
||||
@@ -339,7 +344,7 @@ public class PluginManager {
|
||||
*
|
||||
* @param id The message id
|
||||
* @param data The message data
|
||||
* @return
|
||||
* @return Object to stop propagation or null
|
||||
*/
|
||||
public Object postMessage(String id, Object data) {
|
||||
Object obj = this.ctx.onMessage(id, data);
|
||||
@@ -413,7 +418,7 @@ public class PluginManager {
|
||||
private void pluginConfigurationMissing() {
|
||||
LOG.e(TAG, "=====================================================================================");
|
||||
LOG.e(TAG, "ERROR: config.xml is missing. Add res/xml/config.xml to your project.");
|
||||
LOG.e(TAG, "https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/res/xml/plugins.xml");
|
||||
LOG.e(TAG, "https://git-wip-us.apache.org/repos/asf?p=cordova-android.git;a=blob;f=framework/res/xml/config.xml");
|
||||
LOG.e(TAG, "=====================================================================================");
|
||||
}
|
||||
|
||||
|
||||
67
framework/src/org/apache/cordova/ScrollEvent.java
Normal file
67
framework/src/org/apache/cordova/ScrollEvent.java
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
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;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
/*
|
||||
* This can be used by any view, including native views
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
public class ScrollEvent {
|
||||
|
||||
public int l, t, nl, nt;
|
||||
private View targetView;
|
||||
|
||||
/*
|
||||
* ScrollEvent constructor
|
||||
* No idea why it uses l and t instead of x and y
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @param nx
|
||||
* @param ny
|
||||
* @param view
|
||||
*/
|
||||
|
||||
ScrollEvent(int nx, int ny, int x, int y, View view)
|
||||
{
|
||||
l = x; y = t; nl = nx; nt = ny;
|
||||
targetView = view;
|
||||
}
|
||||
|
||||
public int dl()
|
||||
{
|
||||
return nl - l;
|
||||
}
|
||||
|
||||
public int dt()
|
||||
{
|
||||
return nt - t;
|
||||
}
|
||||
|
||||
public View getTargetView()
|
||||
{
|
||||
return targetView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -149,7 +149,7 @@ public class Whitelist {
|
||||
* Determine if URL is in approved list of URLs to load.
|
||||
*
|
||||
* @param uri
|
||||
* @return
|
||||
* @return true if wide open or whitelisted
|
||||
*/
|
||||
public boolean isUrlWhiteListed(String uri) {
|
||||
// If there is no whitelist, then it's wide open
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
|
||||
|
||||
<uses-sdk android:minSdkVersion="8" />
|
||||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19"/>
|
||||
|
||||
<instrumentation
|
||||
android:name="android.test.InstrumentationTestRunner"
|
||||
@@ -59,7 +59,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.CordovaWebViewTestActivity" >
|
||||
android:name="org.apache.cordova.test.CordovaWebViewTestActivity" >
|
||||
<intent-filter >
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
@@ -69,7 +69,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.background" >
|
||||
android:name="org.apache.cordova.test.background" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -79,7 +79,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.backgroundcolor" >
|
||||
android:name="org.apache.cordova.test.backgroundcolor" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -89,7 +89,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.basicauth" >
|
||||
android:name="org.apache.cordova.test.basicauth" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -99,7 +99,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.CordovaActivity" >
|
||||
android:name="org.apache.cordova.test.CordovaActivity" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -109,7 +109,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.CordovaDriverAction" >
|
||||
android:name="org.apache.cordova.test.CordovaDriverAction" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -119,7 +119,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.errorurl" >
|
||||
android:name="org.apache.cordova.test.errorurl" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -129,7 +129,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.fullscreen" >
|
||||
android:name="org.apache.cordova.test.fullscreen" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -139,7 +139,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.htmlnotfound" >
|
||||
android:name="org.apache.cordova.test.htmlnotfound" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -149,7 +149,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.iframe" >
|
||||
android:name="org.apache.cordova.test.iframe" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -159,7 +159,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.lifecycle" >
|
||||
android:name="org.apache.cordova.test.lifecycle" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -169,7 +169,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.loading" >
|
||||
android:name="org.apache.cordova.test.loading" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -179,7 +179,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.menus" >
|
||||
android:name="org.apache.cordova.test.menus" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -189,7 +189,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.splashscreen" >
|
||||
android:name="org.apache.cordova.test.splashscreen" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -199,7 +199,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.tests" >
|
||||
android:name="org.apache.cordova.test.tests" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -209,7 +209,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.timeout" >
|
||||
android:name="org.apache.cordova.test.timeout" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -219,7 +219,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.userwebview" >
|
||||
android:name="org.apache.cordova.test.userwebview" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -229,7 +229,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.whitelist" >
|
||||
android:name="org.apache.cordova.test.whitelist" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -239,7 +239,7 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.xhr" >
|
||||
android:name="org.apache.cordova.test.xhr" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
@@ -249,11 +249,11 @@
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:label="@string/app_name"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:name=".actions.backbuttonmultipage" >
|
||||
android:name="org.apache.cordova.test.backbuttonmultipage" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.SAMPLE_CODE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@@ -24,11 +24,12 @@ These tests are designed to verify Android native features and other Android spe
|
||||
|
||||
## Initial Setup ##
|
||||
|
||||
Before running the tests, they need to be set up.
|
||||
There really isn't any manual setup to do. The ant script takes care of that.
|
||||
You don't even need to compile cordova-x.y.z.jar or copy it, because
|
||||
project.properties has a library reference to ../framework. However, Robotium has to be
|
||||
installed for the onScrollChanged tests to work correctly. It can be found at https://code.google.com/p/robotium/
|
||||
|
||||
0. Copy cordova-x.y.z.jar into libs directory
|
||||
|
||||
To run from command line:
|
||||
To run manually from command line:
|
||||
|
||||
0. Build by entering `ant debug install`
|
||||
0. Run tests by clicking on "CordovaTest" icon on device
|
||||
@@ -38,7 +39,7 @@ To run from Eclipse:
|
||||
0. Import Android project into Eclipse
|
||||
0. Ensure Project properties "Java Build Path" includes the lib/cordova-x.y.z.jar
|
||||
0. Create run configuration if not already created
|
||||
0. Run tests
|
||||
0. Run As -> Android JUnit Test
|
||||
|
||||
## Automatic Runs ##
|
||||
|
||||
@@ -46,5 +47,3 @@ Once you have installed the test, you can launch and run the tests
|
||||
automatically with the below command:
|
||||
|
||||
adb shell am instrument -w org.apache.cordova.test/android.test.InstrumentationTestRunner
|
||||
|
||||
(Optionally, you can also run in Eclipse)
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<!--
|
||||
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.$
|
||||
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>
|
||||
@@ -27,9 +27,8 @@ $
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Cordova Android Tests</h1>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||
<h4>Width: <span id="width"> </span>, Height: <span id="height"> </span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
<h4>Page 1</h4>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<!--
|
||||
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.$
|
||||
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>
|
||||
@@ -27,9 +27,8 @@ $
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Cordova Android Tests</h1>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||
<h4>Width: <span id="width"> </span>, Height: <span id="height"> </span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
<h4>Page 2</h4>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<!--
|
||||
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.$
|
||||
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>
|
||||
@@ -27,9 +27,8 @@ $
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Cordova Android Tests</h1>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||
<h4>Width: <span id="width"> </span>, Height: <span id="height"> </span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
<h4>Page 3</h4>
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<!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.$
|
||||
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>
|
||||
@@ -40,13 +40,8 @@ $
|
||||
|
||||
function onDeviceReady() {
|
||||
// Register the event listener
|
||||
document.getElementById("platform").innerHTML = device.platform;
|
||||
document.getElementById("version").innerHTML = device.version;
|
||||
document.getElementById("uuid").innerHTML = device.uuid;
|
||||
document.getElementById("name").innerHTML = device.name;
|
||||
document.getElementById("width").innerHTML = screen.width;
|
||||
document.getElementById("height").innerHTML = screen.height;
|
||||
document.getElementById("colorDepth").innerHTML = screen.colorDepth;
|
||||
document.getElementById("deviceready").innerHTML = "fired";
|
||||
document.getElementById("cordova").innerHTML = cordova.version;
|
||||
|
||||
document.addEventListener("pause", onPause, false);
|
||||
document.addEventListener("resume", onResume, false);
|
||||
@@ -84,17 +79,8 @@ $
|
||||
<body onload="onLoad()" onunload="onUnLoaded()" id="stage" class="theme">
|
||||
<h1>Events</h1>
|
||||
<div id="info">
|
||||
<h4>
|
||||
Platform: <span id="platform"> </span>, Version: <span
|
||||
id="version"> </span>
|
||||
</h4>
|
||||
<h4>
|
||||
UUID: <span id="uuid"> </span>, Name: <span id="name"> </span>
|
||||
</h4>
|
||||
<h4>
|
||||
Width: <span id="width"> </span>, Height: <span id="height">
|
||||
</span>, Color Depth: <span id="colorDepth"></span>
|
||||
</h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
Press "Home" button, then return to this app to see pause/resume.<br>
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<!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.$
|
||||
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>
|
||||
@@ -40,13 +40,8 @@ $
|
||||
|
||||
function onDeviceReady() {
|
||||
// Register the event listener
|
||||
document.getElementById("platform").innerHTML = device.platform;
|
||||
document.getElementById("version").innerHTML = device.version;
|
||||
document.getElementById("uuid").innerHTML = device.uuid;
|
||||
document.getElementById("name").innerHTML = device.name;
|
||||
document.getElementById("width").innerHTML = screen.width;
|
||||
document.getElementById("height").innerHTML = screen.height;
|
||||
document.getElementById("colorDepth").innerHTML = screen.colorDepth;
|
||||
document.getElementById("deviceready").innerHTML = "fired";
|
||||
document.getElementById("cordova").innerHTML = cordova.version;
|
||||
|
||||
document.addEventListener("pause", onPause, false);
|
||||
document.addEventListener("resume", onResume, false);
|
||||
@@ -84,17 +79,8 @@ $
|
||||
<body onload="onLoad()" onunload="onUnLoaded()" id="stage" class="theme">
|
||||
<h1>Events</h1>
|
||||
<div id="info">
|
||||
<h4>
|
||||
Platform: <span id="platform"> </span>, Version: <span
|
||||
id="version"> </span>
|
||||
</h4>
|
||||
<h4>
|
||||
UUID: <span id="uuid"> </span>, Name: <span id="name"> </span>
|
||||
</h4>
|
||||
<h4>
|
||||
Width: <span id="width"> </span>, Height: <span id="height">
|
||||
</span>, Color Depth: <span id="colorDepth"></span>
|
||||
</h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
<h4>Press "Back" button to return to Page 1.</h4>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||
<meta name="viewport" content="width=320, user-scalable=no" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Cordova Tests</title>
|
||||
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
|
||||
@@ -29,10 +29,8 @@
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Background Color Test</h1>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||
<h4>Width: <span id="width"> </span>, Height: <span id="height">
|
||||
</span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
Before this page was show, you should have seen the background flash green.</br>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||
<meta name="viewport" content="width=320, user-scalable=no" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Cordova Tests</title>
|
||||
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
|
||||
@@ -29,10 +29,8 @@
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Basic Auth</h1>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||
<h4>Width: <span id="width"> </span>, Height: <span id="height">
|
||||
</span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
Loading link below should be successful and show page indicating username=test & password=test. <br>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
2115
test/assets/www/cordova.js
vendored
2115
test/assets/www/cordova.js
vendored
File diff suppressed because it is too large
Load Diff
3
test/assets/www/cordova_plugins.js
vendored
Normal file
3
test/assets/www/cordova_plugins.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
cordova.define('cordova/plugin_list', function(require, exports, module) {
|
||||
module.exports = []
|
||||
});
|
||||
@@ -19,7 +19,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||
<meta name="viewport" content="width=320, user-scalable=no" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Cordova Tests</title>
|
||||
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
|
||||
@@ -29,10 +29,8 @@
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Full Screen Test</h1>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||
<h4>Width: <span id="width"> </span>, Height: <span id="height">
|
||||
</span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
The app should take over the entire screen. <br>
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<!--
|
||||
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$
|
||||
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.$
|
||||
-->
|
||||
This is an error page.
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<!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.$
|
||||
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>
|
||||
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||
<meta name="viewport" content="width=320, user-scalable=no" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Cordova Tests</title>
|
||||
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
|
||||
@@ -33,10 +33,8 @@ $
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>IFrame</h1>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||
<h4>Width: <span id="width"> </span>, Height: <span id="height">
|
||||
</span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
Press the two buttons:<br>
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<!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.$
|
||||
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>
|
||||
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||
<meta name="viewport" content="width=320, user-scalable=no" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Cordova Tests</title>
|
||||
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
|
||||
@@ -29,10 +29,8 @@ $
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>IFrame window</h1>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||
<h4>Width: <span id="width"> </span>, Height: <span id="height">
|
||||
</span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
This should display a Cordova page inside an iframe. The info above should be filled out.
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||
<meta name="viewport" content="width=320, user-scalable=no" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Cordova Tests</title>
|
||||
<link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title">
|
||||
@@ -38,31 +38,28 @@
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Cordova Android Tests</h1>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||
<h4>Width: <span id="width"> </span>, Height: <span id="height">
|
||||
</span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||
<h4>Cordova Version: <span id="cordova"> </span></h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
<h4>Run each of the test activities below:</h4>
|
||||
</div>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.jqmtabbackbutton');">Backbutton jQM tab</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.backbuttonmultipage');">Backbutton with multiple pages</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.backgroundcolor');">Background Color</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.basicauth');">Basic Authentication</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.errorurl');">Error URL</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.fullscreen');">Full Screen</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.htmlnotfound');">HTML not found</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.iframe');">IFrame</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.lifecycle');">Lifecycle</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.loading');">Loading indicator</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.menus');">Menus</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.background');">No multitasking</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.splashscreen');">Splash screen</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.timeout');">Load timeout</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.userwebview');">User WebView/Client/Chrome</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.whitelist');">Whitelist</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.actions.xhr');">XHR</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.jqmtabbackbutton');">Backbutton jQM tab</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.backbuttonmultipage');">Backbutton with multiple pages</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.backgroundcolor');">Background Color</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.basicauth');">Basic Authentication</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.errorurl');">Error URL</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.fullscreen');">Full Screen</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.htmlnotfound');">HTML not found</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.iframe');">IFrame</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.lifecycle');">Lifecycle</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.loading');">Loading indicator</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.menus');">Menus</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.background');">No multitasking</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.splashscreen');">Splash screen</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.timeout');">Load timeout</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.userwebview');">User WebView/Client/Chrome</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.whitelist');">Whitelist</button>
|
||||
<button class="btn large" onclick="startActivity('org.apache.cordova.test.xhr');">XHR</button>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<!--
|
||||
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.$
|
||||
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>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<!--
|
||||
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.$
|
||||
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>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<!--
|
||||
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.$
|
||||
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>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<!--
|
||||
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.$
|
||||
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>
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<!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.$
|
||||
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>
|
||||
@@ -40,13 +40,8 @@ $
|
||||
|
||||
function onDeviceReady() {
|
||||
// Register the event listener
|
||||
document.getElementById("platform").innerHTML = device.platform;
|
||||
document.getElementById("version").innerHTML = device.version;
|
||||
document.getElementById("uuid").innerHTML = device.uuid;
|
||||
document.getElementById("name").innerHTML = device.name;
|
||||
document.getElementById("width").innerHTML = screen.width;
|
||||
document.getElementById("height").innerHTML = screen.height;
|
||||
document.getElementById("colorDepth").innerHTML = screen.colorDepth;
|
||||
document.getElementById("deviceready").innerHTML = "fired";
|
||||
document.getElementById("cordova").innerHTML = cordova.version;
|
||||
|
||||
document.addEventListener("pause", onPause, false);
|
||||
document.addEventListener("resume", onResume, false);
|
||||
@@ -84,17 +79,8 @@ $
|
||||
<body onload="onLoad()" onunload="onUnLoaded()" id="stage" class="theme">
|
||||
<h1>Events</h1>
|
||||
<div id="info">
|
||||
<h4>
|
||||
Platform: <span id="platform"> </span>, Version: <span
|
||||
id="version"> </span>
|
||||
</h4>
|
||||
<h4>
|
||||
UUID: <span id="uuid"> </span>, Name: <span id="name"> </span>
|
||||
</h4>
|
||||
<h4>
|
||||
Width: <span id="width"> </span>, Height: <span id="height">
|
||||
</span>, Color Depth: <span id="colorDepth"></span>
|
||||
</h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
<h4>Test 1</h4>
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<!--
|
||||
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.$
|
||||
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.
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
@@ -40,13 +40,8 @@ $
|
||||
|
||||
function onDeviceReady() {
|
||||
// Register the event listener
|
||||
document.getElementById("platform").innerHTML = device.platform;
|
||||
document.getElementById("version").innerHTML = device.version;
|
||||
document.getElementById("uuid").innerHTML = device.uuid;
|
||||
document.getElementById("name").innerHTML = device.name;
|
||||
document.getElementById("width").innerHTML = screen.width;
|
||||
document.getElementById("height").innerHTML = screen.height;
|
||||
document.getElementById("colorDepth").innerHTML = screen.colorDepth;
|
||||
document.getElementById("deviceready").innerHTML = "fired";
|
||||
document.getElementById("cordova").innerHTML = cordova.version;
|
||||
|
||||
document.addEventListener("pause", onPause, false);
|
||||
document.addEventListener("resume", onResume, false);
|
||||
@@ -84,17 +79,10 @@ $
|
||||
<body onload="onLoad()" onunload="onUnLoaded()" id="stage" class="theme">
|
||||
<h1>Events</h1>
|
||||
<div id="info">
|
||||
<h4>
|
||||
Platform: <span id="platform"> </span>, Version: <span
|
||||
id="version"> </span>
|
||||
</h4>
|
||||
<h4>
|
||||
UUID: <span id="uuid"> </span>, Name: <span id="name"> </span>
|
||||
</h4>
|
||||
<h4>
|
||||
Width: <span id="width"> </span>, Height: <span id="height">
|
||||
</span>, Color Depth: <span id="colorDepth"></span>
|
||||
</h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||
<h4>Width: <span id="width"> </span>, Height: <span id="height"> </span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
You should see<br>
|
||||
|
||||
@@ -18,17 +18,8 @@
|
||||
*/
|
||||
|
||||
var deviceInfo = function() {
|
||||
document.getElementById("platform").innerHTML = device.platform;
|
||||
document.getElementById("version").innerHTML = device.version;
|
||||
document.getElementById("uuid").innerHTML = device.uuid;
|
||||
document.getElementById("name").innerHTML = device.name;
|
||||
document.getElementById("width").innerHTML = screen.width;
|
||||
document.getElementById("height").innerHTML = screen.height;
|
||||
document.getElementById("colorDepth").innerHTML = screen.colorDepth;
|
||||
var el = document.getElementById("cordova");
|
||||
if (el) {
|
||||
el.innerHTML = device.cordova;
|
||||
}
|
||||
document.getElementById("deviceready").innerHTML = "fired";
|
||||
document.getElementById("cordova").innerHTML = cordova.version;
|
||||
};
|
||||
|
||||
var getLocation = function() {
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<!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.$
|
||||
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>
|
||||
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||
<meta name="viewport" content="width=320, user-scalable=no" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Cordova Tests</title>
|
||||
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
|
||||
@@ -29,10 +29,8 @@ $
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Menu Test</h1>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||
<h4>Width: <span id="width"> </span>, Height: <span id="height">
|
||||
</span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
<h4>The menu items should be:</h4>
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<!--
|
||||
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.$
|
||||
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.
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||
<meta name="viewport" content="width=320, user-scalable=no" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Cordova Tests</title>
|
||||
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
|
||||
@@ -29,10 +29,8 @@ $
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Splash Screen Test</h1>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||
<h4>Width: <span id="width"> </span>, Height: <span id="height">
|
||||
</span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
You should have seen the splash screen for 2 seconds.</div>
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<!--
|
||||
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.$
|
||||
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.
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||
<meta name="viewport" content="width=320, user-scalable=no" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Cordova Tests</title>
|
||||
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
|
||||
@@ -29,10 +29,8 @@ $
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>User WebView/Client/Chrome Test</h1>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||
<h4>Width: <span id="width"> </span>, Height: <span id="height">
|
||||
</span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
<h4>The following should be seen in LogCat:</h4>
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<!--
|
||||
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.$
|
||||
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.
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||
<meta name="viewport" content="width=320, user-scalable=no" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Cordova Tests</title>
|
||||
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
|
||||
@@ -29,10 +29,8 @@ $
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Whitelist Page 1</h1>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||
<h4>Width: <span id="width"> </span>, Height: <span id="height">
|
||||
</span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
Loading Page 2 should be successful.<br>
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<!--
|
||||
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.$
|
||||
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.
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||
<meta name="viewport" content="width=320, user-scalable=no" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Cordova Tests</title>
|
||||
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
|
||||
@@ -29,10 +29,8 @@ $
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>Whitelist Page 2</h1>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||
<h4>Width: <span id="width"> </span>, Height: <span id="height">
|
||||
</span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
Press "backbutton"
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<!--
|
||||
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.$
|
||||
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.
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=320; user-scalable=no" />
|
||||
<meta name="viewport" content="width=320, user-scalable=no" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>Cordova Tests</title>
|
||||
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
|
||||
@@ -49,10 +49,8 @@ $
|
||||
<body onload="init();" id="stage" class="theme">
|
||||
<h1>XHR</h1>
|
||||
<div id="info">
|
||||
<h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
|
||||
<h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
|
||||
<h4>Width: <span id="width"> </span>, Height: <span id="height">
|
||||
</span>, Color Depth: <span id="colorDepth"></span></h4>
|
||||
<h4>Cordova: <span id="cordova"> </span></h4>
|
||||
<h4>Deviceready: <span id="deviceready"> </span></h4>
|
||||
</div>
|
||||
<div id="info">
|
||||
Press buttons below to test. You should see an alert with results displayed.
|
||||
|
||||
@@ -66,9 +66,16 @@
|
||||
|
||||
<!-- extension targets. Uncomment the ones where you want to do custom work
|
||||
in between standard targets -->
|
||||
<!--
|
||||
|
||||
<target name="-pre-build">
|
||||
<!-- copy in the current cordova.js file from the parent project -->
|
||||
<copy file="../framework/assets/www/cordova.js"
|
||||
todir="assets/www"
|
||||
preservelastmodified="true"
|
||||
failonerror="true"
|
||||
verbose="true" />
|
||||
</target>
|
||||
<!--
|
||||
<target name="-pre-compile">
|
||||
</target>
|
||||
|
||||
|
||||
29
test/cordova/android_sdk_version
Executable file
29
test/cordova/android_sdk_version
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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 android_sdk_version = require('./lib/android_sdk_version');
|
||||
|
||||
android_sdk_version.run().done(null, function(err) {
|
||||
console.log(err);
|
||||
process.exit(2);
|
||||
});
|
||||
|
||||
|
||||
37
test/cordova/build
Executable file
37
test/cordova/build
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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 build = require('./lib/build'),
|
||||
reqs = require('./lib/check_reqs'),
|
||||
args = process.argv;
|
||||
|
||||
// Support basic help commands
|
||||
if(args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
|
||||
args[2] == 'help' || args[2] == '-help' || args[2] == '/help') {
|
||||
build.help();
|
||||
} else {
|
||||
reqs.run().then(function() {
|
||||
return build.run(args[2]);
|
||||
}).done(null, function(err) {
|
||||
console.error(err);
|
||||
process.exit(2);
|
||||
});
|
||||
}
|
||||
26
test/cordova/build.bat
Normal file
26
test/cordova/build.bat
Normal file
@@ -0,0 +1,26 @@
|
||||
:: 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.
|
||||
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0build"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2
|
||||
EXIT /B 1
|
||||
)
|
||||
28
test/cordova/check_reqs
Executable file
28
test/cordova/check_reqs
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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 check_reqs = require('./lib/check_reqs');
|
||||
|
||||
check_reqs.run().done(null, function(err) {
|
||||
console.log(err);
|
||||
process.exit(2);
|
||||
});
|
||||
|
||||
36
test/cordova/clean
Executable file
36
test/cordova/clean
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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 clean = require('./lib/clean'),
|
||||
reqs = require('./lib/check_reqs'),
|
||||
args = process.argv;
|
||||
|
||||
// Usage support for when args are given
|
||||
if(args.length > 2) {
|
||||
clean.help();
|
||||
} else {
|
||||
reqs.run().done(function() {
|
||||
return clean.run();
|
||||
}, function(err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
}
|
||||
26
test/cordova/clean.bat
Normal file
26
test/cordova/clean.bat
Normal file
@@ -0,0 +1,26 @@
|
||||
:: 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.
|
||||
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0clean"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'clean' script in 'cordova' folder, aborting...>&2
|
||||
EXIT /B 1
|
||||
)
|
||||
65
test/cordova/lib/android_sdk_version.js
vendored
Executable file
65
test/cordova/lib/android_sdk_version.js
vendored
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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'),
|
||||
child_process = require('child_process'),
|
||||
Q = require('q');
|
||||
|
||||
get_highest_sdk = function(results){
|
||||
var reg = /\d+/;
|
||||
var apiLevels = [];
|
||||
for(var i=0;i<results.length;i++){
|
||||
apiLevels[i] = parseInt(results[i].match(reg)[0]);
|
||||
}
|
||||
apiLevels.sort(function(a,b){return b-a});
|
||||
console.log(apiLevels[0]);
|
||||
}
|
||||
|
||||
get_sdks = function() {
|
||||
var d = Q.defer();
|
||||
child_process.exec('android list targets', function(err, stdout, stderr) {
|
||||
if (err) d.reject(stderr);
|
||||
else d.resolve(stdout);
|
||||
});
|
||||
|
||||
return d.promise.then(function(output) {
|
||||
var reg = /android-\d+/gi;
|
||||
var results = output.match(reg);
|
||||
if(results.length===0){
|
||||
return Q.reject(new Error('No android sdks installed.'));
|
||||
}else{
|
||||
get_highest_sdk(results);
|
||||
}
|
||||
|
||||
return Q();
|
||||
}, function(stderr) {
|
||||
if (stderr.match(/command\snot\sfound/)) {
|
||||
return Q.reject(new Error('The command \"android\" failed. Make sure you have the latest Android SDK installed, and the \"android\" command (inside the tools/ folder) is added to your path.'));
|
||||
} else {
|
||||
return Q.reject(new Error('An error occurred while listing Android targets'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.run = function() {
|
||||
return Q.all([get_sdks()]);
|
||||
}
|
||||
|
||||
41
test/cordova/lib/appinfo.js
vendored
Normal file
41
test/cordova/lib/appinfo.js
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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 path = require('path');
|
||||
var fs = require('fs');
|
||||
var cachedAppInfo = null;
|
||||
|
||||
function readAppInfoFromManifest() {
|
||||
var manifestPath = path.join(__dirname, '..', '..', 'AndroidManifest.xml');
|
||||
var manifestData = fs.readFileSync(manifestPath, {encoding:'utf8'});
|
||||
var packageName = /\bpackage\s*=\s*"(.+?)"/.exec(manifestData);
|
||||
if (!packageName) throw new Error('Could not find package name within ' + manifestPath);
|
||||
var activityTag = /<activity\b[\s\S]*<\/activity>/.exec(manifestData);
|
||||
if (!activityTag) throw new Error('Could not find <activity> within ' + manifestPath);
|
||||
var activityName = /\bandroid:name\s*=\s*"(.+?)"/.exec(activityTag);
|
||||
if (!activityName) throw new Error('Could not find android:name within ' + manifestPath);
|
||||
|
||||
return packageName[1] + '/.' + activityName[1];
|
||||
}
|
||||
|
||||
exports.getActivityName = function() {
|
||||
return cachedAppInfo = cachedAppInfo || readAppInfoFromManifest();
|
||||
};
|
||||
87
test/cordova/lib/build.js
vendored
Normal file
87
test/cordova/lib/build.js
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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'),
|
||||
exec = require('./exec'),
|
||||
Q = require('q'),
|
||||
clean = require('./clean'),
|
||||
path = require('path'),
|
||||
fs = require('fs'),
|
||||
ROOT = path.join(__dirname, '..', '..');
|
||||
|
||||
/*
|
||||
* Builds the project with ant.
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.run = function(build_type) {
|
||||
//default build type
|
||||
build_type = typeof build_type !== 'undefined' ? build_type : "--debug";
|
||||
var cmd;
|
||||
switch(build_type) {
|
||||
case '--debug' :
|
||||
cmd = 'ant debug -f ' + path.join(ROOT, 'build.xml');
|
||||
break;
|
||||
case '--release' :
|
||||
cmd = 'ant release -f ' + path.join(ROOT, 'build.xml');
|
||||
break;
|
||||
case '--nobuild' :
|
||||
console.log('Skipping build...');
|
||||
return Q();
|
||||
default :
|
||||
return Q.reject('Build option \'' + build_type + '\' not recognized.');
|
||||
}
|
||||
if(cmd) {
|
||||
return clean.run() // TODO: Can we stop cleaning every time and let ant build incrementally?
|
||||
.then(function() {
|
||||
return exec(cmd);
|
||||
});
|
||||
}
|
||||
return Q();
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets the path to the apk file, if not such file exists then
|
||||
* the script will error out. (should we error or just return undefined?)
|
||||
*/
|
||||
module.exports.get_apk = function() {
|
||||
if(fs.existsSync(path.join(ROOT, 'bin'))) {
|
||||
var bin_files = fs.readdirSync(path.join(ROOT, 'bin'));
|
||||
for (file in bin_files) {
|
||||
if(path.extname(bin_files[file]) == '.apk') {
|
||||
return path.join(ROOT, 'bin', bin_files[file]);
|
||||
}
|
||||
}
|
||||
console.error('ERROR : No .apk found in \'bin\' folder');
|
||||
process.exit(2);
|
||||
} else {
|
||||
console.error('ERROR : unable to find project bin folder, could not locate .apk');
|
||||
process.exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.help = function() {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), path.join(ROOT, 'corodva', 'build')) + ' [build_type]');
|
||||
console.log('Build Types : ');
|
||||
console.log(' \'--debug\': Default build, will build project in using ant debug');
|
||||
console.log(' \'--release\': will build project using ant release');
|
||||
console.log(' \'--nobuild\': will skip build process (can be used with run command)');
|
||||
process.exit(0);
|
||||
}
|
||||
94
test/cordova/lib/check_reqs.js
vendored
Normal file
94
test/cordova/lib/check_reqs.js
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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'),
|
||||
child_process = require('child_process'),
|
||||
Q = require('q'),
|
||||
path = require('path'),
|
||||
fs = require('fs'),
|
||||
ROOT = path.join(__dirname, '..', '..');
|
||||
|
||||
// Get valid target from framework/project.properties
|
||||
module.exports.get_target = function() {
|
||||
if(fs.existsSync(path.join(ROOT, 'framework', 'project.properties'))) {
|
||||
var target = shell.grep(/target=android-[\d+]/, path.join(ROOT, 'framework', 'project.properties'));
|
||||
return target.split('=')[1].replace('\n', '').replace('\r', '').replace(' ', '');
|
||||
} else if (fs.existsSync(path.join(ROOT, 'project.properties'))) {
|
||||
// if no target found, we're probably in a project and project.properties is in ROOT.
|
||||
var target = shell.grep(/target=android-[\d+]/, path.join(ROOT, 'project.properties'));
|
||||
return target.split('=')[1].replace('\n', '').replace('\r', '').replace(' ', '');
|
||||
}
|
||||
}
|
||||
|
||||
// Returns a promise.
|
||||
module.exports.check_ant = function() {
|
||||
var d = Q.defer();
|
||||
child_process.exec('ant -version', function(err, stdout, stderr) {
|
||||
if (err) d.reject(new Error('ERROR : executing command \'ant\', make sure you have ant installed and added to your path.'));
|
||||
else d.resolve();
|
||||
});
|
||||
return d.promise;
|
||||
}
|
||||
|
||||
// Returns a promise.
|
||||
module.exports.check_java = function() {
|
||||
if(process.env.JAVA_HOME) {
|
||||
var d = Q.defer();
|
||||
child_process.exec('java -version', function(err, stdout, stderr) {
|
||||
if(err) d.reject(new Error('ERROR : executing command \'java\', make sure you java environment is set up. Including your JDK and JRE.' + err));
|
||||
else d.resolve();
|
||||
});
|
||||
return d.promise;
|
||||
} else {
|
||||
return Q.reject(new Error('ERROR : Make sure JAVA_HOME is set, as well as paths to your JDK and JRE for java.'));
|
||||
}
|
||||
}
|
||||
|
||||
// Returns a promise.
|
||||
module.exports.check_android = function() {
|
||||
var valid_target = this.get_target();
|
||||
var d = Q.defer();
|
||||
child_process.exec('android list targets', function(err, stdout, stderr) {
|
||||
if (err) d.reject(stderr);
|
||||
else d.resolve(stdout);
|
||||
});
|
||||
|
||||
return d.promise.then(function(output) {
|
||||
if (!output.match(valid_target)) {
|
||||
return Q.reject(new Error('Please install Android target ' + valid_target.split('-')[1] + ' (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run \"android\" from your command-line to install/update any missing SDKs or tools.'));
|
||||
}
|
||||
return Q();
|
||||
}, function(stderr) {
|
||||
if (stderr.match(/command\snot\sfound/)) {
|
||||
return Q.reject(new Error('The command \"android\" failed. Make sure you have the latest Android SDK installed, and the \"android\" command (inside the tools/ folder) is added to your path.'));
|
||||
} else {
|
||||
return Q.reject(new Error('An error occurred while listing Android targets'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Returns a promise.
|
||||
module.exports.run = function() {
|
||||
return Q.all([this.check_ant(), this.check_java(), this.check_android()]).then(function() {
|
||||
console.log('Looks like your environment fully supports cordova-android development!');
|
||||
});
|
||||
}
|
||||
|
||||
38
test/cordova/lib/clean.js
vendored
Normal file
38
test/cordova/lib/clean.js
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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 exec = require('./exec'),
|
||||
path = require('path'),
|
||||
ROOT = path.join(__dirname, '..', '..');
|
||||
|
||||
/*
|
||||
* Cleans the project using ant
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.run = function() {
|
||||
return exec('ant clean -f ' + path.join(ROOT, 'build.xml'));
|
||||
}
|
||||
|
||||
module.exports.help = function() {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), process.argv[1]));
|
||||
console.log('Cleans the project directory.');
|
||||
process.exit(0);
|
||||
}
|
||||
86
test/cordova/lib/device.js
vendored
Normal file
86
test/cordova/lib/device.js
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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 exec = require('./exec'),
|
||||
Q = require('q'),
|
||||
path = require('path'),
|
||||
build = require('./build'),
|
||||
appinfo = require('./appinfo'),
|
||||
ROOT = path.join(__dirname, '..', '..');
|
||||
|
||||
/**
|
||||
* Returns a promise for the list of the device ID's found
|
||||
*/
|
||||
module.exports.list = function() {
|
||||
return exec('adb devices')
|
||||
.then(function(output) {
|
||||
var response = output.split('\n');
|
||||
var device_list = [];
|
||||
for (var i = 1; i < response.length; i++) {
|
||||
if (response[i].match(/\w+\tdevice/) && !response[i].match(/emulator/)) {
|
||||
device_list.push(response[i].replace(/\tdevice/, '').replace('\r', ''));
|
||||
}
|
||||
}
|
||||
return device_list;
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Installs a previously built application on the device
|
||||
* and launches it.
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.install = function(target) {
|
||||
var launchName;
|
||||
return this.list()
|
||||
.then(function(device_list) {
|
||||
if (!device_list || !device_list.length)
|
||||
return Q.reject('ERROR: Failed to deploy to device, no devices found.');
|
||||
|
||||
// default device
|
||||
target = typeof target !== 'undefined' ? target : device_list[0];
|
||||
|
||||
if (device_list.indexOf(target) < 0)
|
||||
return Q.reject('ERROR: Unable to find target \'' + target + '\'.');
|
||||
|
||||
var apk_path = build.get_apk();
|
||||
launchName = appinfo.getActivityName();
|
||||
console.log('Installing app on device...');
|
||||
var cmd = 'adb -s ' + target + ' install -r ' + apk_path;
|
||||
return exec(cmd);
|
||||
}).then(function(output) {
|
||||
if (output.match(/Failure/)) return Q.reject('ERROR: Failed to install apk to device: ' + output);
|
||||
|
||||
//unlock screen
|
||||
var cmd = 'adb -s ' + target + ' shell input keyevent 82';
|
||||
return exec(cmd);
|
||||
}, function(err) { return Q.reject('ERROR: Failed to install apk to device: ' + err); })
|
||||
.then(function() {
|
||||
// launch the application
|
||||
console.log('Launching application...');
|
||||
var cmd = 'adb -s ' + target + ' shell am start -W -a android.intent.action.MAIN -n ' + launchName;
|
||||
return exec(cmd);
|
||||
}).then(function() {
|
||||
console.log('LANCH SUCCESS');
|
||||
}, function(err) {
|
||||
return Q.reject('ERROR: Failed to launch application on device: ' + err);
|
||||
});
|
||||
}
|
||||
330
test/cordova/lib/emulator.js
vendored
Normal file
330
test/cordova/lib/emulator.js
vendored
Normal file
@@ -0,0 +1,330 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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'),
|
||||
exec = require('./exec'),
|
||||
Q = require('q'),
|
||||
path = require('path'),
|
||||
appinfo = require('./appinfo'),
|
||||
build = require('./build'),
|
||||
ROOT = path.join(__dirname, '..', '..'),
|
||||
child_process = require('child_process'),
|
||||
new_emulator = 'cordova_emulator';
|
||||
|
||||
/**
|
||||
* Returns a Promise for a list of emulator images in the form of objects
|
||||
* {
|
||||
name : <emulator_name>,
|
||||
path : <path_to_emulator_image>,
|
||||
target : <api_target>,
|
||||
abi : <cpu>,
|
||||
skin : <skin>
|
||||
}
|
||||
*/
|
||||
module.exports.list_images = function() {
|
||||
return exec('android list avds')
|
||||
.then(function(output) {
|
||||
var response = output.split('\n');
|
||||
var emulator_list = [];
|
||||
for (var i = 1; i < response.length; i++) {
|
||||
// To return more detailed information use img_obj
|
||||
var img_obj = {};
|
||||
if (response[i].match(/Name:\s/)) {
|
||||
img_obj['name'] = response[i].split('Name: ')[1].replace('\r', '');
|
||||
if (response[i + 1].match(/Path:\s/)) {
|
||||
i++;
|
||||
img_obj['path'] = response[i].split('Path: ')[1].replace('\r', '');
|
||||
}
|
||||
if (response[i + 1].match(/\(API\slevel\s/)) {
|
||||
i++;
|
||||
img_obj['target'] = response[i].replace('\r', '');
|
||||
}
|
||||
if (response[i + 1].match(/ABI:\s/)) {
|
||||
i++;
|
||||
img_obj['abi'] = response[i].split('ABI: ')[1].replace('\r', '');
|
||||
}
|
||||
if (response[i + 1].match(/Skin:\s/)) {
|
||||
i++;
|
||||
img_obj['skin'] = response[i].split('Skin: ')[1].replace('\r', '');
|
||||
}
|
||||
|
||||
emulator_list.push(img_obj);
|
||||
}
|
||||
/* To just return a list of names use this
|
||||
if (response[i].match(/Name:\s/)) {
|
||||
emulator_list.push(response[i].split('Name: ')[1].replace('\r', '');
|
||||
}*/
|
||||
|
||||
}
|
||||
return emulator_list;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Will return the closest avd to the projects target
|
||||
* or undefined if no avds exist.
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.best_image = function() {
|
||||
var project_target = this.get_target().replace('android-', '');
|
||||
return this.list_images()
|
||||
.then(function(images) {
|
||||
var closest = 9999;
|
||||
var best = images[0];
|
||||
for (i in images) {
|
||||
var target = images[i].target;
|
||||
if(target) {
|
||||
var num = target.split('(API level ')[1].replace(')', '');
|
||||
if (num == project_target) {
|
||||
return images[i];
|
||||
} else if (project_target - num < closest && project_target > num) {
|
||||
var closest = project_target - num;
|
||||
best = images[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return best;
|
||||
});
|
||||
}
|
||||
|
||||
// Returns a promise.
|
||||
module.exports.list_started = function() {
|
||||
return exec('adb devices')
|
||||
.then(function(output) {
|
||||
var response = output.split('\n');
|
||||
var started_emulator_list = [];
|
||||
for (var i = 1; i < response.length; i++) {
|
||||
if (response[i].match(/device/) && response[i].match(/emulator/)) {
|
||||
started_emulator_list.push(response[i].replace(/\tdevice/, '').replace('\r', ''));
|
||||
}
|
||||
}
|
||||
return started_emulator_list;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.get_target = function() {
|
||||
var target = shell.grep(/target=android-[\d+]/, path.join(ROOT, 'project.properties'));
|
||||
return target.split('=')[1].replace('\n', '').replace('\r', '').replace(' ', '');
|
||||
}
|
||||
|
||||
// Returns a promise.
|
||||
module.exports.list_targets = function() {
|
||||
return exec('android list targets')
|
||||
.then(function(output) {
|
||||
var target_out = output.split('\n');
|
||||
var targets = [];
|
||||
for (var i = target_out.length; i >= 0; i--) {
|
||||
if(target_out[i].match(/id:/)) {
|
||||
targets.push(targets[i].split(' ')[1]);
|
||||
}
|
||||
}
|
||||
return targets;
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Starts an emulator with the given ID,
|
||||
* and returns the started ID of that emulator.
|
||||
* If no ID is given it will used the first image availible,
|
||||
* if no image is availible it will error out (maybe create one?).
|
||||
*
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.start = function(emulator_ID) {
|
||||
var self = this;
|
||||
var emulator_id, num_started, started_emulators;
|
||||
|
||||
return self.list_started()
|
||||
.then(function(list) {
|
||||
started_emulators = list;
|
||||
num_started = started_emulators.length;
|
||||
if (typeof emulator_ID === 'undefined') {
|
||||
return self.list_images()
|
||||
.then(function(emulator_list) {
|
||||
if (emulator_list.length > 0) {
|
||||
return self.best_image()
|
||||
.then(function(best) {
|
||||
emulator_ID = best.name;
|
||||
console.log('WARNING : no emulator specified, defaulting to ' + emulator_ID);
|
||||
return emulator_ID;
|
||||
});
|
||||
} else {
|
||||
return Q.reject('ERROR : No emulator images (avds) found, if you would like to create an\n' +
|
||||
' avd follow the instructions provided here:\n' +
|
||||
' http://developer.android.com/tools/devices/index.html\n' +
|
||||
' Or run \'android create avd --name <name> --target <targetID>\'\n' +
|
||||
' in on the command line.');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return Q(emulator_ID);
|
||||
}
|
||||
}).then(function() {
|
||||
var cmd, args;
|
||||
if(process.platform == 'win32' || process.platform == 'win64') {
|
||||
cmd = '%comspec%';
|
||||
args = ['/c', 'start', 'cmd', '/c', 'emulator', '-avd', emulator_ID];
|
||||
} else {
|
||||
cmd = 'emulator';
|
||||
args = ['-avd', emulator_ID];
|
||||
}
|
||||
var proc = child_process.spawn(cmd, args, { stdio: 'inherit', detached: true });
|
||||
proc.unref(); // Don't wait for it to finish, since the emulator will probably keep running for a long time.
|
||||
}).then(function() {
|
||||
// wait for emulator to start
|
||||
console.log('Waiting for emulator...');
|
||||
return self.wait_for_emulator(num_started);
|
||||
}).then(function(new_started) {
|
||||
if (new_started.length > 1) {
|
||||
for (i in new_started) {
|
||||
if (started_emulators.indexOf(new_started[i]) < 0) {
|
||||
emulator_id = new_started[i];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
emulator_id = new_started[0];
|
||||
}
|
||||
if (!emulator_id) return Q.reject('ERROR : Failed to start emulator, could not find new emulator');
|
||||
|
||||
//wait for emulator to boot up
|
||||
process.stdout.write('Booting up emulator (this may take a while)...');
|
||||
return self.wait_for_boot(emulator_id);
|
||||
}).then(function() {
|
||||
console.log('BOOT COMPLETE');
|
||||
|
||||
//unlock screen
|
||||
return exec('adb -s ' + emulator_id + ' shell input keyevent 82');
|
||||
}).then(function() {
|
||||
//return the new emulator id for the started emulators
|
||||
return emulator_id;
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Waits for the new emulator to apear on the started-emulator list.
|
||||
* Returns a promise with a list of newly started emulators' IDs.
|
||||
*/
|
||||
module.exports.wait_for_emulator = function(num_running) {
|
||||
var self = this;
|
||||
return self.list_started()
|
||||
.then(function(new_started) {
|
||||
if (new_started.length > num_running) {
|
||||
return new_started;
|
||||
} else {
|
||||
return Q.delay(1000).then(function() {
|
||||
return self.wait_for_emulator(num_running);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Waits for the boot animation property of the emulator to switch to 'stopped'
|
||||
*/
|
||||
module.exports.wait_for_boot = function(emulator_id) {
|
||||
var self = this;
|
||||
return exec('adb -s ' + emulator_id + ' shell getprop init.svc.bootanim')
|
||||
.then(function(output) {
|
||||
if (output.match(/stopped/)) {
|
||||
return;
|
||||
} else {
|
||||
process.stdout.write('.');
|
||||
return Q.delay(3000).then(function() {
|
||||
return self.wait_for_boot(emulator_id);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Create avd
|
||||
* TODO : Enter the stdin input required to complete the creation of an avd.
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.create_image = function(name, target) {
|
||||
console.log('Creating avd named ' + name);
|
||||
if (target) {
|
||||
return exec('android create avd --name ' + name + ' --target ' + target)
|
||||
.then(null, function(error) {
|
||||
console.error('ERROR : Failed to create emulator image : ');
|
||||
console.error(' Do you have the latest android targets including ' + target + '?');
|
||||
console.error(create.output);
|
||||
});
|
||||
} else {
|
||||
console.log('WARNING : Project target not found, creating avd with a different target but the project may fail to install.');
|
||||
return exec('android create avd --name ' + name + ' --target ' + this.list_targets()[0])
|
||||
.then(function() {
|
||||
// TODO: This seems like another error case, even though it always happens.
|
||||
console.error('ERROR : Unable to create an avd emulator, no targets found.');
|
||||
console.error('Please insure you have targets availible by runing the "android" command');
|
||||
return Q.reject();
|
||||
}, function(error) {
|
||||
console.error('ERROR : Failed to create emulator image : ');
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Installs a previously built application on the emulator and launches it.
|
||||
* If no target is specified, then it picks one.
|
||||
* If no started emulators are found, error out.
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.install = function(target) {
|
||||
var self = this;
|
||||
return this.list_started()
|
||||
.then(function(emulator_list) {
|
||||
if (emulator_list.length < 1) {
|
||||
return Q.reject('No started emulators found, please start an emultor before deploying your project.');
|
||||
}
|
||||
|
||||
// default emulator
|
||||
target = typeof target !== 'undefined' ? target : emulator_list[0];
|
||||
if (emulator_list.indexOf(target) < 0) {
|
||||
return Q.reject('Unable to find target \'' + target + '\'. Failed to deploy to emulator.');
|
||||
}
|
||||
|
||||
console.log('Installing app on emulator...');
|
||||
var apk_path = build.get_apk();
|
||||
return exec('adb -s ' + target + ' install -r ' + apk_path);
|
||||
}).then(function(output) {
|
||||
if (output.match(/Failure/)) {
|
||||
return Q.reject('Failed to install apk to emulator: ' + output);
|
||||
}
|
||||
return Q();
|
||||
}, function(err) {
|
||||
return Q.reject('Failed to install apk to emulator: ' + err);
|
||||
}).then(function() {
|
||||
//unlock screen
|
||||
return exec('adb -s ' + target + ' shell input keyevent 82');
|
||||
}).then(function() {
|
||||
// launch the application
|
||||
console.log('Launching application...');
|
||||
var launchName = appinfo.getActivityName();
|
||||
cmd = 'adb -s ' + target + ' shell am start -W -a android.intent.action.MAIN -n ' + launchName;
|
||||
return exec(cmd);
|
||||
}).then(function(output) {
|
||||
console.log('LAUNCH SUCCESS');
|
||||
}, function(err) {
|
||||
return Q.reject('Failed to launch app on emulator: ' + err);
|
||||
});
|
||||
}
|
||||
43
test/cordova/lib/exec.js
vendored
Normal file
43
test/cordova/lib/exec.js
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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 child_process = require('child_process'),
|
||||
Q = require('q');
|
||||
|
||||
// Takes a command and optional current working directory.
|
||||
// Returns a promise that either resolves with the stdout, or
|
||||
// rejects with an error message and the stderr.
|
||||
module.exports = function(cmd, opt_cwd) {
|
||||
var d = Q.defer();
|
||||
console.log('exec: ' + cmd);
|
||||
try {
|
||||
child_process.exec(cmd, {cwd: opt_cwd}, function(err, stdout, stderr) {
|
||||
console.log([cmd, err, stdout, stderr]);
|
||||
if (err) d.reject('Error executing "' + cmd + '": ' + stderr);
|
||||
else d.resolve(stdout);
|
||||
});
|
||||
} catch(e) {
|
||||
console.error('error caught: ' + e);
|
||||
d.reject(e);
|
||||
}
|
||||
return d.promise;
|
||||
}
|
||||
|
||||
42
test/cordova/lib/install-device
Executable file
42
test/cordova/lib/install-device
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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 device = require('./device'),
|
||||
args = process.argv;
|
||||
|
||||
if(args.length > 2) {
|
||||
var install_target;
|
||||
if (args[2].substring(0, 9) == '--target=') {
|
||||
install_target = args[2].substring(9, args[2].length);
|
||||
device.install(install_target).done(null, function(err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
} else {
|
||||
console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
|
||||
process.exit(2);
|
||||
}
|
||||
} else {
|
||||
device.install().done(null, function(err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
}
|
||||
26
test/cordova/lib/install-device.bat
Normal file
26
test/cordova/lib/install-device.bat
Normal file
@@ -0,0 +1,26 @@
|
||||
:: 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.
|
||||
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0install-device"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'install-device' script in 'cordova\lib' folder, aborting...>&2
|
||||
EXIT /B 1
|
||||
)
|
||||
38
test/cordova/lib/install-emulator
Executable file
38
test/cordova/lib/install-emulator
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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 emulator = require('./emulator'),
|
||||
args = process.argv;
|
||||
|
||||
var install_target;
|
||||
if(args.length > 2) {
|
||||
if (args[2].substring(0, 9) == '--target=') {
|
||||
install_target = args[2].substring(9, args[2].length);
|
||||
} else {
|
||||
console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
|
||||
process.exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
emulator.install(install_target).done(null, function(err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
26
test/cordova/lib/install-emulator.bat
Normal file
26
test/cordova/lib/install-emulator.bat
Normal file
@@ -0,0 +1,26 @@
|
||||
:: 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.
|
||||
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0install-emulator"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'install-emulator' script in 'cordova\lib' folder, aborting...>&2
|
||||
EXIT /B 1
|
||||
)
|
||||
33
test/cordova/lib/list-devices
Executable file
33
test/cordova/lib/list-devices
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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 devices = require('./device');
|
||||
|
||||
// Usage support for when args are given
|
||||
devices.list().done(function(device_list) {
|
||||
device_list && device_list.forEach(function(dev) {
|
||||
console.log(dev);
|
||||
});
|
||||
}, function(err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
|
||||
26
test/cordova/lib/list-devices.bat
Normal file
26
test/cordova/lib/list-devices.bat
Normal file
@@ -0,0 +1,26 @@
|
||||
:: 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.
|
||||
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0list-devices"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'list-devices' script in 'cordova\lib' folder, aborting...>&2
|
||||
EXIT /B 1
|
||||
)
|
||||
32
test/cordova/lib/list-emulator-images
Executable file
32
test/cordova/lib/list-emulator-images
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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 emulators = require('./emulator');
|
||||
|
||||
// Usage support for when args are given
|
||||
emulators.list_images().done(function(emulator_list) {
|
||||
emulator_list && emulator_list.forEach(function(emu) {
|
||||
console.log(emu.name);
|
||||
});
|
||||
}, function(err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
26
test/cordova/lib/list-emulator-images.bat
Normal file
26
test/cordova/lib/list-emulator-images.bat
Normal file
@@ -0,0 +1,26 @@
|
||||
:: 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.
|
||||
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0list-emulator-images"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'list-emulator-images' script in 'cordova\lib' folder, aborting...>&2
|
||||
EXIT /B 1
|
||||
)
|
||||
32
test/cordova/lib/list-started-emulators
Executable file
32
test/cordova/lib/list-started-emulators
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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 emulators = require('./emulator');
|
||||
|
||||
// Usage support for when args are given
|
||||
emulators.list_started().done(function(emulator_list) {
|
||||
emulator_list && emulator_list.forEach(function(emu) {
|
||||
console.log(emu);
|
||||
});
|
||||
}, function(err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
26
test/cordova/lib/list-started-emulators.bat
Normal file
26
test/cordova/lib/list-started-emulators.bat
Normal file
@@ -0,0 +1,26 @@
|
||||
:: 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.
|
||||
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0list-started-emulators"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'list-started-emulators' script in 'cordova\lib' folder, aborting...>&2
|
||||
EXIT /B 1
|
||||
)
|
||||
57
test/cordova/lib/log.js
vendored
Normal file
57
test/cordova/lib/log.js
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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'),
|
||||
path = require('path'),
|
||||
Q = require('q'),
|
||||
child_process = require('child_process'),
|
||||
ROOT = path.join(__dirname, '..', '..');
|
||||
|
||||
/*
|
||||
* Starts running logcat in the shell.
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.run = function() {
|
||||
var cmd = 'adb logcat | grep -v nativeGetEnabledTags';
|
||||
var d = Q.defer();
|
||||
var adb = child_process.spawn('adb', ['logcat']);
|
||||
|
||||
adb.stdout.on('data', function(data) {
|
||||
var lines = data ? data.toString().split('\n') : [];
|
||||
var out = lines.filter(function(x) { return x.indexOf('nativeGetEnabledTags') < 0; });
|
||||
console.log(out.join('\n'));
|
||||
});
|
||||
|
||||
adb.stderr.on('data', console.error);
|
||||
adb.on('close', function(code) {
|
||||
if (code > 0) {
|
||||
d.reject('Failed to run logcat command.');
|
||||
} else d.resolve();
|
||||
});
|
||||
|
||||
return d.promise;
|
||||
}
|
||||
|
||||
module.exports.help = function() {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), path.join(ROOT, 'corodva', 'log')));
|
||||
console.log('Gives the logcat output on the command line.');
|
||||
process.exit(0);
|
||||
}
|
||||
139
test/cordova/lib/run.js
vendored
Normal file
139
test/cordova/lib/run.js
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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 path = require('path'),
|
||||
build = require('./build'),
|
||||
emulator = require('./emulator'),
|
||||
device = require('./device'),
|
||||
Q = require('q');
|
||||
|
||||
/*
|
||||
* Runs the application on a device if availible.
|
||||
* If not device is found, it will use a started emulator.
|
||||
* If no started emulators are found it will attempt to start an avd.
|
||||
* If no avds are found it will error out.
|
||||
* Returns a promise.
|
||||
*/
|
||||
module.exports.run = function(args) {
|
||||
var build_type;
|
||||
var install_target;
|
||||
|
||||
for (var i=2; i<args.length; i++) {
|
||||
if (args[i] == '--debug') {
|
||||
build_type = '--debug';
|
||||
} else if (args[i] == '--release') {
|
||||
build_type = '--release';
|
||||
} else if (args[i] == '--nobuild') {
|
||||
build_type = '--nobuild';
|
||||
} else if (args[i] == '--device') {
|
||||
install_target = '--device';
|
||||
} else if (args[i] == '--emulator') {
|
||||
install_target = '--emulator';
|
||||
} else if (args[i].substring(0, 9) == '--target=') {
|
||||
install_target = args[i].substring(9, args[i].length);
|
||||
} else {
|
||||
console.error('ERROR : Run option \'' + args[i] + '\' not recognized.');
|
||||
process.exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
return build.run(build_type).then(function() {
|
||||
if (install_target == '--device') {
|
||||
return device.install();
|
||||
} else if (install_target == '--emulator') {
|
||||
return emulator.list_started().then(function(started) {
|
||||
var p = started && started.length > 0 ? Q() : emulator.start();
|
||||
return p.then(function() { emulator.install(); });
|
||||
});
|
||||
} else if (install_target) {
|
||||
var devices, started_emulators, avds;
|
||||
return device.list()
|
||||
.then(function(res) {
|
||||
devices = res;
|
||||
return emulator.list_started();
|
||||
}).then(function(res) {
|
||||
started_emulators = res;
|
||||
return emulator.list_images();
|
||||
}).then(function(res) {
|
||||
avds = res;
|
||||
if (devices.indexOf(install_target) > -1) {
|
||||
return device.install(install_target);
|
||||
} else if (started_emulators.indexOf(install_target) > -1) {
|
||||
return emulator.install(install_target);
|
||||
} else {
|
||||
// if target emulator isn't started, then start it.
|
||||
var emulator_ID;
|
||||
for(avd in avds) {
|
||||
if(avds[avd].name == install_target) {
|
||||
return emulator.start(install_target)
|
||||
.then(function() { emulator.install(emulator_ID); });
|
||||
}
|
||||
}
|
||||
return Q.reject('Target \'' + install_target + '\' not found, unable to run project');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// no target given, deploy to device if availible, otherwise use the emulator.
|
||||
return device.list()
|
||||
.then(function(device_list) {
|
||||
if (device_list.length > 0) {
|
||||
console.log('WARNING : No target specified, deploying to device \'' + device_list[0] + '\'.');
|
||||
return device.install(device_list[0]);
|
||||
} else {
|
||||
return emulator.list_started()
|
||||
.then(function(emulator_list) {
|
||||
if (emulator_list.length > 0) {
|
||||
console.log('WARNING : No target specified, deploying to emulator \'' + emulator_list[0] + '\'.');
|
||||
return emulator.install(emulator_list[0]);
|
||||
} else {
|
||||
console.log('WARNING : No started emulators found, starting an emulator.');
|
||||
return emulator.best_image()
|
||||
.then(function(best_avd) {
|
||||
if(best_avd) {
|
||||
return emulator.start(best_avd.name)
|
||||
.then(function(emulator_ID) {
|
||||
console.log('WARNING : No target specified, deploying to emulator \'' + emulator_ID + '\'.');
|
||||
return emulator.install(emulator_ID);
|
||||
});
|
||||
} else {
|
||||
return emulator.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.help = function() {
|
||||
console.log('Usage: ' + path.relative(process.cwd(), args[0]) + ' [options]');
|
||||
console.log('Build options :');
|
||||
console.log(' --debug : Builds project in debug mode');
|
||||
console.log(' --release : Builds project in release mode');
|
||||
console.log(' --nobuild : Runs the currently built project without recompiling');
|
||||
console.log('Deploy options :');
|
||||
console.log(' --device : Will deploy the built project to a device');
|
||||
console.log(' --emulator : Will deploy the built project to an emulator if one exists');
|
||||
console.log(' --target=<target_id> : Installs to the target with the specified id.');
|
||||
process.exit(0);
|
||||
}
|
||||
39
test/cordova/lib/start-emulator
Executable file
39
test/cordova/lib/start-emulator
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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 emulator = require('./emulator'),
|
||||
args = process.argv;
|
||||
|
||||
var install_target;
|
||||
if(args.length > 2) {
|
||||
if (args[2].substring(0, 9) == '--target=') {
|
||||
install_target = args[2].substring(9, args[2].length);
|
||||
} else {
|
||||
console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
|
||||
process.exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
emulator.start(install_target).done(null, function(err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
|
||||
26
test/cordova/lib/start-emulator.bat
Normal file
26
test/cordova/lib/start-emulator.bat
Normal file
@@ -0,0 +1,26 @@
|
||||
:: 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.
|
||||
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0start-emulator"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'start-emulator' script in 'cordova\lib' folder, aborting...>&2
|
||||
EXIT /B 1
|
||||
)
|
||||
36
test/cordova/log
Executable file
36
test/cordova/log
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
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 log = require('./lib/log'),
|
||||
reqs = require('./lib/check_reqs'),
|
||||
args = process.argv;
|
||||
|
||||
// Usage support for when args are given
|
||||
if(args.length > 2) {
|
||||
log.help();
|
||||
} else {
|
||||
reqs.run().done(function() {
|
||||
return log.run();
|
||||
}, function(err) {
|
||||
console.error('ERROR: ' + err);
|
||||
process.exit(2);
|
||||
});
|
||||
}
|
||||
26
test/cordova/log.bat
Normal file
26
test/cordova/log.bat
Normal file
@@ -0,0 +1,26 @@
|
||||
:: 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.
|
||||
|
||||
@ECHO OFF
|
||||
SET script_path="%~dp0log"
|
||||
IF EXIST %script_path% (
|
||||
node "%script_path%" %*
|
||||
) ELSE (
|
||||
ECHO.
|
||||
ECHO ERROR: Could not find 'log' script in 'cordova' folder, aborting...>&2
|
||||
EXIT /B 1
|
||||
)
|
||||
1
test/cordova/node_modules/.bin/shjs
generated
vendored
Symbolic link
1
test/cordova/node_modules/.bin/shjs
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../shelljs/bin/shjs
|
||||
40
test/cordova/node_modules/q/CONTRIBUTING.md
generated
vendored
Normal file
40
test/cordova/node_modules/q/CONTRIBUTING.md
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
For pull requests:
|
||||
|
||||
- Be consistent with prevalent style and design decisions.
|
||||
- Add a Jasmine spec to `specs/q-spec.js`.
|
||||
- Use `npm test` to avoid regressions.
|
||||
- Run tests in `q-spec/run.html` in as many supported browsers as you
|
||||
can find the will to deal with.
|
||||
- Do not build minified versions; we do this each release.
|
||||
- If you would be so kind, add a note to `CHANGES.md` in an
|
||||
appropriate section:
|
||||
|
||||
- `Next Major Version` if it introduces backward incompatibilities
|
||||
to code in the wild using documented features.
|
||||
- `Next Minor Version` if it adds a new feature.
|
||||
- `Next Patch Version` if it fixes a bug.
|
||||
|
||||
For releases:
|
||||
|
||||
- Run `npm test`.
|
||||
- Run tests in `q-spec/run.html` in a representative sample of every
|
||||
browser under the sun.
|
||||
- Run `npm run cover` and make sure you're happy with the results.
|
||||
- Run `npm run minify` and be sure to commit the resulting `q.min.js`.
|
||||
- Note the Gzipped size output by the previous command, and update
|
||||
`README.md` if it has changed to 1 significant digit.
|
||||
- Stash any local changes.
|
||||
- Update `CHANGES.md` to reflect all changes in the differences
|
||||
between `HEAD` and the previous tagged version. Give credit where
|
||||
credit is due.
|
||||
- Update `README.md` to address all new, non-experimental features.
|
||||
- Update the API reference on the Wiki to reflect all non-experimental
|
||||
features.
|
||||
- Use `npm version major|minor|patch` to update `package.json`,
|
||||
commit, and tag the new version.
|
||||
- Use `npm publish` to send up a new release.
|
||||
- Send an email to the q-continuum mailing list announcing the new
|
||||
release and the notes from the change log. This helps folks
|
||||
maintaining other package ecosystems.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user