├── VERSION
├── spec
├── fixtures
│ ├── android_project
│ │ ├── src
│ │ │ └── .gitkeep
│ │ ├── assets
│ │ │ └── www
│ │ │ │ └── .gitkeep
│ │ └── res
│ │ │ └── xml
│ │ │ └── config.xml
│ ├── org.test.plugins.dummyplugin
│ │ ├── extra.gradle
│ │ ├── plugin-lib
│ │ │ ├── libFile
│ │ │ ├── project.properties
│ │ │ └── AndroidManifest.xml
│ │ ├── plugin-lib2
│ │ │ ├── libFile
│ │ │ ├── project.properties
│ │ │ └── AndroidManifest.xml
│ │ ├── www
│ │ │ ├── dummyplugin.js
│ │ │ └── dummyplugin
│ │ │ │ └── image.jpg
│ │ ├── android-resource.xml
│ │ └── src
│ │ │ └── android
│ │ │ ├── TestLib.jar
│ │ │ └── DummyPlugin.java
│ └── org.test.plugins.faultyplugin
│ │ ├── src
│ │ └── android
│ │ │ └── FaultyPlugin.java
│ │ └── plugin.xml
├── .jshintrc
├── e2e
│ ├── fixtures
│ │ ├── cordova-plugin-fake
│ │ │ ├── platforms
│ │ │ │ └── android
│ │ │ │ │ └── FakeLib
│ │ │ │ │ └── project.properties
│ │ │ └── plugin.xml
│ │ └── cordova-plugin-fake-ios-frameworks
│ │ │ └── plugin.xml
│ ├── plugin.spec.js
│ └── create.spec.js
└── unit
│ ├── AndroidProject.spec.js
│ ├── run.spec.js
│ └── create.spec.js
├── .jshintignore
├── .ratignore
├── test
├── res
│ ├── drawable
│ │ └── icon.png
│ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ ├── drawable-ldpi
│ │ └── ic_launcher.png
│ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ ├── values
│ │ └── strings.xml
│ ├── layout
│ │ └── main.xml
│ └── xml
│ │ └── config.xml
├── project.properties
├── .classpath
├── .project
├── assets
│ └── www
│ │ ├── cordova_plugins.js
│ │ ├── main.js
│ │ ├── whitelist
│ │ ├── index2.html
│ │ └── index.html
│ │ ├── htmlnotfound
│ │ └── error.html
│ │ ├── jqmtabbackbutton
│ │ ├── tab1.html
│ │ ├── tab2.html
│ │ ├── tab3.html
│ │ └── index.html
│ │ ├── backbuttonmultipage
│ │ ├── index.html
│ │ ├── sample2.html
│ │ └── sample3.html
│ │ ├── backgroundcolor
│ │ └── index.html
│ │ ├── fullscreen
│ │ └── index.html
│ │ ├── iframe
│ │ ├── index2.html
│ │ └── index.html
│ │ ├── basicauth
│ │ └── index.html
│ │ ├── menus
│ │ └── index.html
│ │ ├── userwebview
│ │ └── index.html
│ │ └── xhr
│ │ └── index.html
├── settings.gradle
├── src
│ └── org
│ │ └── apache
│ │ └── cordova
│ │ └── test
│ │ ├── LifeCyclePlugin.java
│ │ ├── MainTestActivity.java
│ │ ├── BaseTestCordovaActivity.java
│ │ └── CordovaWebViewTestActivity.java
├── androidTest
│ └── src
│ │ └── org
│ │ └── apache
│ │ └── cordova
│ │ └── test
│ │ ├── IntentPreferenceTest.java
│ │ ├── HtmlNotFoundTest.java
│ │ ├── CordovaActivityTest.java
│ │ ├── ErrorUrlTest.java
│ │ ├── BaseCordovaIntegrationTest.java
│ │ ├── InflateLayoutTest.java
│ │ └── CordovaPluginTest.java
├── README.md
└── build.gradle
├── bin
├── templates
│ ├── project
│ │ ├── assets
│ │ │ └── www
│ │ │ │ ├── img
│ │ │ │ ├── logo.png
│ │ │ │ └── cordova.png
│ │ │ │ ├── js
│ │ │ │ └── index.js
│ │ │ │ └── index.html
│ │ ├── res
│ │ │ ├── drawable-hdpi
│ │ │ │ └── icon.png
│ │ │ ├── drawable-ldpi
│ │ │ │ └── icon.png
│ │ │ ├── drawable-mdpi
│ │ │ │ └── icon.png
│ │ │ ├── drawable-xhdpi
│ │ │ │ └── icon.png
│ │ │ ├── drawable-land-hdpi
│ │ │ │ └── screen.png
│ │ │ ├── drawable-land-ldpi
│ │ │ │ └── screen.png
│ │ │ ├── drawable-land-mdpi
│ │ │ │ └── screen.png
│ │ │ ├── drawable-port-hdpi
│ │ │ │ └── screen.png
│ │ │ ├── drawable-port-ldpi
│ │ │ │ └── screen.png
│ │ │ ├── drawable-port-mdpi
│ │ │ │ └── screen.png
│ │ │ ├── drawable-land-xhdpi
│ │ │ │ └── screen.png
│ │ │ ├── drawable-port-xhdpi
│ │ │ │ └── screen.png
│ │ │ ├── values
│ │ │ │ └── strings.xml
│ │ │ └── xml
│ │ │ │ └── config.xml
│ │ ├── gitignore
│ │ ├── project.properties
│ │ ├── Activity.java
│ │ └── AndroidManifest.xml
│ └── cordova
│ │ ├── .jshintrc
│ │ ├── loggingHelper.js
│ │ ├── log.bat
│ │ ├── run.bat
│ │ ├── build.bat
│ │ ├── clean.bat
│ │ ├── version.bat
│ │ ├── version
│ │ ├── defaults.xml
│ │ ├── lib
│ │ ├── list-devices.bat
│ │ ├── install-device.bat
│ │ ├── start-emulator.bat
│ │ ├── install-emulator.bat
│ │ ├── list-emulator-images.bat
│ │ ├── list-started-emulators.bat
│ │ ├── list-devices
│ │ ├── list-emulator-images
│ │ ├── list-started-emulators
│ │ ├── install-emulator
│ │ ├── start-emulator
│ │ ├── install-device
│ │ ├── builders
│ │ │ └── builders.js
│ │ ├── log.js
│ │ ├── retry.js
│ │ └── plugin-build.gradle
│ │ ├── log
│ │ ├── build
│ │ ├── clean
│ │ └── run
├── create.bat
├── update.bat
├── check_reqs.bat
├── android_sdk_version.bat
├── android_sdk_version
├── check_reqs
├── update
├── lib
│ └── android_sdk_version.js
└── create
├── .jshintrc
├── framework
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── .classpath
├── default.properties
├── project.properties
├── .project
├── AndroidManifest.xml
├── src
│ └── org
│ │ └── apache
│ │ └── cordova
│ │ ├── ICordovaCookieManager.java
│ │ ├── ExposedJsApi.java
│ │ ├── ICordovaHttpAuthHandler.java
│ │ ├── CordovaHttpAuthHandler.java
│ │ ├── AuthenticationToken.java
│ │ ├── engine
│ │ ├── SystemExposedJsApi.java
│ │ └── SystemCookieManager.java
│ │ ├── ICordovaClientCertRequest.java
│ │ ├── Config.java
│ │ ├── PluginEntry.java
│ │ └── CallbackMap.java
├── ant.properties
└── build.gradle
├── .reviewboardrc
├── .travis.yml
├── appveyor.yml
├── NOTICE
├── cordova-js-src
└── android
│ ├── nativeapiprovider.js
│ └── promptbasednativeapi.js
├── package.json
├── .gitattributes
└── CONTRIBUTING.md
/VERSION:
--------------------------------------------------------------------------------
1 | 5.3.0-dev
2 |
--------------------------------------------------------------------------------
/spec/fixtures/android_project/src/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/spec/fixtures/android_project/assets/www/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/spec/fixtures/org.test.plugins.dummyplugin/extra.gradle:
--------------------------------------------------------------------------------
1 | extra.gradle
2 |
--------------------------------------------------------------------------------
/spec/fixtures/org.test.plugins.dummyplugin/plugin-lib/libFile:
--------------------------------------------------------------------------------
1 | libFile contents
2 |
--------------------------------------------------------------------------------
/spec/fixtures/org.test.plugins.dummyplugin/plugin-lib2/libFile:
--------------------------------------------------------------------------------
1 | libFile contents
2 |
--------------------------------------------------------------------------------
/.jshintignore:
--------------------------------------------------------------------------------
1 | bin/node_modules/*
2 | bin/templates/project/*
3 | spec/fixtures/*
4 |
--------------------------------------------------------------------------------
/.ratignore:
--------------------------------------------------------------------------------
1 | *.properties
2 | bin
3 | gen
4 | proguard-project.txt
5 | spec
6 | appveyor.yml
7 |
--------------------------------------------------------------------------------
/spec/fixtures/org.test.plugins.dummyplugin/plugin-lib/project.properties:
--------------------------------------------------------------------------------
1 | target=android-11
2 |
--------------------------------------------------------------------------------
/spec/fixtures/org.test.plugins.dummyplugin/plugin-lib2/project.properties:
--------------------------------------------------------------------------------
1 | target=android-11
2 |
--------------------------------------------------------------------------------
/spec/fixtures/org.test.plugins.dummyplugin/www/dummyplugin.js:
--------------------------------------------------------------------------------
1 | ./org.test.plugins.dummyplugin/www/dummyplugin.js
2 |
--------------------------------------------------------------------------------
/test/res/drawable/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/test/res/drawable/icon.png
--------------------------------------------------------------------------------
/spec/fixtures/org.test.plugins.dummyplugin/android-resource.xml:
--------------------------------------------------------------------------------
1 | ./org.test.plugins.dummyplugin/android-resource.xml
2 |
--------------------------------------------------------------------------------
/spec/fixtures/org.test.plugins.dummyplugin/src/android/TestLib.jar:
--------------------------------------------------------------------------------
1 | ./org.test.plugins.dummyplugin/src/android/TestLib.jar
2 |
--------------------------------------------------------------------------------
/spec/fixtures/org.test.plugins.dummyplugin/www/dummyplugin/image.jpg:
--------------------------------------------------------------------------------
1 | ./org.test.plugins.dummyplugin/www/dummyplugin/image.jpg
2 |
--------------------------------------------------------------------------------
/spec/fixtures/org.test.plugins.dummyplugin/src/android/DummyPlugin.java:
--------------------------------------------------------------------------------
1 | ./org.test.plugins.dummyplugin/src/android/DummyPlugin.java
2 |
--------------------------------------------------------------------------------
/test/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/test/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/test/res/drawable-ldpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/test/res/drawable-ldpi/ic_launcher.png
--------------------------------------------------------------------------------
/test/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/test/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/templates/project/assets/www/img/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/bin/templates/project/assets/www/img/logo.png
--------------------------------------------------------------------------------
/spec/fixtures/org.test.plugins.faultyplugin/src/android/FaultyPlugin.java:
--------------------------------------------------------------------------------
1 | ./org.test.plugins.faultyplugin/src/android/org.test.plugins.faultyplugin.java
2 |
--------------------------------------------------------------------------------
/bin/templates/project/assets/www/img/cordova.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/bin/templates/project/assets/www/img/cordova.png
--------------------------------------------------------------------------------
/bin/templates/project/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/bin/templates/project/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/bin/templates/project/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/bin/templates/project/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/bin/templates/project/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/bin/templates/project/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/bin/templates/project/res/drawable-xhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/bin/templates/project/res/drawable-xhdpi/icon.png
--------------------------------------------------------------------------------
/bin/templates/project/res/drawable-land-hdpi/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/bin/templates/project/res/drawable-land-hdpi/screen.png
--------------------------------------------------------------------------------
/bin/templates/project/res/drawable-land-ldpi/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/bin/templates/project/res/drawable-land-ldpi/screen.png
--------------------------------------------------------------------------------
/bin/templates/project/res/drawable-land-mdpi/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/bin/templates/project/res/drawable-land-mdpi/screen.png
--------------------------------------------------------------------------------
/bin/templates/project/res/drawable-port-hdpi/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/bin/templates/project/res/drawable-port-hdpi/screen.png
--------------------------------------------------------------------------------
/bin/templates/project/res/drawable-port-ldpi/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/bin/templates/project/res/drawable-port-ldpi/screen.png
--------------------------------------------------------------------------------
/bin/templates/project/res/drawable-port-mdpi/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/bin/templates/project/res/drawable-port-mdpi/screen.png
--------------------------------------------------------------------------------
/bin/templates/project/res/drawable-land-xhdpi/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/bin/templates/project/res/drawable-land-xhdpi/screen.png
--------------------------------------------------------------------------------
/bin/templates/project/res/drawable-port-xhdpi/screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/functions/cordova-android/master/bin/templates/project/res/drawable-port-xhdpi/screen.png
--------------------------------------------------------------------------------
/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "node": true
3 | , "bitwise": true
4 | , "undef": true
5 | , "trailing": true
6 | , "quotmark": true
7 | , "indent": 4
8 | , "unused": "vars"
9 | , "latedef": "nofunc"
10 | }
11 |
--------------------------------------------------------------------------------
/framework/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
3 | org.eclipse.jdt.core.compiler.compliance=1.6
4 | org.eclipse.jdt.core.compiler.source=1.6
5 |
--------------------------------------------------------------------------------
/.reviewboardrc:
--------------------------------------------------------------------------------
1 | #
2 | # Settings for post-review (used for uploading diffs to reviews.apache.org).
3 | #
4 | GUESS_FIELDS = True
5 | OPEN_BROWSER = True
6 | TARGET_GROUPS = 'cordova'
7 | REVIEWBOARD_URL = 'http://reviews.apache.org'
8 |
9 |
--------------------------------------------------------------------------------
/bin/templates/cordova/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "node": true
3 | , "bitwise": true
4 | , "undef": true
5 | , "trailing": true
6 | , "quotmark": true
7 | , "indent": 4
8 | , "unused": "vars"
9 | , "latedef": "nofunc"
10 | }
11 |
--------------------------------------------------------------------------------
/spec/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "node": true
3 | , "bitwise": true
4 | , "undef": true
5 | , "trailing": true
6 | , "quotmark": true
7 | , "indent": 4
8 | , "unused": "vars"
9 | , "latedef": "nofunc"
10 | , "jasmine": true
11 | }
12 |
--------------------------------------------------------------------------------
/bin/templates/project/gitignore:
--------------------------------------------------------------------------------
1 | # Non-project-specific build files:
2 | build.xml
3 | local.properties
4 | /gradlew
5 | /gradlew.bat
6 | /gradle
7 | # Ant builds
8 | ant-build
9 | ant-gen
10 | # Eclipse builds
11 | gen
12 | out
13 | # Gradle builds
14 | /build
15 |
--------------------------------------------------------------------------------
/spec/fixtures/org.test.plugins.dummyplugin/plugin-lib/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/spec/fixtures/org.test.plugins.dummyplugin/plugin-lib2/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: android
2 | sudo: false
3 | install:
4 | - npm install
5 | - npm install -g codecov
6 | - echo y | android update sdk -u --filter android-22,android-23
7 | script:
8 | - npm run jshint
9 | - npm run cover
10 | - npm run test-build
11 | after_script:
12 | - codecov
13 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | environment:
2 | matrix:
3 | - nodejs_version: "0.10"
4 | - nodejs_version: "0.12"
5 | - nodejs_version: "4.2"
6 |
7 | install:
8 | # - cinst android-sdk
9 | # - echo y | android update sdk -u --filter android-22,android-23
10 | - ps: Install-Product node $env:nodejs_version
11 | - npm install
12 |
13 | build: off
14 |
15 | test_script:
16 | - node --version
17 | - npm --version
18 | - npm run test
19 | # - npm run test-build
20 |
--------------------------------------------------------------------------------
/test/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Project target.
11 | target=android-21
12 | android.library.reference.1=../framework
13 |
--------------------------------------------------------------------------------
/bin/templates/project/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | __NAME__
5 |
6 | @string/app_name
7 |
8 | @string/launcher_name
9 |
10 |
--------------------------------------------------------------------------------
/test/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/framework/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/framework/default.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "build.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Indicates whether an apk should be generated for each density.
11 | split.density=false
12 | # Project target.
13 | target=android-14
14 | apk-configurations=
15 |
--------------------------------------------------------------------------------
/bin/templates/cordova/loggingHelper.js:
--------------------------------------------------------------------------------
1 | var CordovaLogger = require('cordova-common').CordovaLogger;
2 |
3 | module.exports = {
4 | adjustLoggerLevel: function (opts) {
5 | if (opts instanceof Array) {
6 | opts.silent = opts.indexOf('--silent') !== -1;
7 | opts.verbose = opts.indexOf('--verbose') !== -1;
8 | }
9 |
10 | if (opts.silent) {
11 | CordovaLogger.get().setLevel('error');
12 | }
13 |
14 | if (opts.verbose) {
15 | CordovaLogger.get().setLevel('verbose');
16 | }
17 | }
18 | };
19 |
--------------------------------------------------------------------------------
/framework/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Indicates whether an apk should be generated for each density.
11 | split.density=false
12 | # Project target.
13 | target=android-23
14 | apk-configurations=
15 | renderscript.opt.level=O0
16 | android.library=true
17 |
--------------------------------------------------------------------------------
/bin/templates/project/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | android.library.reference.1=CordovaLib
14 | # Project target.
15 | target=This_gets_replaced
16 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | Apache Cordova
2 | Copyright 2015 The Apache Software Foundation
3 |
4 | This product includes software developed at
5 | The Apache Software Foundation (http://www.apache.org)
6 |
7 | =========================================================================
8 | == NOTICE file corresponding to the section 4 d of ==
9 | == the Apache License, Version 2.0, ==
10 | == in this case for the Android-specific code. ==
11 | =========================================================================
12 |
13 | This product includes software developed as part of
14 | The Android Open Source Project (http://source.android.com).
15 |
16 |
--------------------------------------------------------------------------------
/spec/e2e/fixtures/cordova-plugin-fake/platforms/android/FakeLib/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | android.library=true
14 | # Project target.
15 | target=android-9
16 |
--------------------------------------------------------------------------------
/test/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | CordovaViewTestActivity
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/test/assets/www/cordova_plugins.js:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | cordova.define('cordova/plugin_list', function(require, exports, module) {
21 | module.exports = [];
22 | });
23 |
--------------------------------------------------------------------------------
/test/settings.gradle:
--------------------------------------------------------------------------------
1 | /* Licensed to the Apache Software Foundation (ASF) under one
2 | or more contributor license agreements. See the NOTICE file
3 | distributed with this work for additional information
4 | regarding copyright ownership. The ASF licenses this file
5 | to you under the Apache License, Version 2.0 (the
6 | "License"); you may not use this file except in compliance
7 | with the License. You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing,
12 | software distributed under the License is distributed on an
13 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | KIND, either express or implied. See the License for the
15 | specific language governing permissions and limitations
16 | under the License.
17 | */
18 |
19 | include ":"
20 | include ":CordovaLib"
21 | project(':CordovaLib').projectDir = new File('../framework')
22 |
23 |
--------------------------------------------------------------------------------
/test/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 | CordovaNativeTests
22 |
23 |
--------------------------------------------------------------------------------
/bin/create.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0create"
20 | IF EXIST %script_path% (
21 | node %script_path% %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'create' script in 'bin' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/bin/update.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0update"
20 | IF EXIST %script_path% (
21 | node %script_path% %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'update' script in 'bin' folder, aborting...>&2
25 | EXIT /B 1
26 | )
27 |
--------------------------------------------------------------------------------
/bin/templates/cordova/log.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0log"
20 | IF EXIST %script_path% (
21 | node %script_path% %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'log' script in 'cordova' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/bin/templates/cordova/run.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0run"
20 | IF EXIST %script_path% (
21 | node %script_path% %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'run' script in 'cordova' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/bin/templates/cordova/build.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0build"
20 | IF EXIST %script_path% (
21 | node %script_path% %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/bin/templates/cordova/clean.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0clean"
20 | IF EXIST %script_path% (
21 | node %script_path% %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'clean' script in 'cordova' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/bin/check_reqs.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0check_reqs"
20 | IF EXIST %script_path% (
21 | node "%script_path%" %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'check_reqs' script in 'bin' folder, aborting...>&2
25 | EXIT /B 1
26 | )
27 |
--------------------------------------------------------------------------------
/bin/templates/cordova/version.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0version"
20 | IF EXIST %script_path% (
21 | node %script_path% %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'version' script in 'cordova' folder, aborting...>&2
25 | EXIT /B 1
26 | )
27 |
--------------------------------------------------------------------------------
/framework/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Cordova
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/bin/android_sdk_version.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0android_sdk_version"
20 | IF EXIST %script_path% (
21 | node "%script_path%" %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'android_sdk_version' script in 'bin' folder, aborting...>&2
25 | EXIT /B 1
26 | )
27 |
--------------------------------------------------------------------------------
/bin/templates/cordova/version:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | // Coho updates this line:
23 | var VERSION = "5.3.0-dev";
24 |
25 | module.exports.version = VERSION;
26 |
27 | if (!module.parent) {
28 | console.log(VERSION);
29 | }
30 |
--------------------------------------------------------------------------------
/bin/templates/cordova/defaults.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/bin/templates/cordova/lib/list-devices.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0list-devices"
20 | IF EXIST %script_path% (
21 | node "%script_path%" %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'list-devices' script in 'cordova\lib' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/bin/templates/cordova/lib/install-device.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0install-device"
20 | IF EXIST %script_path% (
21 | node "%script_path%" %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'install-device' script in 'cordova\lib' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/bin/templates/cordova/lib/start-emulator.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0start-emulator"
20 | IF EXIST %script_path% (
21 | node "%script_path%" %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'start-emulator' script in 'cordova\lib' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/bin/templates/cordova/lib/install-emulator.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0install-emulator"
20 | IF EXIST %script_path% (
21 | node "%script_path%" %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'install-emulator' script in 'cordova\lib' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/bin/android_sdk_version:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var android_sdk_version = require('./lib/android_sdk_version');
23 |
24 | android_sdk_version.run().done(null, function(err) {
25 | console.log(err);
26 | process.exit(2);
27 | });
28 |
29 |
30 |
--------------------------------------------------------------------------------
/bin/templates/cordova/lib/list-emulator-images.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0list-emulator-images"
20 | IF EXIST %script_path% (
21 | node "%script_path%" %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'list-emulator-images' script in 'cordova\lib' folder, aborting...>&2
25 | EXIT /B 1
26 | )
27 |
--------------------------------------------------------------------------------
/bin/templates/cordova/lib/list-started-emulators.bat:
--------------------------------------------------------------------------------
1 | :: Licensed to the Apache Software Foundation (ASF) under one
2 | :: or more contributor license agreements. See the NOTICE file
3 | :: distributed with this work for additional information
4 | :: regarding copyright ownership. The ASF licenses this file
5 | :: to you under the Apache License, Version 2.0 (the
6 | :: "License"); you may not use this file except in compliance
7 | :: with the License. You may obtain a copy of the License at
8 | ::
9 | :: http://www.apache.org/licenses/LICENSE-2.0
10 | ::
11 | :: Unless required by applicable law or agreed to in writing,
12 | :: software distributed under the License is distributed on an
13 | :: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | :: KIND, either express or implied. See the License for the
15 | :: specific language governing permissions and limitations
16 | :: under the License.
17 |
18 | @ECHO OFF
19 | SET script_path="%~dp0list-started-emulators"
20 | IF EXIST %script_path% (
21 | node "%script_path%" %*
22 | ) ELSE (
23 | ECHO.
24 | ECHO ERROR: Could not find 'list-started-emulators' script in 'cordova\lib' folder, aborting...>&2
25 | EXIT /B 1
26 | )
--------------------------------------------------------------------------------
/framework/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/test/assets/www/main.js:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | var deviceInfo = function() {
21 | document.getElementById("deviceready").innerHTML = "fired";
22 | document.getElementById("cordova").innerHTML = cordova.version;
23 | };
24 |
25 | function init() {
26 | document.addEventListener("deviceready", deviceInfo, true);
27 | }
28 |
--------------------------------------------------------------------------------
/bin/check_reqs:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var check_reqs = require('./lib/check_reqs');
23 |
24 | check_reqs.run().done(
25 | function success() {
26 | console.log('Looks like your environment fully supports cordova-android development!');
27 | }, function fail(err) {
28 | console.log(err);
29 | process.exit(2);
30 | }
31 | );
32 |
--------------------------------------------------------------------------------
/framework/src/org/apache/cordova/ICordovaCookieManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | package org.apache.cordova;
21 |
22 | public interface ICordovaCookieManager {
23 |
24 | public void setCookiesEnabled(boolean accept);
25 |
26 | public void setCookie(final String url, final String value);
27 |
28 | public String getCookie(final String url);
29 |
30 | public void clearCookies();
31 |
32 | public void flush();
33 | };
34 |
--------------------------------------------------------------------------------
/bin/templates/project/Activity.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | package __ID__;
21 |
22 | import android.os.Bundle;
23 | import org.apache.cordova.*;
24 |
25 | public class __ACTIVITY__ extends CordovaActivity
26 | {
27 | @Override
28 | public void onCreate(Bundle savedInstanceState)
29 | {
30 | super.onCreate(savedInstanceState);
31 | // Set by in config.xml
32 | loadUrl(launchUrl);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/bin/templates/cordova/log:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var log = require('./lib/log'),
23 | reqs = require('./lib/check_reqs'),
24 | args = process.argv;
25 |
26 | // Usage support for when args are given
27 | if(args.length > 2) {
28 | log.help();
29 | } else {
30 | reqs.run().done(function() {
31 | return log.run();
32 | }, function(err) {
33 | console.error('ERROR: ' + err);
34 | process.exit(2);
35 | });
36 | }
37 |
--------------------------------------------------------------------------------
/test/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
24 |
25 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/bin/templates/cordova/lib/list-devices:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var devices = require('./device');
23 |
24 | // Usage support for when args are given
25 | require('../lib/check_reqs').check_android().then(function() {
26 | devices.list().done(function(device_list) {
27 | device_list && device_list.forEach(function(dev) {
28 | console.log(dev);
29 | });
30 | }, function(err) {
31 | console.error('ERROR: ' + err);
32 | process.exit(2);
33 | });
34 | });
35 |
--------------------------------------------------------------------------------
/bin/templates/cordova/lib/list-emulator-images:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var emulators = require('./emulator');
23 |
24 | // Usage support for when args are given
25 | require('../lib/check_reqs').check_android().then(function() {
26 | emulators.list_images().done(function(emulator_list) {
27 | emulator_list && emulator_list.forEach(function(emu) {
28 | console.log(emu.name);
29 | });
30 | }, function(err) {
31 | console.error('ERROR: ' + err);
32 | process.exit(2);
33 | });
34 | });
35 |
--------------------------------------------------------------------------------
/bin/templates/cordova/lib/list-started-emulators:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var emulators = require('./emulator');
23 |
24 | // Usage support for when args are given
25 | require('../lib/check_reqs').check_android().then(function() {
26 | emulators.list_started().done(function(emulator_list) {
27 | emulator_list && emulator_list.forEach(function(emu) {
28 | console.log(emu);
29 | });
30 | }, function(err) {
31 | console.error('ERROR: ' + err);
32 | process.exit(2);
33 | });
34 | });
35 |
--------------------------------------------------------------------------------
/spec/unit/AndroidProject.spec.js:
--------------------------------------------------------------------------------
1 | /**
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | var path = require('path');
21 | var AndroidProject = require('../../bin/templates/cordova/lib/AndroidProject');
22 | var android_project = path.join(__dirname, '../fixtures/android_project');
23 |
24 | describe('AndroidProject class', function() {
25 | describe('getPackageName method', function() {
26 | it('should return an android project\'s proper package name', function() {
27 | expect(AndroidProject.getProjectFile(android_project).getPackageName())
28 | .toEqual('com.alunny.childapp');
29 | });
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/cordova-js-src/android/nativeapiprovider.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | /**
21 | * Exports the ExposedJsApi.java object if available, otherwise exports the PromptBasedNativeApi.
22 | */
23 |
24 | var nativeApi = this._cordovaNative || require('cordova/android/promptbasednativeapi');
25 | var currentApi = nativeApi;
26 |
27 | module.exports = {
28 | get: function() { return currentApi; },
29 | setPreferPrompt: function(value) {
30 | currentApi = value ? require('cordova/android/promptbasednativeapi') : nativeApi;
31 | },
32 | // Used only by tests.
33 | set: function(value) {
34 | currentApi = value;
35 | }
36 | };
37 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cordova-android",
3 | "version": "5.3.0-dev",
4 | "description": "cordova-android release",
5 | "bin": {
6 | "create": "bin/create"
7 | },
8 | "main": "bin/templates/cordova/Api.js",
9 | "repository": {
10 | "type": "git",
11 | "url": "https://git-wip-us.apache.org/repos/asf/cordova-android.git"
12 | },
13 | "keywords": [
14 | "android",
15 | "cordova",
16 | "apache"
17 | ],
18 | "scripts": {
19 | "test": "npm run jshint && jasmine-node --color spec/unit",
20 | "cover": "istanbul cover --root bin/templates/cordova --print detail node_modules/jasmine-node/bin/jasmine-node -- spec/unit",
21 | "test-build": "jasmine-node --captureExceptions --color spec/e2e",
22 | "jshint": "node node_modules/jshint/bin/jshint bin && node node_modules/jshint/bin/jshint spec"
23 | },
24 | "author": "Apache Software Foundation",
25 | "license": "Apache-2.0",
26 | "dependencies": {
27 | "cordova-common": "^1.3.0",
28 | "elementtree": "^0.1.6",
29 | "nopt": "^3.0.1",
30 | "properties-parser": "^0.2.3",
31 | "q": "^1.4.1",
32 | "shelljs": "^0.5.3"
33 | },
34 | "bundledDependencies": [
35 | "cordova-common",
36 | "elementtree",
37 | "nopt",
38 | "properties-parser",
39 | "q",
40 | "shelljs"
41 | ],
42 | "devDependencies": {
43 | "istanbul": "^0.4.2",
44 | "jasmine-node": "^1.14.5",
45 | "jshint": "^2.6.0",
46 | "promise-matchers": "~0",
47 | "rewire": "^2.1.3"
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/bin/templates/cordova/lib/install-emulator:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var emulator = require('./emulator'),
23 | args = process.argv;
24 |
25 | var install_target;
26 | if(args.length > 2) {
27 | if (args[2].substring(0, 9) == '--target=') {
28 | install_target = args[2].substring(9, args[2].length);
29 | } else {
30 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
31 | process.exit(2);
32 | }
33 | }
34 |
35 | emulator.install(install_target).done(null, function(err) {
36 | console.error('ERROR: ' + err);
37 | process.exit(2);
38 | });
39 |
--------------------------------------------------------------------------------
/bin/templates/cordova/lib/start-emulator:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var emulator = require('./emulator'),
23 | args = process.argv;
24 |
25 | var install_target;
26 | if(args.length > 2) {
27 | if (args[2].substring(0, 9) == '--target=') {
28 | install_target = args[2].substring(9, args[2].length);
29 | } else {
30 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
31 | process.exit(2);
32 | }
33 | }
34 |
35 | emulator.start(install_target).done(null, function(err) {
36 | console.error('ERROR: ' + err);
37 | process.exit(2);
38 | });
39 |
40 |
--------------------------------------------------------------------------------
/framework/src/org/apache/cordova/ExposedJsApi.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | package org.apache.cordova;
21 |
22 | import org.json.JSONException;
23 |
24 | /*
25 | * Any exposed Javascript API MUST implement these three things!
26 | */
27 | public interface ExposedJsApi {
28 | public String exec(int bridgeSecret, String service, String action, String callbackId, String arguments) throws JSONException, IllegalAccessException;
29 | public void setNativeToJsBridgeMode(int bridgeSecret, int value) throws IllegalAccessException;
30 | public String retrieveJsMessages(int bridgeSecret, boolean fromOnlineEvent) throws IllegalAccessException;
31 | }
32 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text eol=lf
2 |
3 | # source code
4 | *.php text
5 | *.css text
6 | *.sass text
7 | *.scss text
8 | *.less text
9 | *.styl text
10 | *.js text
11 | *.coffee text
12 | *.json text
13 | *.htm text
14 | *.html text
15 | *.xml text
16 | *.svg text
17 | *.txt text
18 | *.ini text
19 | *.inc text
20 | *.pl text
21 | *.rb text
22 | *.py text
23 | *.scm text
24 | *.sql text
25 | *.sh text
26 | *.bat text
27 |
28 | # templates
29 | *.ejs text
30 | *.hbt text
31 | *.jade text
32 | *.haml text
33 | *.hbs text
34 | *.dot text
35 | *.tmpl text
36 | *.phtml text
37 |
38 | # server config
39 | .htaccess text
40 |
41 | # git config
42 | .gitattributes text
43 | .gitignore text
44 | .gitconfig text
45 |
46 | # code analysis config
47 | .jshintrc text
48 | .jscsrc text
49 | .jshintignore text
50 | .csslintrc text
51 |
52 | # misc config
53 | *.yaml text
54 | *.yml text
55 | .editorconfig text
56 |
57 | # build config
58 | *.npmignore text
59 | *.bowerrc text
60 |
61 | # Heroku
62 | Procfile text
63 | .slugignore text
64 |
65 | # Documentation
66 | *.md text
67 | LICENSE text
68 | AUTHORS text
69 |
70 |
71 | #
72 | ## These files are binary and should be left untouched
73 | #
74 |
75 | # (binary is a macro for -text -diff)
76 | *.png binary
77 | *.jpg binary
78 | *.jpeg binary
79 | *.gif binary
80 | *.ico binary
81 | *.mov binary
82 | *.mp4 binary
83 | *.mp3 binary
84 | *.flv binary
85 | *.fla binary
86 | *.swf binary
87 | *.gz binary
88 | *.zip binary
89 | *.7z binary
90 | *.ttf binary
91 | *.eot binary
92 | *.woff binary
93 | *.pyc binary
94 | *.pdf binary
95 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 |
21 |
22 | # Contributing to Apache Cordova
23 |
24 | Anyone can contribute to Cordova. And we need your contributions.
25 |
26 | There are multiple ways to contribute: report bugs, improve the docs, and
27 | contribute code.
28 |
29 | For instructions on this, start with the
30 | [contribution overview](http://cordova.apache.org/contribute/).
31 |
32 | The details are explained there, but the important items are:
33 | - Sign and submit an Apache ICLA (Contributor License Agreement).
34 | - Have a Jira issue open that corresponds to your contribution.
35 | - Run the tests so your patch doesn't break existing functionality.
36 |
37 | We look forward to your contributions!
38 |
39 |
--------------------------------------------------------------------------------
/cordova-js-src/android/promptbasednativeapi.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | /**
21 | * Implements the API of ExposedJsApi.java, but uses prompt() to communicate.
22 | * This is used pre-JellyBean, where addJavascriptInterface() is disabled.
23 | */
24 |
25 | module.exports = {
26 | exec: function(bridgeSecret, service, action, callbackId, argsJson) {
27 | return prompt(argsJson, 'gap:'+JSON.stringify([bridgeSecret, service, action, callbackId]));
28 | },
29 | setNativeToJsBridgeMode: function(bridgeSecret, value) {
30 | prompt(value, 'gap_bridge_mode:' + bridgeSecret);
31 | },
32 | retrieveJsMessages: function(bridgeSecret, fromOnlineEvent) {
33 | return prompt(+fromOnlineEvent, 'gap_poll:' + bridgeSecret);
34 | }
35 | };
36 |
--------------------------------------------------------------------------------
/framework/src/org/apache/cordova/ICordovaHttpAuthHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 | package org.apache.cordova;
20 |
21 | /**
22 | * Specifies interface for HTTP auth handler object which is used to handle auth requests and
23 | * specifying user credentials.
24 | */
25 | public interface ICordovaHttpAuthHandler {
26 | /**
27 | * Instructs the WebView to cancel the authentication request.
28 | */
29 | public void cancel ();
30 |
31 | /**
32 | * Instructs the WebView to proceed with the authentication with the given credentials.
33 | *
34 | * @param username The user name
35 | * @param password The password
36 | */
37 | public void proceed (String username, String password);
38 | }
--------------------------------------------------------------------------------
/bin/update:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 | var path = require('path');
22 | var Api = require('./templates/cordova/Api');
23 | var args = require('nopt')({
24 | 'link': Boolean,
25 | 'shared': Boolean,
26 | 'help': Boolean
27 | }, { 'd' : '--verbose' });
28 |
29 | if (args.help || args.argv.remain.length === 0) {
30 | console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'update')) + ' [--link]');
31 | console.log(' --link will use the CordovaLib project directly instead of making a copy.');
32 | process.exit(1);
33 | }
34 |
35 | require('./templates/cordova/loggingHelper').adjustLoggerLevel(args);
36 |
37 | Api.updatePlatform(args.argv.remain[0], {link: (args.link || args.shared)}).done();
38 |
--------------------------------------------------------------------------------
/spec/unit/run.spec.js:
--------------------------------------------------------------------------------
1 | /**
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | var rewire = require("rewire");
21 | var run = rewire("../../bin/templates/cordova/lib/run");
22 | var getInstallTarget = run.__get__("getInstallTarget");
23 |
24 | describe("run", function () {
25 | describe("getInstallTarget", function() {
26 | var targetOpts = { target: "emu" };
27 | var deviceOpts = { device: true };
28 | var emulatorOpts = { emulator: true };
29 | var emptyOpts = {};
30 |
31 | it("should select correct target based on the run opts", function() {
32 | expect(getInstallTarget(targetOpts)).toBe("emu");
33 | expect(getInstallTarget(deviceOpts)).toBe("--device");
34 | expect(getInstallTarget(emulatorOpts)).toBe("--emulator");
35 | expect(getInstallTarget(emptyOpts)).toBeUndefined();
36 | });
37 | });
38 | });
39 |
--------------------------------------------------------------------------------
/spec/e2e/fixtures/cordova-plugin-fake-ios-frameworks/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
24 |
25 | Fake
26 |
27 |
28 | Fake plugin to test plugin installation and properties parsing on Android.
29 |
30 |
31 | Apache 2.0
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/bin/templates/cordova/lib/install-device:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var device = require('./device'),
23 | args = process.argv;
24 |
25 | if(args.length > 2) {
26 | var install_target;
27 | if (args[2].substring(0, 9) == '--target=') {
28 | install_target = args[2].substring(9, args[2].length);
29 | device.install(install_target).done(null, function(err) {
30 | console.error('ERROR: ' + err);
31 | process.exit(2);
32 | });
33 | } else {
34 | console.error('ERROR : argument \'' + args[2] + '\' not recognized.');
35 | process.exit(2);
36 | }
37 | } else {
38 | device.install().done(null, function(err) {
39 | console.error('ERROR: ' + err);
40 | process.exit(2);
41 | });
42 | }
43 |
--------------------------------------------------------------------------------
/framework/ant.properties:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 | #
18 | # This file is used to override default values used by the Ant build system.
19 | #
20 | # This file must be checked in Version Control Systems, as it is
21 | # integral to the build system of your project.
22 |
23 | # This file is only used by the Ant script.
24 |
25 | # You can use this to override default values such as
26 | # 'source.dir' for the location of your java source folder and
27 | # 'out.dir' for the location of your output folder.
28 |
29 | # You can also use it define how the release builds are signed by declaring
30 | # the following properties:
31 | # 'key.store' for the location of your keystore and
32 | # 'key.alias' for the name of the key to use.
33 | # The password will be asked during the build when you use the 'release' target.
34 |
35 |
--------------------------------------------------------------------------------
/spec/e2e/fixtures/cordova-plugin-fake/plugin.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
24 |
25 | Fake
26 |
27 |
28 | Fake plugin to test plugin installation and properties parsing on Android.
29 |
30 |
31 | Apache 2.0
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/spec/e2e/plugin.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | var path = require('path'),
21 | actions = require('./helpers/projectActions.js');
22 |
23 | var PLUGIN_ADD_TIMEOUT = 60000;
24 |
25 | describe('plugin add', function() {
26 |
27 | it('create project and add a plugin with framework', function(done) {
28 | var projectname = 'testpluginframework';
29 | var projectid = 'com.test.plugin.framework';
30 | var fakePluginPath = path.join(__dirname, 'fixtures/cordova-plugin-fake');
31 |
32 | actions.createProject(projectname, projectid, function () {
33 | actions.addPlugin(projectid, fakePluginPath, function (error) {
34 | actions.removeProject(projectid);
35 | if (error) {
36 | console.error(error.stack);
37 | }
38 | expect(error).toBe(null);
39 | done();
40 | });
41 | });
42 | }, PLUGIN_ADD_TIMEOUT);
43 |
44 | });
45 |
--------------------------------------------------------------------------------
/test/src/org/apache/cordova/test/LifeCyclePlugin.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 | package org.apache.cordova.test;
20 |
21 | import org.apache.cordova.CordovaPlugin;
22 | import org.apache.cordova.LOG;
23 |
24 | public class LifeCyclePlugin extends CordovaPlugin {
25 |
26 | static String TAG = "LifeCyclePlugin";
27 | String calls = "";
28 |
29 | @Override
30 | public void onStart() {
31 | calls += "start,";
32 | LOG.d(TAG, "onStart");
33 | }
34 | @Override
35 | public void onPause(boolean multitasking) {
36 | calls += "pause,";
37 | LOG.d(TAG, "onPause");
38 | }
39 | @Override
40 | public void onResume(boolean multitasking) {
41 | calls += "resume,";
42 | LOG.d(TAG, "onResume");
43 | }
44 | @Override
45 | public void onStop() {
46 | calls += "stop,";
47 | LOG.d(TAG, "onStop");
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/test/assets/www/whitelist/index2.html:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 |
24 | Cordova Tests
25 |
26 |
27 |
28 |
29 |
30 |
Whitelist Page 2
31 |
32 |
Cordova:
33 |
Deviceready:
34 |
35 |
36 | Press "backbutton"
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/bin/templates/cordova/build:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var args = process.argv;
23 | var Api = require('./Api');
24 | var nopt = require('nopt');
25 | var path = require('path');
26 |
27 | // Support basic help commands
28 | if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0)
29 | require('./lib/build').help();
30 |
31 | // Do some basic argument parsing
32 | var buildOpts = nopt({
33 | 'verbose' : Boolean,
34 | 'silent' : Boolean,
35 | 'debug' : Boolean,
36 | 'release' : Boolean,
37 | 'nobuild': Boolean,
38 | 'buildConfig' : path
39 | }, { 'd' : '--verbose' });
40 |
41 | // Make buildOptions compatible with PlatformApi build method spec
42 | buildOpts.argv = buildOpts.argv.original;
43 |
44 | require('./loggingHelper').adjustLoggerLevel(buildOpts);
45 |
46 | new Api().build(buildOpts)
47 | .catch(function(err) {
48 | console.error(err.stack);
49 | process.exit(2);
50 | });
51 |
--------------------------------------------------------------------------------
/test/assets/www/htmlnotfound/error.html:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 |
24 | Expected Error
25 |
26 |
27 |
28 |
29 |
30 |
Expected Error
31 |
32 |
Cordova:
33 |
Deviceready:
34 |
35 |
36 | This is an expected error page because the initial href doesn't exist.
37 |
38 |
39 |
--------------------------------------------------------------------------------
/test/assets/www/jqmtabbackbutton/tab1.html:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 | Tab 1
23 |
24 |
25 |
26 |
49 |
--------------------------------------------------------------------------------
/test/androidTest/src/org/apache/cordova/test/IntentPreferenceTest.java:
--------------------------------------------------------------------------------
1 | package org.apache.cordova.test;
2 | /*
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one
5 | * or more contributor license agreements. See the NOTICE file
6 | * distributed with this work for additional information
7 | * regarding copyright ownership. The ASF licenses this file
8 | * to you under the Apache License, Version 2.0 (the
9 | * "License"); you may not use this file except in compliance
10 | * with the License. You may obtain a copy of the License at
11 | *
12 | * http://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing,
15 | * software distributed under the License is distributed on an
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | * KIND, either express or implied. See the License for the
18 | * specific language governing permissions and limitations
19 | * under the License.
20 | *
21 | */
22 |
23 | import android.graphics.Color;
24 |
25 | import org.apache.cordova.CordovaPreferences;
26 |
27 | public class IntentPreferenceTest extends BaseCordovaIntegrationTest {
28 | private static final String GREEN = Integer.toHexString(Color.GREEN);
29 | private static final String START_URL = "file:///android_asset/www/index.html";
30 |
31 | CordovaPreferences prefs;
32 |
33 | protected void setUp() throws Exception {
34 | super.setUp();
35 | // INVALID_URL tests that errorUrl and url are *not* settable via the intent.
36 | setUpWithStartUrl(START_URL, "backgroundcolor", GREEN);
37 | prefs = cordovaWebView.getPreferences();
38 | }
39 |
40 | public void testUrl() throws Throwable {
41 | assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
42 | assertFalse(prefs.getInteger("backgroundcolor", Color.BLACK) == Color.GREEN);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/test/androidTest/src/org/apache/cordova/test/HtmlNotFoundTest.java:
--------------------------------------------------------------------------------
1 | package org.apache.cordova.test;
2 | /*
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one
5 | * or more contributor license agreements. See the NOTICE file
6 | * distributed with this work for additional information
7 | * regarding copyright ownership. The ASF licenses this file
8 | * to you under the Apache License, Version 2.0 (the
9 | * "License"); you may not use this file except in compliance
10 | * with the License. You may obtain a copy of the License at
11 | *
12 | * http://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing,
15 | * software distributed under the License is distributed on an
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | * KIND, either express or implied. See the License for the
18 | * specific language governing permissions and limitations
19 | * under the License.
20 | *
21 | */
22 |
23 |
24 | public class HtmlNotFoundTest extends BaseCordovaIntegrationTest {
25 | private static final String START_URL = "file:///android_asset/www/htmlnotfound/index.html";
26 |
27 | protected void setUp() throws Exception {
28 | super.setUp();
29 | setUpWithStartUrl(START_URL);
30 | }
31 | public void testUrl() throws Throwable
32 | {
33 | runTestOnUiThread(new Runnable() {
34 | public void run() {
35 | assertTrue(START_URL.equals(testActivity.getCordovaWebView().getUrl()));
36 | }
37 | });
38 |
39 | //loading a not-found file causes an application error and displayError is called
40 | //the test activity overrides displayError to add message to onPageFinishedUrl
41 | String message = testActivity.onPageFinishedUrl.take();
42 | assertTrue(message.contains(START_URL));
43 | assertTrue(message.contains("ERR_FILE_NOT_FOUND"));
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/bin/templates/cordova/clean:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var Api = require('./Api');
23 | var path = require('path');
24 | var nopt = require('nopt');
25 |
26 | // Support basic help commands
27 | if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0) {
28 | console.log('Usage: ' + path.relative(process.cwd(), process.argv[1]));
29 | console.log('Cleans the project directory.');
30 | process.exit(0);
31 | }
32 |
33 | // Do some basic argument parsing
34 | var opts = nopt({
35 | 'verbose' : Boolean,
36 | 'silent' : Boolean
37 | }, { 'd' : '--verbose' });
38 |
39 | // Make buildOptions compatible with PlatformApi clean method spec
40 | opts.argv = opts.argv.original;
41 |
42 | // Skip cleaning prepared files when not invoking via cordova CLI.
43 | opts.noPrepare = true;
44 |
45 | require('./loggingHelper').adjustLoggerLevel(opts);
46 |
47 | new Api().clean(opts)
48 | .catch(function(err) {
49 | console.error(err.stack);
50 | process.exit(2);
51 | });
52 |
--------------------------------------------------------------------------------
/test/assets/www/backbuttonmultipage/index.html:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 | Backbutton
23 |
24 |
25 |
26 |
27 |
28 |
Cordova Android Tests
29 |
30 |
Cordova:
31 |
Deviceready:
32 |
33 |
34 |
Page 1
35 | Go to next page.
36 | If returning from previous page, press "backbutton". You should exit this app.
37 |
36 | Before this page was show, you should have seen the background flash green.
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/bin/templates/cordova/run:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var Api = require('./Api');
23 | var nopt = require('nopt');
24 | var path = require('path');
25 |
26 | // Support basic help commands
27 | if(['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(process.argv[2]) >= 0)
28 | require('./lib/run').help();
29 |
30 | // Do some basic argument parsing
31 | var runOpts = nopt({
32 | 'verbose' : Boolean,
33 | 'silent' : Boolean,
34 | 'debug' : Boolean,
35 | 'release' : Boolean,
36 | 'nobuild': Boolean,
37 | 'buildConfig' : path,
38 | 'archs' : String,
39 | 'device' : Boolean,
40 | 'emulator': Boolean,
41 | 'target' : String
42 | }, { 'd' : '--verbose' });
43 |
44 | // Make runOptions compatible with PlatformApi run method spec
45 | runOpts.argv = runOpts.argv.remain;
46 |
47 | require('./loggingHelper').adjustLoggerLevel(runOpts);
48 |
49 | new Api().run(runOpts)
50 | .catch(function(err) {
51 | console.error(err, err.stack);
52 | process.exit(2);
53 | });
54 |
--------------------------------------------------------------------------------
/test/assets/www/fullscreen/index.html:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 |
24 | Cordova Tests
25 |
26 |
27 |
28 |
29 |
30 |
Full Screen Test
31 |
32 |
Cordova:
33 |
Deviceready:
34 |
35 |
36 | The app should take over the entire screen.
37 | The top Android status bar should not be shown.
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/test/src/org/apache/cordova/test/MainTestActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 | package org.apache.cordova.test;
20 |
21 | import android.os.Bundle;
22 |
23 | public class MainTestActivity extends BaseTestCordovaActivity {
24 | public static final String START_URL = "file:///android_asset/www/index.html";
25 |
26 | /** Called when the activity is first created. */
27 | @Override
28 | public void onCreate(Bundle savedInstanceState) {
29 | super.onCreate(savedInstanceState);
30 | String url = getIntent().getStringExtra("testStartUrl");
31 | if (url == null) {
32 | url = START_URL;
33 | }
34 | super.loadUrl(url);
35 | }
36 |
37 | @Override protected void loadConfig() {
38 | super.loadConfig();
39 | // Need to set this explicitly in prefs since it's not settable via bundle extras.
40 | String errorUrl = getIntent().getStringExtra("testErrorUrl");
41 | if (errorUrl != null) {
42 | preferences.set("errorUrl", errorUrl);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/framework/src/org/apache/cordova/CordovaHttpAuthHandler.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 | package org.apache.cordova;
20 |
21 | import android.webkit.HttpAuthHandler;
22 |
23 | /**
24 | * Specifies interface for HTTP auth handler object which is used to handle auth requests and
25 | * specifying user credentials.
26 | */
27 | public class CordovaHttpAuthHandler implements ICordovaHttpAuthHandler {
28 |
29 | private final HttpAuthHandler handler;
30 |
31 | public CordovaHttpAuthHandler(HttpAuthHandler handler) {
32 | this.handler = handler;
33 | }
34 |
35 | /**
36 | * Instructs the WebView to cancel the authentication request.
37 | */
38 | public void cancel () {
39 | this.handler.cancel();
40 | }
41 |
42 | /**
43 | * Instructs the WebView to proceed with the authentication with the given credentials.
44 | *
45 | * @param username
46 | * @param password
47 | */
48 | public void proceed (String username, String password) {
49 | this.handler.proceed(username, password);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/test/androidTest/src/org/apache/cordova/test/CordovaActivityTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | package org.apache.cordova.test;
21 |
22 | import android.view.View;
23 | import android.view.ViewGroup;
24 | import android.widget.LinearLayout;
25 |
26 | import org.apache.cordova.CordovaWebViewEngine;
27 | import org.apache.cordova.engine.SystemWebView;
28 |
29 | public class CordovaActivityTest extends BaseCordovaIntegrationTest {
30 | private ViewGroup innerContainer;
31 | private View testView;
32 |
33 | protected void setUp() throws Exception {
34 | super.setUp();
35 | setUpWithStartUrl(null);
36 | testView = (ViewGroup)containerView.getChildAt(0);
37 | }
38 |
39 | public void testBasicLoad() throws Exception {
40 | assertTrue(testView instanceof SystemWebView);
41 | assertTrue(((CordovaWebViewEngine.EngineView)testView).getCordovaWebView() != null);
42 | String onPageFinishedUrl = testActivity.onPageFinishedUrl.take();
43 | assertEquals(MainTestActivity.START_URL, onPageFinishedUrl);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/bin/templates/cordova/lib/builders/builders.js:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | var CordovaError = require('cordova-common').CordovaError;
21 |
22 | var knownBuilders = {
23 | ant: 'AntBuilder',
24 | gradle: 'GradleBuilder',
25 | none: 'GenericBuilder'
26 | };
27 |
28 | /**
29 | * Helper method that instantiates and returns a builder for specified build
30 | * type.
31 | *
32 | * @param {String} builderType Builder name to construct and return. Must
33 | * be one of 'ant', 'gradle' or 'none'
34 | *
35 | * @return {Builder} A builder instance for specified build type.
36 | */
37 | module.exports.getBuilder = function (builderType, projectRoot) {
38 | if (!knownBuilders[builderType])
39 | throw new CordovaError('Builder ' + builderType + ' is not supported.');
40 |
41 | try {
42 | var Builder = require('./' + knownBuilders[builderType]);
43 | return new Builder(projectRoot);
44 | } catch (err) {
45 | throw new CordovaError('Failed to instantiate ' + knownBuilders[builderType] + ' builder: ' + err);
46 | }
47 | };
48 |
--------------------------------------------------------------------------------
/test/assets/www/iframe/index2.html:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
22 |
23 |
24 | Cordova Tests
25 |
26 |
27 |
28 |
29 |
30 |
IFrame window
31 |
32 |
Cordova:
33 |
Deviceready:
34 |
35 |
36 | This should display a Cordova page inside an iframe. The info above should be filled out.
37 | (NOTE: THIS DOES NOT WORK AND NEEDS TO BE FIXED IN FUTURE RELEASE.)
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/framework/build.gradle:
--------------------------------------------------------------------------------
1 | /* Licensed to the Apache Software Foundation (ASF) under one
2 | or more contributor license agreements. See the NOTICE file
3 | distributed with this work for additional information
4 | regarding copyright ownership. The ASF licenses this file
5 | to you under the Apache License, Version 2.0 (the
6 | "License"); you may not use this file except in compliance
7 | with the License. You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing,
12 | software distributed under the License is distributed on an
13 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | KIND, either express or implied. See the License for the
15 | specific language governing permissions and limitations
16 | under the License.
17 | */
18 |
19 |
20 |
21 | buildscript {
22 | repositories {
23 | mavenCentral()
24 | }
25 |
26 | dependencies {
27 | classpath 'com.android.tools.build:gradle:2.1.0'
28 | }
29 |
30 | }
31 |
32 | apply plugin: 'com.android.library'
33 |
34 | ext {
35 | apply from: 'cordova.gradle'
36 | cdvCompileSdkVersion = privateHelpers.getProjectTarget()
37 | cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
38 | }
39 |
40 | android {
41 | compileSdkVersion cdvCompileSdkVersion
42 | buildToolsVersion cdvBuildToolsVersion
43 | publishNonDefault true
44 |
45 | compileOptions {
46 | sourceCompatibility JavaVersion.VERSION_1_6
47 | targetCompatibility JavaVersion.VERSION_1_6
48 | }
49 |
50 | sourceSets {
51 | main {
52 | manifest.srcFile 'AndroidManifest.xml'
53 | java.srcDirs = ['src']
54 | resources.srcDirs = ['src']
55 | aidl.srcDirs = ['src']
56 | renderscript.srcDirs = ['src']
57 | res.srcDirs = ['res']
58 | assets.srcDirs = ['assets']
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/test/README.md:
--------------------------------------------------------------------------------
1 |
21 | # Android Native Tests
22 |
23 | These tests are designed to verify Android native features and other Android specific features.
24 |
25 | ## Initial Setup
26 |
27 | ### Setting env vars
28 |
29 | Run:
30 |
31 | ../bin/check_reqs
32 |
33 | Use the output to set your `ANDROID_HOME` and `JAVA_HOME` environment variables.
34 |
35 | ### Adding `gradlew`
36 |
37 | Copy it from a freshly created project:
38 |
39 | ../bin/create foo
40 | (cd foo && cordova/build --gradle; cp -r gradlew gradle ..)
41 | rm -r foo
42 |
43 | ## Running
44 |
45 | To run manual tests:
46 |
47 | ./gradlew installDebug
48 |
49 | To run unit tests:
50 |
51 | ./gradlew connectedAndroidTest
52 |
53 | `BUILD SUCCESSFUL` means that the tests all passed :)
54 |
55 | ## Android Studio
56 |
57 | 1. Use "Import Project" and import the `test` directory.
58 | 2. Right click on the `org.apache.cordova.test` package on the left-hand nav.
59 | 3. Select `Create Run Configuration` -> `Tests in ...` (The one with the Android icon)
60 | 4. Review options (mainly - target device)
61 | 5. Click the bug icon in the top toolbar to run with debugger attached
62 |
--------------------------------------------------------------------------------
/test/assets/www/basicauth/index.html:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 |
24 | Cordova Tests
25 |
26 |
27 |
28 |
29 |
30 |
Basic Auth
31 |
32 |
Cordova:
33 |
Deviceready:
34 |
35 |
36 | Loading link below should be successful and show page indicating username=test & password=test.
37 |
There is also a context menu. Touch and hold finger here to see:
41 |
Context Item1
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/test/androidTest/src/org/apache/cordova/test/ErrorUrlTest.java:
--------------------------------------------------------------------------------
1 | package org.apache.cordova.test;
2 | /*
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one
5 | * or more contributor license agreements. See the NOTICE file
6 | * distributed with this work for additional information
7 | * regarding copyright ownership. The ASF licenses this file
8 | * to you under the Apache License, Version 2.0 (the
9 | * "License"); you may not use this file except in compliance
10 | * with the License. You may obtain a copy of the License at
11 | *
12 | * http://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing,
15 | * software distributed under the License is distributed on an
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | * KIND, either express or implied. See the License for the
18 | * specific language governing permissions and limitations
19 | * under the License.
20 | *
21 | */
22 |
23 |
24 | public class ErrorUrlTest extends BaseCordovaIntegrationTest {
25 | private static final String START_URL = "file:///android_asset/www/htmlnotfound/index.html";
26 | private static final String ERROR_URL = "file:///android_asset/www/htmlnotfound/error.html";
27 | private static final String INVALID_URL = "file:///android_asset/www/invalid.html";
28 |
29 | protected void setUp() throws Exception {
30 | super.setUp();
31 | // INVALID_URL tests that errorUrl and url are *not* settable via the intent.
32 | setUpWithStartUrl(START_URL, "testErrorUrl", ERROR_URL, "errorurl", INVALID_URL, "url", INVALID_URL);
33 | }
34 |
35 | public void testUrl() throws Throwable {
36 | assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
37 | assertEquals(ERROR_URL, testActivity.onPageFinishedUrl.take());
38 | runTestOnUiThread(new Runnable() {
39 | public void run() {
40 | assertEquals(ERROR_URL, testActivity.getCordovaWebView().getUrl());
41 | }
42 | });
43 | }
44 | }
--------------------------------------------------------------------------------
/framework/src/org/apache/cordova/AuthenticationToken.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 | package org.apache.cordova;
20 |
21 | /**
22 | * The Class AuthenticationToken defines the userName and password to be used for authenticating a web resource
23 | */
24 | public class AuthenticationToken {
25 | private String userName;
26 | private String password;
27 |
28 | /**
29 | * Gets the user name.
30 | *
31 | * @return the user name
32 | */
33 | public String getUserName() {
34 | return userName;
35 | }
36 |
37 | /**
38 | * Sets the user name.
39 | *
40 | * @param userName
41 | * the new user name
42 | */
43 | public void setUserName(String userName) {
44 | this.userName = userName;
45 | }
46 |
47 | /**
48 | * Gets the password.
49 | *
50 | * @return the password
51 | */
52 | public String getPassword() {
53 | return password;
54 | }
55 |
56 | /**
57 | * Sets the password.
58 | *
59 | * @param password
60 | * the new password
61 | */
62 | public void setPassword(String password) {
63 | this.password = password;
64 | }
65 |
66 |
67 |
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/test/assets/www/backbuttonmultipage/sample3.html:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 | Backbutton
23 |
24 |
25 |
26 |
27 |
28 |
Cordova Android Tests
29 |
30 |
Cordova:
31 |
Deviceready:
32 |
33 |
34 |
Page 3
35 | Press the 3 buttons below. You should stay on same page.
36 | Press "backbutton" 4 times. This will go back to #test3, #test2, #test1, then return to previous Page 2.
37 |
38 | page3#test1
39 | page3#test2
40 | page3#test3
41 |
42 |
43 |
--------------------------------------------------------------------------------
/bin/templates/project/assets/www/js/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 | var app = {
20 | // Application Constructor
21 | initialize: function() {
22 | this.bindEvents();
23 | },
24 | // Bind Event Listeners
25 | //
26 | // Bind any events that are required on startup. Common events are:
27 | // 'load', 'deviceready', 'offline', and 'online'.
28 | bindEvents: function() {
29 | document.addEventListener('deviceready', this.onDeviceReady, false);
30 | },
31 | // deviceready Event Handler
32 | //
33 | // The scope of 'this' is the event. In order to call the 'receivedEvent'
34 | // function, we must explicitly call 'app.receivedEvent(...);'
35 | onDeviceReady: function() {
36 | app.receivedEvent('deviceready');
37 | },
38 | // Update DOM on a Received Event
39 | receivedEvent: function(id) {
40 | var parentElement = document.getElementById(id);
41 | var listeningElement = parentElement.querySelector('.listening');
42 | var receivedElement = parentElement.querySelector('.received');
43 |
44 | listeningElement.setAttribute('style', 'display:none;');
45 | receivedElement.setAttribute('style', 'display:block;');
46 |
47 | console.log('Received Event: ' + id);
48 | }
49 | };
50 |
51 | app.initialize();
--------------------------------------------------------------------------------
/bin/templates/cordova/lib/log.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var path = require('path'),
23 | os = require('os'),
24 | Q = require('q'),
25 | child_process = require('child_process'),
26 | ROOT = path.join(__dirname, '..', '..');
27 |
28 | /*
29 | * Starts running logcat in the shell.
30 | * Returns a promise.
31 | */
32 | module.exports.run = function() {
33 | var d = Q.defer();
34 | var adb = child_process.spawn('adb', ['logcat'], {cwd: os.tmpdir()});
35 |
36 | adb.stdout.on('data', function(data) {
37 | var lines = data ? data.toString().split('\n') : [];
38 | var out = lines.filter(function(x) { return x.indexOf('nativeGetEnabledTags') < 0; });
39 | console.log(out.join('\n'));
40 | });
41 |
42 | adb.stderr.on('data', console.error);
43 | adb.on('close', function(code) {
44 | if (code > 0) {
45 | d.reject('Failed to run logcat command.');
46 | } else d.resolve();
47 | });
48 |
49 | return d.promise;
50 | };
51 |
52 | module.exports.help = function() {
53 | console.log('Usage: ' + path.relative(process.cwd(), path.join(ROOT, 'cordova', 'log')));
54 | console.log('Gives the logcat output on the command line.');
55 | process.exit(0);
56 | };
57 |
--------------------------------------------------------------------------------
/test/androidTest/src/org/apache/cordova/test/BaseCordovaIntegrationTest.java:
--------------------------------------------------------------------------------
1 | package org.apache.cordova.test;
2 | /*
3 | *
4 | * Licensed to the Apache Software Foundation (ASF) under one
5 | * or more contributor license agreements. See the NOTICE file
6 | * distributed with this work for additional information
7 | * regarding copyright ownership. The ASF licenses this file
8 | * to you under the Apache License, Version 2.0 (the
9 | * "License"); you may not use this file except in compliance
10 | * with the License. You may obtain a copy of the License at
11 | *
12 | * http://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing,
15 | * software distributed under the License is distributed on an
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | * KIND, either express or implied. See the License for the
18 | * specific language governing permissions and limitations
19 | * under the License.
20 | *
21 | */
22 |
23 |
24 | import android.content.Intent;
25 | import android.test.ActivityInstrumentationTestCase2;
26 | import android.widget.FrameLayout;
27 |
28 | import org.apache.cordova.CordovaWebView;
29 |
30 | public class BaseCordovaIntegrationTest extends ActivityInstrumentationTestCase2 {
31 | protected MainTestActivity testActivity;
32 | protected FrameLayout containerView;
33 | protected CordovaWebView cordovaWebView;
34 |
35 |
36 | public BaseCordovaIntegrationTest() {
37 | super(MainTestActivity.class);
38 | }
39 |
40 | protected void setUpWithStartUrl(String url, String... prefsAndValues) {
41 | Intent intent = new Intent(getInstrumentation().getContext(), MainTestActivity.class);
42 | intent.putExtra("testStartUrl", url);
43 | for (int i = 0; i < prefsAndValues.length; i += 2) {
44 | intent.putExtra(prefsAndValues[i], prefsAndValues[i + 1]);
45 | }
46 | setActivityIntent(intent);
47 | testActivity = getActivity();
48 | containerView = (FrameLayout) testActivity.findViewById(android.R.id.content);
49 | cordovaWebView = testActivity.getCordovaWebView();
50 | }
51 | }
52 |
53 |
--------------------------------------------------------------------------------
/test/res/xml/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 | Hello Cordova
22 |
23 | A sample Apache Cordova application that responds to the deviceready event.
24 |
25 |
26 | Apache Cordova Team
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/test/src/org/apache/cordova/test/BaseTestCordovaActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 | package org.apache.cordova.test;
20 |
21 | import android.content.Intent;
22 | import android.os.Bundle;
23 |
24 | import org.apache.cordova.CordovaActivity;
25 | import org.apache.cordova.CordovaWebView;
26 |
27 | import java.util.concurrent.ArrayBlockingQueue;
28 |
29 | public class BaseTestCordovaActivity extends CordovaActivity {
30 | public final ArrayBlockingQueue onPageFinishedUrl = new ArrayBlockingQueue(500);
31 |
32 | /** Called when the activity is first created. */
33 | @Override
34 | public void onCreate(Bundle savedInstanceState) {
35 | super.onCreate(savedInstanceState);
36 | }
37 |
38 | @Override
39 | public Object onMessage(String id, Object data) {
40 | if ("onPageFinished".equals(id)) {
41 | onPageFinishedUrl.add((String) data);
42 | }
43 | return super.onMessage(id, data);
44 | }
45 |
46 | public CordovaWebView getCordovaWebView() {
47 | return appView;
48 | }
49 |
50 | // By default, displayError shows a dialog, but for tests we just add the message to the queue
51 | @Override
52 | public void displayError(String title, String message, String button, boolean exit) {
53 | onPageFinishedUrl.add(message);
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/test/assets/www/whitelist/index.html:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 |
24 | Cordova Tests
25 |
26 |
27 |
28 |
29 |
30 |
Whitelist Page 1
31 |
32 |
Cordova:
33 |
Deviceready:
34 |
35 |
36 | Loading Page 2 should be successful.
37 | Loading Page 3 should be in web browser.
38 | Loading Page 2 with target=_blank should be in web browser?
39 | (THIS DOESN'T HAPPEN.) https://issues.apache.org/jira/browse/CB-362
40 |
41 | Page 2
42 | Page 3
43 | Page 2 with target=_blank
44 |
45 |
46 |
--------------------------------------------------------------------------------
/framework/src/org/apache/cordova/engine/SystemExposedJsApi.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 | package org.apache.cordova.engine;
20 |
21 | import android.webkit.JavascriptInterface;
22 |
23 | import org.apache.cordova.CordovaBridge;
24 | import org.apache.cordova.ExposedJsApi;
25 | import org.json.JSONException;
26 |
27 | /**
28 | * Contains APIs that the JS can call. All functions in here should also have
29 | * an equivalent entry in CordovaChromeClient.java, and be added to
30 | * cordova-js/lib/android/plugin/android/promptbasednativeapi.js
31 | */
32 | class SystemExposedJsApi implements ExposedJsApi {
33 | private final CordovaBridge bridge;
34 |
35 | SystemExposedJsApi(CordovaBridge bridge) {
36 | this.bridge = bridge;
37 | }
38 |
39 | @JavascriptInterface
40 | public String exec(int bridgeSecret, String service, String action, String callbackId, String arguments) throws JSONException, IllegalAccessException {
41 | return bridge.jsExec(bridgeSecret, service, action, callbackId, arguments);
42 | }
43 |
44 | @JavascriptInterface
45 | public void setNativeToJsBridgeMode(int bridgeSecret, int value) throws IllegalAccessException {
46 | bridge.jsSetNativeToJsBridgeMode(bridgeSecret, value);
47 | }
48 |
49 | @JavascriptInterface
50 | public String retrieveJsMessages(int bridgeSecret, boolean fromOnlineEvent) throws IllegalAccessException {
51 | return bridge.jsRetrieveJsMessages(bridgeSecret, fromOnlineEvent);
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/test/androidTest/src/org/apache/cordova/test/InflateLayoutTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | package org.apache.cordova.test;
21 |
22 | import android.test.ActivityInstrumentationTestCase2;
23 | import android.view.View;
24 | import android.view.ViewGroup;
25 | import android.widget.FrameLayout;
26 | import android.widget.LinearLayout;
27 |
28 | import org.apache.cordova.engine.SystemWebView;
29 |
30 | public class InflateLayoutTest extends ActivityInstrumentationTestCase2 {
31 |
32 | private CordovaWebViewTestActivity testActivity;
33 | private ViewGroup innerContainer;
34 | private View testView;
35 |
36 | @SuppressWarnings("deprecation")
37 | public InflateLayoutTest()
38 | {
39 | super("org.apache.cordova.test",CordovaWebViewTestActivity.class);
40 | }
41 |
42 | protected void setUp() throws Exception {
43 | super.setUp();
44 | testActivity = this.getActivity();
45 | FrameLayout containerView = (FrameLayout) testActivity.findViewById(android.R.id.content);
46 | innerContainer = (ViewGroup)containerView.getChildAt(0);
47 | testView = innerContainer.getChildAt(0);
48 | }
49 |
50 | public void testBasicLoad() throws Exception {
51 | assertTrue(testView instanceof SystemWebView);
52 | assertTrue(innerContainer instanceof LinearLayout);
53 | String onPageFinishedUrl = testActivity.onPageFinishedUrl.take();
54 | assertEquals(CordovaWebViewTestActivity.START_URL, onPageFinishedUrl);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/test/assets/www/iframe/index.html:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
22 |
23 |
24 | Cordova Tests
25 |
26 |
27 |
28 |
32 |
33 |
34 |
IFrame
35 |
36 |
Cordova:
37 |
Deviceready:
38 |
39 |
40 | Press the two buttons:
41 | 1. Google Maps should display in iframe.
42 | 2. Page 2 replaces current page.
43 | (NOTE: THIS BEHAVIOR IS WRONG - AND NEEDS TO BE FIXED IN FUTURE RELEASE.)
44 |
45 |
46 | Google Maps
47 | Page 2
48 |
49 |
50 |
--------------------------------------------------------------------------------
/framework/src/org/apache/cordova/ICordovaClientCertRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 | package org.apache.cordova;
20 |
21 | import java.security.Principal;
22 | import java.security.PrivateKey;
23 | import java.security.cert.X509Certificate;
24 |
25 | /**
26 | * Specifies interface for handling certificate requests.
27 | */
28 | public interface ICordovaClientCertRequest {
29 | /**
30 | * Cancel this request
31 | */
32 | public void cancel();
33 |
34 | /*
35 | * Returns the host name of the server requesting the certificate.
36 | */
37 | public String getHost();
38 |
39 | /*
40 | * Returns the acceptable types of asymmetric keys (can be null).
41 | */
42 | public String[] getKeyTypes();
43 |
44 | /*
45 | * Returns the port number of the server requesting the certificate.
46 | */
47 | public int getPort();
48 |
49 | /*
50 | * Returns the acceptable certificate issuers for the certificate matching the private key (can be null).
51 | */
52 | public Principal[] getPrincipals();
53 |
54 | /*
55 | * Ignore the request for now. Do not remember user's choice.
56 | */
57 | public void ignore();
58 |
59 | /*
60 | * Proceed with the specified private key and client certificate chain. Remember the user's positive choice and use it for future requests.
61 | *
62 | * @param privateKey The privateKey
63 | * @param chain The certificate chain
64 | */
65 | public void proceed(PrivateKey privateKey, X509Certificate[] chain);
66 | }
--------------------------------------------------------------------------------
/bin/templates/project/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
22 |
30 |
31 |
32 |
33 |
35 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/bin/lib/android_sdk_version.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | var child_process = require('child_process'),
23 | Q = require('q');
24 |
25 | var get_highest_sdk = function(results){
26 | var reg = /\d+/;
27 | var apiLevels = [];
28 | for(var i=0;i
2 |
20 |
21 |
25 |
26 | Faulty Plugin
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
51 |
52 |
53 |
54 |
55 |
57 |
58 |
59 |
60 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/bin/templates/project/res/xml/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
23 | Hello Cordova
24 |
25 |
26 | A sample Apache Cordova application that responds to the deviceready event.
27 |
28 |
29 |
30 | Apache Cordova Team
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
58 |
59 |
--------------------------------------------------------------------------------
/framework/src/org/apache/cordova/Config.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | package org.apache.cordova;
21 |
22 | import java.util.List;
23 |
24 | import android.app.Activity;
25 | import android.util.Log;
26 |
27 | @Deprecated // Use Whitelist, CordovaPrefences, etc. directly.
28 | public class Config {
29 | private static final String TAG = "Config";
30 |
31 | static ConfigXmlParser parser;
32 |
33 | private Config() {
34 | }
35 |
36 | public static void init(Activity action) {
37 | parser = new ConfigXmlParser();
38 | parser.parse(action);
39 | //TODO: Add feature to bring this back. Some preferences should be overridden by intents, but not all
40 | parser.getPreferences().setPreferencesBundle(action.getIntent().getExtras());
41 | }
42 |
43 | // Intended to be used for testing only; creates an empty configuration.
44 | public static void init() {
45 | if (parser == null) {
46 | parser = new ConfigXmlParser();
47 | }
48 | }
49 |
50 | public static String getStartUrl() {
51 | if (parser == null) {
52 | return "file:///android_asset/www/index.html";
53 | }
54 | return parser.getLaunchUrl();
55 | }
56 |
57 | public static String getErrorUrl() {
58 | return parser.getPreferences().getString("errorurl", null);
59 | }
60 |
61 | public static List getPluginEntries() {
62 | return parser.getPluginEntries();
63 | }
64 |
65 | public static CordovaPreferences getPreferences() {
66 | return parser.getPreferences();
67 | }
68 |
69 | public static boolean isInitialized() {
70 | return parser != null;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/framework/src/org/apache/cordova/engine/SystemCookieManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | package org.apache.cordova.engine;
21 |
22 | import android.annotation.TargetApi;
23 | import android.os.Build;
24 | import android.webkit.CookieManager;
25 | import android.webkit.WebView;
26 |
27 | import org.apache.cordova.ICordovaCookieManager;
28 |
29 | class SystemCookieManager implements ICordovaCookieManager {
30 |
31 | protected final WebView webView;
32 | private final CookieManager cookieManager;
33 |
34 | //Added because lint can't see the conditional RIGHT ABOVE this
35 | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
36 | public SystemCookieManager(WebView webview) {
37 | webView = webview;
38 | cookieManager = CookieManager.getInstance();
39 |
40 | //REALLY? Nobody has seen this UNTIL NOW?
41 | cookieManager.setAcceptFileSchemeCookies(true);
42 |
43 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
44 | cookieManager.setAcceptThirdPartyCookies(webView, true);
45 | }
46 | }
47 |
48 | public void setCookiesEnabled(boolean accept) {
49 | cookieManager.setAcceptCookie(accept);
50 | }
51 |
52 | public void setCookie(final String url, final String value) {
53 | cookieManager.setCookie(url, value);
54 | }
55 |
56 | public String getCookie(final String url) {
57 | return cookieManager.getCookie(url);
58 | }
59 |
60 | public void clearCookies() {
61 | cookieManager.removeAllCookie();
62 | }
63 |
64 | public void flush() {
65 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
66 | cookieManager.flush();
67 | }
68 | }
69 | };
70 |
--------------------------------------------------------------------------------
/framework/src/org/apache/cordova/PluginEntry.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 | package org.apache.cordova;
20 |
21 | import org.apache.cordova.CordovaPlugin;
22 |
23 | /**
24 | * This class represents a service entry object.
25 | */
26 | public final class PluginEntry {
27 |
28 | /**
29 | * The name of the service that this plugin implements
30 | */
31 | public final String service;
32 |
33 | /**
34 | * The plugin class name that implements the service.
35 | */
36 | public final String pluginClass;
37 |
38 | /**
39 | * The pre-instantiated plugin to use for this entry.
40 | */
41 | public final CordovaPlugin plugin;
42 |
43 | /**
44 | * Flag that indicates the plugin object should be created when PluginManager is initialized.
45 | */
46 | public final boolean onload;
47 |
48 | /**
49 | * Constructs with a CordovaPlugin already instantiated.
50 | */
51 | public PluginEntry(String service, CordovaPlugin plugin) {
52 | this(service, plugin.getClass().getName(), true, plugin);
53 | }
54 |
55 | /**
56 | * @param service The name of the service
57 | * @param pluginClass The plugin class name
58 | * @param onload Create plugin object when HTML page is loaded
59 | */
60 | public PluginEntry(String service, String pluginClass, boolean onload) {
61 | this(service, pluginClass, onload, null);
62 | }
63 |
64 | private PluginEntry(String service, String pluginClass, boolean onload, CordovaPlugin plugin) {
65 | this.service = service;
66 | this.pluginClass = pluginClass;
67 | this.onload = onload;
68 | this.plugin = plugin;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/bin/templates/project/assets/www/index.html:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
22 |
31 |
32 |
33 |
34 |
35 |
36 | Hello World
37 |
38 |
39 |
40 |
Apache Cordova
41 |
42 |
Connecting to Device
43 |
Device is Ready
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/bin/create:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 | var path = require('path');
22 | var ConfigParser = require('cordova-common').ConfigParser;
23 | var Api = require('./templates/cordova/Api');
24 |
25 | var argv = require('nopt')({
26 | 'help' : Boolean,
27 | 'cli' : Boolean,
28 | 'shared' : Boolean,
29 | 'link' : Boolean,
30 | 'activity-name' : [String, undefined]
31 | }, { 'd' : '--verbose' });
32 |
33 | if (argv.help || argv.argv.remain.length === 0) {
34 | console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'create')) + ' [] [--activity-name ] [--link]');
35 | console.log(' : Path to your new Cordova Android project');
36 | console.log(' : Package name, following reverse-domain style convention');
37 | console.log(' : Project name');
38 | console.log(' : Path to a custom application template to use');
39 | console.log(' --activity-name : Activity name');
40 | console.log(' --link will use the CordovaLib project directly instead of making a copy.');
41 | process.exit(1);
42 | }
43 |
44 | var config = new ConfigParser(path.resolve(__dirname, 'templates/project/res/xml/config.xml'));
45 |
46 | if (argv.argv.remain[1]) config.setPackageName(argv.argv.remain[1]);
47 | if (argv.argv.remain[2]) config.setName(argv.argv.remain[2]);
48 | if (argv['activity-name']) config.setName(argv['activity-name']);
49 |
50 | var options = {
51 | link: argv.link || argv.shared,
52 | customTemplate: argv.argv.remain[3],
53 | activityName: argv['activity-name']
54 | };
55 |
56 | require('./templates/cordova/loggingHelper').adjustLoggerLevel(argv);
57 |
58 | Api.createPlatform(argv.argv.remain[0], config, options).done();
59 |
--------------------------------------------------------------------------------
/bin/templates/cordova/lib/retry.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | /*
4 | Licensed to the Apache Software Foundation (ASF) under one
5 | or more contributor license agreements. See the NOTICE file
6 | distributed with this work for additional information
7 | regarding copyright ownership. The ASF licenses this file
8 | to you under the Apache License, Version 2.0 (the
9 | "License"); you may not use this file except in compliance
10 | with the License. You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing,
15 | software distributed under the License is distributed on an
16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 | KIND, either express or implied. See the License for the
18 | specific language governing permissions and limitations
19 | under the License.
20 | */
21 |
22 | /* jshint node: true */
23 |
24 | 'use strict';
25 |
26 | var events = require('cordova-common').events;
27 |
28 | /*
29 | * Retry a promise-returning function a number of times, propagating its
30 | * results on success or throwing its error on a failed final attempt.
31 | *
32 | * @arg {Number} attemts_left - The number of times to retry the passed call.
33 | * @arg {Function} promiseFunction - A function that returns a promise.
34 | * @arg {...} - Arguments to pass to promiseFunction.
35 | *
36 | * @returns {Promise}
37 | */
38 | module.exports.retryPromise = function (attemts_left, promiseFunction) {
39 |
40 | // NOTE:
41 | // get all trailing arguments, by skipping the first two (attemts_left and
42 | // promiseFunction) because they shouldn't get passed to promiseFunction
43 | var promiseFunctionArguments = Array.prototype.slice.call(arguments, 2);
44 |
45 | return promiseFunction.apply(undefined, promiseFunctionArguments).then(
46 |
47 | // on success pass results through
48 | function onFulfilled(value) {
49 | return value;
50 | },
51 |
52 | // on rejection either retry, or throw the error
53 | function onRejected(error) {
54 |
55 | attemts_left -= 1;
56 |
57 | if (attemts_left < 1) {
58 | throw error;
59 | }
60 |
61 | events.emit('verbose', 'A retried call failed. Retrying ' + attemts_left + ' more time(s).');
62 |
63 | // retry call self again with the same arguments, except attemts_left is now lower
64 | var fullArguments = [attemts_left, promiseFunction].concat(promiseFunctionArguments);
65 | return module.exports.retryPromise.apply(undefined, fullArguments);
66 | }
67 | );
68 | };
69 |
--------------------------------------------------------------------------------
/test/assets/www/jqmtabbackbutton/index.html:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 | Backbutton
23 |
24 |
25 |
26 |
27 |
28 |
29 |
45 |
46 |
47 |
48 |
49 |
Main
50 |
51 |
52 | To test, press several tabs.
53 | The "backbutton" can be pressed any time to exit app.
54 |
43 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/bin/templates/cordova/lib/plugin-build.gradle:
--------------------------------------------------------------------------------
1 | /* Licensed to the Apache Software Foundation (ASF) under one
2 | or more contributor license agreements. See the NOTICE file
3 | distributed with this work for additional information
4 | regarding copyright ownership. The ASF licenses this file
5 | to you under the Apache License, Version 2.0 (the
6 | "License"); you may not use this file except in compliance
7 | with the License. You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing,
12 | software distributed under the License is distributed on an
13 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | KIND, either express or implied. See the License for the
15 | specific language governing permissions and limitations
16 | under the License.
17 | */
18 |
19 | // GENERATED FILE! DO NOT EDIT!
20 |
21 | buildscript {
22 | repositories {
23 | mavenCentral()
24 | }
25 |
26 | // Switch the Android Gradle plugin version requirement depending on the
27 | // installed version of Gradle. This dependency is documented at
28 | // http://tools.android.com/tech-docs/new-build-system/version-compatibility
29 | // and https://issues.apache.org/jira/browse/CB-8143
30 | if (gradle.gradleVersion >= "2.2") {
31 | dependencies {
32 | classpath 'com.android.tools.build:gradle:1.0.0+'
33 | }
34 | } else if (gradle.gradleVersion >= "2.1") {
35 | dependencies {
36 | classpath 'com.android.tools.build:gradle:0.14.0+'
37 | }
38 | } else {
39 | dependencies {
40 | classpath 'com.android.tools.build:gradle:0.12.0+'
41 | }
42 | }
43 | }
44 |
45 | apply plugin: 'com.android.library'
46 |
47 | dependencies {
48 | compile fileTree(dir: 'libs', include: '*.jar')
49 | debugCompile project(path: ":CordovaLib", configuration: "debug")
50 | releaseCompile project(path: ":CordovaLib", configuration: "release")
51 | }
52 |
53 | android {
54 | compileSdkVersion cdvCompileSdkVersion
55 | buildToolsVersion cdvBuildToolsVersion
56 | publishNonDefault true
57 |
58 | compileOptions {
59 | sourceCompatibility JavaVersion.VERSION_1_6
60 | targetCompatibility JavaVersion.VERSION_1_6
61 | }
62 |
63 | sourceSets {
64 | main {
65 | manifest.srcFile 'AndroidManifest.xml'
66 | java.srcDirs = ['src']
67 | resources.srcDirs = ['src']
68 | aidl.srcDirs = ['src']
69 | renderscript.srcDirs = ['src']
70 | res.srcDirs = ['res']
71 | assets.srcDirs = ['assets']
72 | jniLibs.srcDirs = ['libs']
73 | }
74 | }
75 | }
76 |
77 | if (file('build-extras.gradle').exists()) {
78 | apply from: 'build-extras.gradle'
79 | }
80 |
--------------------------------------------------------------------------------
/test/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | apply plugin: 'android'
21 |
22 | buildscript {
23 | repositories {
24 | jcenter()
25 | }
26 |
27 | dependencies {
28 | classpath 'com.android.tools.build:gradle:2.1.2'
29 | }
30 | }
31 |
32 | allprojects {
33 | repositories {
34 | jcenter()
35 | }
36 | }
37 |
38 | ext {
39 | apply from: '../framework/cordova.gradle'
40 | cdvCompileSdkVersion = privateHelpers.getProjectTarget()
41 | cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
42 | }
43 |
44 | android {
45 | sourceSets {
46 | main {
47 | manifest.srcFile 'AndroidManifest.xml'
48 | java.srcDirs = ['src']
49 | resources.srcDirs = ['src']
50 | res.srcDirs = ['res']
51 | assets.srcDirs = ['assets']
52 | }
53 | androidTest {
54 | java.srcDirs = ['androidTest/src']
55 | resources.srcDirs = ['androidTest/src']
56 | res.srcDirs = []
57 | assets.srcDirs = []
58 | }
59 | }
60 |
61 | defaultConfig {
62 | testInstrumentationRunner "android.test.InstrumentationTestRunner"
63 | }
64 |
65 | testOptions {
66 | unitTests.returnDefaultValues = true
67 | }
68 |
69 | compileSdkVersion cdvCompileSdkVersion
70 | buildToolsVersion cdvBuildToolsVersion
71 |
72 | compileOptions {
73 | sourceCompatibility JavaVersion.VERSION_1_6
74 | targetCompatibility JavaVersion.VERSION_1_6
75 | }
76 | }
77 |
78 | dependencies {
79 | debugCompile project(path: ":CordovaLib", configuration: "debug")
80 | releaseCompile project(path: ":CordovaLib", configuration: "release")
81 | androidTestCompile fileTree(dir: 'androidTest/libs', include: '*.jar')
82 | testCompile 'junit:junit:4.12'
83 | }
84 |
85 | task copyCordovaJs (type: Copy) {
86 | from '../bin/templates/project/assets/www'
87 | into 'assets/www'
88 | include('cordova.js')
89 | }
90 | preBuild.dependsOn copyCordovaJs
91 |
92 |
93 |
--------------------------------------------------------------------------------
/spec/fixtures/android_project/res/xml/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
20 |
21 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/spec/unit/create.spec.js:
--------------------------------------------------------------------------------
1 | /**
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 | /* jshint laxcomma:true */
20 |
21 | require("promise-matchers");
22 |
23 | var create = require("../../bin/lib/create");
24 |
25 | describe("create", function () {
26 | describe("validatePackageName", function() {
27 | var valid = [
28 | "org.apache.mobilespec"
29 | , "com.example"
30 | , "com.floors42.package"
31 | , "ball8.ball8.ball8ball"
32 | ];
33 | var invalid = [
34 | ""
35 | , "com.class.is.bad"
36 | , "0com.example.mobilespec"
37 | , "c-m.e@a!p%e.mobilespec"
38 | , "notenoughdots"
39 | , ".starts.with.a.dot"
40 | , "ends.with.a.dot."
41 | , "_underscore.anything"
42 | , "underscore._something"
43 | , "_underscore._all._the._things"
44 | , "8.ball"
45 | , "8ball.ball"
46 | , "ball8.8ball"
47 | , "ball8.com.8ball"
48 | ];
49 |
50 | valid.forEach(function(package_name) {
51 | it("should accept " + package_name, function(done) {
52 | expect(create.validatePackageName(package_name)).toHaveBeenResolved(done);
53 | });
54 | });
55 |
56 | invalid.forEach(function(package_name) {
57 | it("should reject " + package_name, function(done) {
58 | expect(create.validatePackageName(package_name)).toHaveBeenRejected(done);
59 | });
60 | });
61 | });
62 | describe("validateProjectName", function() {
63 | var valid = [
64 | "mobilespec"
65 | , "package_name"
66 | , "PackageName"
67 | , "CordovaLib"
68 | ];
69 | var invalid = [
70 | ""
71 | , "0startswithdigit"
72 | , "CordovaActivity"
73 | ];
74 |
75 | valid.forEach(function(project_name) {
76 | it("should accept " + project_name, function(done) {
77 | expect(create.validateProjectName(project_name)).toHaveBeenResolved(done);
78 | });
79 | });
80 |
81 | invalid.forEach(function(project_name) {
82 | it("should reject " + project_name, function(done) {
83 | expect(create.validateProjectName(project_name)).toHaveBeenRejected(done);
84 | });
85 | });
86 | });
87 | });
88 |
--------------------------------------------------------------------------------
/test/assets/www/xhr/index.html:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 |
24 | Cordova Tests
25 |
26 |
27 |
28 |
48 |
49 |
50 |
XHR
51 |
52 |
Cordova:
53 |
Deviceready:
54 |
55 |
56 | Press buttons below to test. You should see an alert with results displayed.
57 |
58 | Load file://
59 | Load Google
60 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/spec/e2e/create.spec.js:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | var actions = require('./helpers/projectActions.js');
21 |
22 | var CREATE_TIMEOUT = 60000;
23 |
24 | function createAndBuild(projectname, projectid, done) {
25 | actions.createProject(projectname, projectid, function (error) {
26 | expect(error).toBe(null);
27 | actions.buildProject(projectid, function (error) {
28 | expect(error).toBe(null);
29 | actions.removeProject(projectid);
30 | done();
31 | });
32 | });
33 | }
34 |
35 |
36 | describe('create', function() {
37 |
38 | it('create project with ascii name, no spaces', function(done) {
39 | var projectname = 'testcreate';
40 | var projectid = 'com.test.create.app1';
41 |
42 | createAndBuild(projectname, projectid, done);
43 | }, CREATE_TIMEOUT);
44 |
45 | it('create project with ascii name, and spaces', function(done) {
46 | var projectname = 'test create';
47 | var projectid = 'com.test.create.app2';
48 |
49 | createAndBuild(projectname, projectid, done);
50 | }, CREATE_TIMEOUT);
51 |
52 | it('create project with unicode name, no spaces', function(done) {
53 | var projectname = '応応応応用用用用';
54 | var projectid = 'com.test.create.app3';
55 |
56 | createAndBuild(projectname, projectid, done);
57 | }, CREATE_TIMEOUT);
58 |
59 | it('create project with unicode name, and spaces', function(done) {
60 | var projectname = '応応応応 用用用用';
61 | var projectid = 'com.test.create.app4';
62 |
63 | createAndBuild(projectname, projectid, done);
64 | }, CREATE_TIMEOUT);
65 |
66 | it('create project with ascii+unicode name, no spaces', function(done) {
67 | var projectname = '応応応応hello用用用用';
68 | var projectid = 'com.test.create.app5';
69 |
70 | createAndBuild(projectname, projectid, done);
71 | }, CREATE_TIMEOUT);
72 |
73 | it('create project with ascii+unicode name, and spaces', function(done) {
74 | var projectname = '応応応応 hello 用用用用';
75 | var projectid = 'com.test.create.app6';
76 |
77 | createAndBuild(projectname, projectid, done);
78 | }, CREATE_TIMEOUT);
79 |
80 | });
81 |
--------------------------------------------------------------------------------
/framework/src/org/apache/cordova/CallbackMap.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 | package org.apache.cordova;
20 |
21 | import android.util.Pair;
22 | import android.util.SparseArray;
23 |
24 | /**
25 | * Provides a collection that maps unique request codes to CordovaPlugins and Integers.
26 | * Used to ensure that when plugins make requests for runtime permissions, those requests do not
27 | * collide with requests from other plugins that use the same request code value.
28 | */
29 | public class CallbackMap {
30 | private int currentCallbackId = 0;
31 | private SparseArray> callbacks;
32 |
33 | public CallbackMap() {
34 | this.callbacks = new SparseArray>();
35 | }
36 |
37 | /**
38 | * Stores a CordovaPlugin and request code and returns a new unique request code to use
39 | * in a permission request.
40 | *
41 | * @param receiver The plugin that is making the request
42 | * @param requestCode The original request code used by the plugin
43 | * @return A unique request code that can be used to retrieve this callback
44 | * with getAndRemoveCallback()
45 | */
46 | public synchronized int registerCallback(CordovaPlugin receiver, int requestCode) {
47 | int mappedId = this.currentCallbackId++;
48 | callbacks.put(mappedId, new Pair(receiver, requestCode));
49 | return mappedId;
50 | }
51 |
52 | /**
53 | * Retrieves and removes a callback stored in the map using the mapped request code
54 | * obtained from registerCallback()
55 | *
56 | * @param mappedId The request code obtained from registerCallback()
57 | * @return The CordovaPlugin and orignal request code that correspond to the
58 | * given mappedCode
59 | */
60 | public synchronized Pair getAndRemoveCallback(int mappedId) {
61 | Pair callback = callbacks.get(mappedId);
62 | callbacks.remove(mappedId);
63 | return callback;
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/test/androidTest/src/org/apache/cordova/test/CordovaPluginTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Licensed to the Apache Software Foundation (ASF) under one
4 | * or more contributor license agreements. See the NOTICE file
5 | * distributed with this work for additional information
6 | * regarding copyright ownership. The ASF licenses this file
7 | * to you under the Apache License, Version 2.0 (the
8 | * "License"); you may not use this file except in compliance
9 | * with the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing,
14 | * software distributed under the License is distributed on an
15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | * KIND, either express or implied. See the License for the
17 | * specific language governing permissions and limitations
18 | * under the License.
19 | *
20 | */
21 |
22 | package org.apache.cordova.test;
23 |
24 |
25 | import android.app.Activity;
26 | import android.test.ActivityInstrumentationTestCase2;
27 |
28 | import org.apache.cordova.CordovaWebView;
29 |
30 | import java.io.IOException;
31 | import java.lang.reflect.Method;
32 |
33 | public class CordovaPluginTest extends BaseCordovaIntegrationTest {
34 |
35 | protected void setUp() throws Exception {
36 | super.setUp();
37 | setUpWithStartUrl(null);
38 | }
39 |
40 | private void invokeBlockingCallToLifeCycleEvent(final String lifeCycleEventName) {
41 | testActivity.runOnUiThread( new Runnable() {
42 | public void run() {
43 | try {
44 | Method method = getInstrumentation().getClass().getMethod(lifeCycleEventName, Activity.class);
45 | method.invoke(getInstrumentation(), testActivity);
46 | } catch (Exception e) {
47 | fail("An Exception occurred in invokeBlockingCallToLifeCycleEvent while invoking " + lifeCycleEventName);
48 | }
49 | }
50 | });
51 | getInstrumentation().waitForIdleSync();
52 | }
53 |
54 | public void testPluginLifeCycle() throws IOException {
55 | //TODO: add coverage for both cases where handleOnStart is called in CordovaActivity (onStart and init)
56 | //currently only one of the cases is covered
57 | //TODO: add coverage for both cases where onStart is called in CordovaWebViewImpl (handleOnStart and init)
58 | //currently only one of the cases is covered
59 | LifeCyclePlugin testPlugin = (LifeCyclePlugin)cordovaWebView.getPluginManager().getPlugin("LifeCycle");
60 | testPlugin.calls = "";
61 | // testOnStart
62 | invokeBlockingCallToLifeCycleEvent("callActivityOnStart");
63 | invokeBlockingCallToLifeCycleEvent("callActivityOnResume");
64 | invokeBlockingCallToLifeCycleEvent("callActivityOnPause");
65 | invokeBlockingCallToLifeCycleEvent("callActivityOnStop");
66 | assertEquals("start,resume,pause,stop,", testPlugin.calls);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | Licensed to the Apache Software Foundation (ASF) under one
3 | or more contributor license agreements. See the NOTICE file
4 | distributed with this work for additional information
5 | regarding copyright ownership. The ASF licenses this file
6 | to you under the Apache License, Version 2.0 (the
7 | "License"); you may not use this file except in compliance
8 | with the License. You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing,
13 | software distributed under the License is distributed on an
14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | KIND, either express or implied. See the License for the
16 | specific language governing permissions and limitations
17 | under the License.
18 | */
19 |
20 | package org.apache.cordova.test;
21 |
22 | import java.util.concurrent.ArrayBlockingQueue;
23 |
24 | import org.apache.cordova.Config;
25 | import org.apache.cordova.ConfigXmlParser;
26 | import org.apache.cordova.CordovaInterfaceImpl;
27 | import org.apache.cordova.CordovaWebView;
28 | import org.apache.cordova.CordovaWebViewImpl;
29 | import org.apache.cordova.engine.SystemWebView;
30 | import org.apache.cordova.engine.SystemWebViewEngine;
31 |
32 | import android.app.Activity;
33 | import android.os.Bundle;
34 |
35 | /**
36 | * Tests creating the views via inflating a layout, and also tests *not* using CordovaActivity.
37 | */
38 | public class CordovaWebViewTestActivity extends Activity {
39 | private CordovaWebView cordovaWebView;
40 | public final ArrayBlockingQueue onPageFinishedUrl = new ArrayBlockingQueue(5);
41 | public static final String START_URL = "file:///android_asset/www/index.html";
42 |
43 | protected CordovaInterfaceImpl cordovaInterface = new CordovaInterfaceImpl(this) {
44 | @Override
45 | public Object onMessage(String id, Object data) {
46 | if ("onPageFinished".equals(id)) {
47 | onPageFinishedUrl.add((String) data);
48 | }
49 | return super.onMessage(id, data);
50 | }
51 | };
52 |
53 | /** Called when the activity is first created. */
54 | @Override
55 | public void onCreate(Bundle savedInstanceState) {
56 | super.onCreate(savedInstanceState);
57 | setContentView(R.layout.main);
58 |
59 |
60 | //Set up the webview
61 | ConfigXmlParser parser = new ConfigXmlParser();
62 | parser.parse(this);
63 |
64 | SystemWebView webView = (SystemWebView) findViewById(R.id.cordovaWebView);
65 | cordovaWebView = new CordovaWebViewImpl(new SystemWebViewEngine(webView));
66 | cordovaWebView.init(cordovaInterface, parser.getPluginEntries(), parser.getPreferences());
67 |
68 | cordovaWebView.loadUrl(START_URL);
69 | }
70 |
71 | public CordovaWebView getCordovaWebView() {
72 | return cordovaWebView;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------