Repository: cordova-android Updated Branches: refs/heads/master ac6ad2dea -> 3bbc7fb32
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/assets/www/lifecycle/index.html ---------------------------------------------------------------------- diff --git a/test/assets/www/lifecycle/index.html b/test/assets/www/lifecycle/index.html deleted file mode 100755 index 25fc230..0000000 --- a/test/assets/www/lifecycle/index.html +++ /dev/null @@ -1,112 +0,0 @@ -<!DOCTYPE HTML> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<html> -<head> -<head> -<meta http-equiv="Content-type" content="text/html; charset=utf-8"> -<title>Lifecycle Page 1</title> -<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title"> -<script type="text/javascript" charset="utf-8" src="../cordova.js"></script> - -<script type="text/javascript" charset="utf-8"> - - function onLoad() { - console.log("Page1: onload"); - log("Page1: onload @ " + new Date().toLocaleTimeString()); - document.addEventListener("deviceready", onDeviceReady, false); - } - - function onUnLoaded() { - console.log("Page1: onunload"); - log("Page1: onunload @ " + new Date().toLocaleTimeString()); - } - - function onDeviceReady() { - // Register the event listener - document.getElementById("deviceready").innerHTML = "fired"; - document.getElementById("cordova").innerHTML = cordova.version; - - document.addEventListener("pause", onPause, false); - document.addEventListener("resume", onResume, false); - - window.setInterval(function() { - log("Page1: Running"); - }, 2000); -} - - function onPause() { - console.log("Page1: onpause"); - log("Page1: onpause @ " + new Date().toLocaleTimeString()); - } - - function onResume() { - console.log("Page1: onresume"); - log("Page1: onresume @ " + new Date().toLocaleTimeString()); - } - - function log(s) { - var el = document.getElementById('status'); - var status = el.innerHTML + s + "<br>"; - el.innerHTML = status; - localStorage.lifecyclestatus = status; - } - - function clearStatus() { - console.log("clear()"); - localStorage.lifecyclestatus = ""; - document.getElementById('status').innerHTML = ""; - } - -</script> -</head> -<body onload="onLoad()" onunload="onUnLoaded()" id="stage" class="theme"> - <h1>Events</h1> - <div id="info"> - <h4>Cordova: <span id="cordova"> </span></h4> - <h4>Deviceready: <span id="deviceready"> </span></h4> - </div> - <div id="info"> - <h4>Test 1</h4> - Press "Home" button, then return to this app to see pause/resume.<br> - There should be "Running" entries between pause and resume since app continues to run in the background. - <h4>Test 2</h4> - Press "Load new page" button to load a new Cordova page.<br> - When returning, you should see - <ul> - <li>Page2: onunload</li> - <li>Page1: onload</li> - <li>Page1: Running</li> - </ul> - </div> - <div id="info"> - <h4>Info for event testing:</h4> - <div id="status"></div> - </div> - - <a href="index2.html" class="btn large" >Load new page</a> - <a href="javascript:" class="btn large" onclick="clearStatus();">Clear status</a> - - <script> - document.getElementById('status').innerHTML = localStorage.lifecyclestatus; - </script> -</body> -</html> - - http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/assets/www/lifecycle/index2.html ---------------------------------------------------------------------- diff --git a/test/assets/www/lifecycle/index2.html b/test/assets/www/lifecycle/index2.html deleted file mode 100755 index 9b22a0d..0000000 --- a/test/assets/www/lifecycle/index2.html +++ /dev/null @@ -1,110 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<!DOCTYPE HTML> -<html> -<head> -<head> -<meta http-equiv="Content-type" content="text/html; charset=utf-8"> -<title>Lifecycle Page 2</title> -<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title"> -<script type="text/javascript" charset="utf-8" src="../cordova.js"></script> - -<script type="text/javascript" charset="utf-8"> - - function onLoad() { - console.log("Page2: onload"); - log("Page2: onload @ " + new Date().toLocaleTimeString()); - document.addEventListener("deviceready", onDeviceReady, false); - } - - function onUnLoaded() { - console.log("Page2: onunload"); - log("Page2: onunload @ " + new Date().toLocaleTimeString()); - } - - function onDeviceReady() { - // Register the event listener - document.getElementById("deviceready").innerHTML = "fired"; - document.getElementById("cordova").innerHTML = cordova.version; - - document.addEventListener("pause", onPause, false); - document.addEventListener("resume", onResume, false); - - window.setInterval(function() { - log("Page2: Running"); - }, 2000); - } - - function onPause() { - console.log("Page2: onpause"); - log("Page2: onpause @ " + new Date().toLocaleTimeString()); - } - - function onResume() { - console.log("Page2: onresume"); - log("Page2: onresume @ " + new Date().toLocaleTimeString()); - } - - function log(s) { - var el = document.getElementById('status'); - var status = el.innerHTML + s + "<br>"; - el.innerHTML = status; - localStorage.lifecyclestatus = status; - } - - function clearStatus() { - console.log("clear()"); - localStorage.lifecyclestatus = ""; - document.getElementById('status').innerHTML = ""; - } - -</script> -</head> -<body onload="onLoad()" onunload="onUnLoaded()" id="stage" class="theme"> - <h1>Events</h1> - <div id="info"> - <h4>Cordova: <span id="cordova"> </span></h4> - <h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4> - <h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4> - <h4>Width: <span id="width"> </span>, Height: <span id="height"> </span>, Color Depth: <span id="colorDepth"></span></h4> - </div> - <div id="info"> - You should see<br> - <ul> - <li>Page1: onunload</li> - <li>Page2: onload</li> - <li>Page2: Running</li> - </ul> - Press "backbutton" to return to Page 1. - </div> - <div id="info"> - <h4>Info for event testing:</h4> - <div id="status"></div> - </div> - - <a href="index.html" class="btn large" >Load new page</a> - <a href="javascript:" class="btn large" onclick="clearStatus();">Clear status</a> - - <script> - document.getElementById('status').innerHTML = localStorage.lifecyclestatus; - </script> -</body> -</html> - - http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/assets/www/main.js ---------------------------------------------------------------------- diff --git a/test/assets/www/main.js b/test/assets/www/main.js deleted file mode 100755 index a242139..0000000 --- a/test/assets/www/main.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ - -var deviceInfo = function() { - document.getElementById("deviceready").innerHTML = "fired"; - document.getElementById("cordova").innerHTML = cordova.version; -}; - -function init() { - document.addEventListener("deviceready", deviceInfo, true); -} http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/assets/www/master.css ---------------------------------------------------------------------- diff --git a/test/assets/www/master.css b/test/assets/www/master.css deleted file mode 100755 index c3e3c45..0000000 --- a/test/assets/www/master.css +++ /dev/null @@ -1,136 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ - - body { - background:#222 none repeat scroll 0 0; - color:#666; - font-family:Helvetica; - font-size:72%; - line-height:1.5em; - margin:0; - border-top:1px solid #393939; - } - - #info{ - background:#ffa; - border: 1px solid #ffd324; - -webkit-border-radius: 5px; - border-radius: 5px; - clear:both; - margin:15px 6px 0; - width:295px; - padding:4px 0px 2px 10px; - } - - #info > h4{ - font-size:.95em; - margin:5px 0; - } - - #stage.theme{ - padding-top:3px; - } - - /* Definition List */ - #stage.theme > dl{ - padding-top:10px; - clear:both; - margin:0; - list-style-type:none; - padding-left:10px; - overflow:auto; - } - - #stage.theme > dl > dt{ - font-weight:bold; - float:left; - margin-left:5px; - } - - #stage.theme > dl > dd{ - width:45px; - float:left; - color:#a87; - font-weight:bold; - } - - /* Content Styling */ - #stage.theme > h1, #stage.theme > h2, #stage.theme > p{ - margin:1em 0 .5em 13px; - } - - #stage.theme > h1{ - color:#eee; - font-size:1.6em; - text-align:center; - margin:0; - margin-top:15px; - padding:0; - } - - #stage.theme > h2{ - clear:both; - margin:0; - padding:3px; - font-size:1em; - text-align:center; - } - - /* Stage Buttons */ - #stage.theme a.btn{ - border: 1px solid #555; - -webkit-border-radius: 5px; - border-radius: 5px; - text-align:center; - display:block; - float:left; - background:#444; - width:150px; - color:#9ab; - font-size:1.1em; - text-decoration:none; - padding:1.2em 0; - margin:3px 0px 3px 5px; - } - #stage.theme a.btn.large{ - width:308px; - padding:1.2em 0; - } - - /* Stage Buttons */ - #stage.theme button.btn{ - border: 1px solid #555; - -webkit-border-radius: 5px; - border-radius: 5px; - text-align:center; - display:block; - float:left; - background:#444; - width:150px; - color:#9ab; - font-size:1.1em; - text-decoration:none; - padding:1.2em 0; - margin:3px 0px 3px 5px; - } -#stage.theme button.btn.large{ - width:308px; - padding:1.2em 0; - } - http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/assets/www/menus/index.html ---------------------------------------------------------------------- diff --git a/test/assets/www/menus/index.html b/test/assets/www/menus/index.html deleted file mode 100755 index ff0b93b..0000000 --- a/test/assets/www/menus/index.html +++ /dev/null @@ -1,45 +0,0 @@ -<!DOCTYPE HTML> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<html> - <head> - <meta name="viewport" content="width=320, user-scalable=no" /> - <meta http-equiv="Content-type" content="text/html; charset=utf-8"> - <title>Cordova Tests</title> - <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title"> - <script type="text/javascript" charset="utf-8" src="../cordova.js"></script> - <script type="text/javascript" charset="utf-8" src="../main.js"></script> - </head> - <body onload="init();" id="stage" class="theme"> - <h1>Menu Test</h1> - <div id="info"> - <h4>Cordova: <span id="cordova"> </span></h4> - <h4>Deviceready: <span id="deviceready"> </span></h4> - </div> - <div id="info"> - <h4>The options menu items should be:</h4> - <li>Item1<br> - <li>Item2<br> - <li>Item3<br> - <h4>There is also a context menu. Touch and hold finger here to see:</h4> - <li>Context Item1<br> - </div> - - </body> -</html> http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/assets/www/userwebview/index.html ---------------------------------------------------------------------- diff --git a/test/assets/www/userwebview/index.html b/test/assets/www/userwebview/index.html deleted file mode 100755 index b1a653a..0000000 --- a/test/assets/www/userwebview/index.html +++ /dev/null @@ -1,65 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<!DOCTYPE HTML> -<html> - <head> - <meta name="viewport" content="width=320, user-scalable=no" /> - <meta http-equiv="Content-type" content="text/html; charset=utf-8"> - <title>Cordova Tests</title> - <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title"> - <script type="text/javascript" charset="utf-8" src="../cordova.js"></script> - <script type="text/javascript" charset="utf-8" src="../main.js"></script> - </head> - <body onload="init();" id="stage" class="theme"> - <h1>User WebView/Client/Chrome Test</h1> - <div id="info"> - <h4>Cordova: <span id="cordova"> </span></h4> - <h4>Deviceready: <span id="deviceready"> </span></h4> - </div> - <div id="info"> - <h4>The following should be seen in LogCat:</h4> - <li>userwebview: TestViewClient()<br> - <li>userwebview: TestChromeClient()<br> - <li>userwebview: onGeolocationPermissionsShowPrompt(file://)<br> - <li>userwebview: shouldOverrideUrlLoading(test://this_will_call_shouldOverrideUrlLoading)<br> - - </div> - <script> - /** - * Get current location - */ - console.log("getLocation()"); - - // Success callback - var success = function(p){ - console.log("Location = "+p.coords.latitude+","+p.coords.longitude); - window.location = "test://this_will_call_shouldOverrideUrlLoading"; - }; - - // Fail callback - var fail = function(e){ - console.log("Error: "+e.code); - }; - - // Get location - navigator.geolocation.getCurrentPosition(success, fail, {enableHighAccuracy: true}); - - </script> - </body> -</html> http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/assets/www/whitelist/index.html ---------------------------------------------------------------------- diff --git a/test/assets/www/whitelist/index.html b/test/assets/www/whitelist/index.html deleted file mode 100755 index b9596c9..0000000 --- a/test/assets/www/whitelist/index.html +++ /dev/null @@ -1,45 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<!DOCTYPE HTML> -<html> - <head> - <meta name="viewport" content="width=320, user-scalable=no" /> - <meta http-equiv="Content-type" content="text/html; charset=utf-8"> - <title>Cordova Tests</title> - <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title"> - <script type="text/javascript" charset="utf-8" src="../cordova.js"></script> - <script type="text/javascript" charset="utf-8" src="../main.js"></script> - </head> - <body onload="init();" id="stage" class="theme"> - <h1>Whitelist Page 1</h1> - <div id="info"> - <h4>Cordova: <span id="cordova"> </span></h4> - <h4>Deviceready: <span id="deviceready"> </span></h4> - </div> - <div id="info"> - Loading Page 2 should be successful.<br> - Loading Page 3 should be in web browser.<br> - Loading Page 2 with target=_blank should be in web browser? <br> - (THIS DOESN'T HAPPEN.) https://issues.apache.org/jira/browse/CB-362 - </div> - <a href="index2.html" class="btn large">Page 2</a> - <a href="http://www.google.com" class="btn large">Page 3</a> - <a href="index2.html" class="btn large" target="_blank">Page 2 with target=_blank</a> - </body> -</html> http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/assets/www/whitelist/index2.html ---------------------------------------------------------------------- diff --git a/test/assets/www/whitelist/index2.html b/test/assets/www/whitelist/index2.html deleted file mode 100755 index 5d990ad..0000000 --- a/test/assets/www/whitelist/index2.html +++ /dev/null @@ -1,39 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<!DOCTYPE HTML> -<html> - <head> - <meta name="viewport" content="width=320, user-scalable=no" /> - <meta http-equiv="Content-type" content="text/html; charset=utf-8"> - <title>Cordova Tests</title> - <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title"> - <script type="text/javascript" charset="utf-8" src="../cordova.js"></script> - <script type="text/javascript" charset="utf-8" src="../main.js"></script> - </head> - <body onload="init();" id="stage" class="theme"> - <h1>Whitelist Page 2</h1> - <div id="info"> - <h4>Cordova: <span id="cordova"> </span></h4> - <h4>Deviceready: <span id="deviceready"> </span></h4> - </div> - <div id="info"> - Press "backbutton" - </div> - </body> -</html> http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/assets/www/xhr/index.html ---------------------------------------------------------------------- diff --git a/test/assets/www/xhr/index.html b/test/assets/www/xhr/index.html deleted file mode 100755 index d1b997a..0000000 --- a/test/assets/www/xhr/index.html +++ /dev/null @@ -1,64 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<!DOCTYPE HTML> -<html> - <head> - <meta name="viewport" content="width=320, user-scalable=no" /> - <meta http-equiv="Content-type" content="text/html; charset=utf-8"> - <title>Cordova Tests</title> - <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title"> - <script type="text/javascript" charset="utf-8" src="../cordova.js"></script> - <script type="text/javascript" charset="utf-8" src="../main.js"></script> - <script> - function XHR(url) { - var xmlhttp = new XMLHttpRequest(); - xmlhttp.onreadystatechange=function(){ - if(xmlhttp.readyState === 4){ - // If success - if (xmlhttp.status === 200) { - alert("XHR success. Result="+xmlhttp.responseText); - } - // If error - else { - alert("XHR error. Status="+xmlhttp.status); - } - } - }; - console.log("GET "+url); - xmlhttp.open("GET", url , true); - xmlhttp.send(); - } - </script> - </head> - <body onload="init();" id="stage" class="theme"> - <h1>XHR</h1> - <div id="info"> - <h4>Cordova: <span id="cordova"> </span></h4> - <h4>Deviceready: <span id="deviceready"> </span></h4> - </div> - <div id="info"> - Press buttons below to test. You should see an alert with results displayed. - </div> - <a href="javascript:" class="btn large" onclick="XHR('file:///android_asset/www/xhr/index.html')">Load file://</a> - <a href="javascript:" class="btn large" onclick="XHR('http://www.google.com');">Load Google</a> - <!-- - <a href="javascript:" class="btn large" onclick="XHR('content://com.android.contacts/data/1');">Load content://</a> - --> - </body> -</html> http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/build.gradle ---------------------------------------------------------------------- diff --git a/test/build.gradle b/test/build.gradle index dd30a4a..74b2ab0 100644 --- a/test/build.gradle +++ b/test/build.gradle @@ -1,31 +1,14 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ - -apply plugin: 'android' +// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } - dependencies { - classpath 'com.android.tools.build:gradle:2.2.1' + classpath 'com.android.tools.build:gradle:2.2.3' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files } } @@ -35,58 +18,6 @@ allprojects { } } -ext { - apply from: '../framework/cordova.gradle' - cdvCompileSdkVersion = privateHelpers.getProjectTarget() - cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools() +task clean(type: Delete) { + delete rootProject.buildDir } - -android { - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = ['src'] - resources.srcDirs = ['src'] - res.srcDirs = ['res'] - assets.srcDirs = ['assets'] - } - androidTest { - java.srcDirs = ['androidTest/src'] - resources.srcDirs = ['androidTest/src'] - res.srcDirs = [] - assets.srcDirs = [] - } - } - - defaultConfig { - testInstrumentationRunner "android.test.InstrumentationTestRunner" - } - - testOptions { - unitTests.returnDefaultValues = true - } - - compileSdkVersion cdvCompileSdkVersion - buildToolsVersion cdvBuildToolsVersion - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_6 - targetCompatibility JavaVersion.VERSION_1_6 - } -} - -dependencies { - debugCompile project(path: ":CordovaLib", configuration: "debug") - releaseCompile project(path: ":CordovaLib", configuration: "release") - androidTestCompile fileTree(dir: 'androidTest/libs', include: '*.jar') - testCompile 'junit:junit:4.12' -} - -task copyCordovaJs (type: Copy) { - from '../bin/templates/project/assets/www' - into 'assets/www' - include('cordova.js') -} -preBuild.dependsOn copyCordovaJs - - http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/gradle.properties ---------------------------------------------------------------------- diff --git a/test/gradle.properties b/test/gradle.properties new file mode 100644 index 0000000..aac7c9b --- /dev/null +++ b/test/gradle.properties @@ -0,0 +1,17 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/gradle/wrapper/gradle-wrapper.properties ---------------------------------------------------------------------- diff --git a/test/gradle/wrapper/gradle-wrapper.properties b/test/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..04e285f --- /dev/null +++ b/test/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Dec 28 10:00:20 PST 2015 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/gradlew ---------------------------------------------------------------------- diff --git a/test/gradlew b/test/gradlew new file mode 100755 index 0000000..9d82f78 --- /dev/null +++ b/test/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/gradlew.bat ---------------------------------------------------------------------- diff --git a/test/gradlew.bat b/test/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/test/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/project.properties ---------------------------------------------------------------------- diff --git a/test/project.properties b/test/project.properties deleted file mode 100644 index fcee01f..0000000 --- a/test/project.properties +++ /dev/null @@ -1,12 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "ant.properties", and override values to adapt the script to your -# project structure. - -# Project target. -target=android-21 -android.library.reference.1=../framework http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/res/drawable-hdpi/ic_launcher.png ---------------------------------------------------------------------- diff --git a/test/res/drawable-hdpi/ic_launcher.png b/test/res/drawable-hdpi/ic_launcher.png deleted file mode 100755 index 4d27634..0000000 Binary files a/test/res/drawable-hdpi/ic_launcher.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/res/drawable-ldpi/ic_launcher.png ---------------------------------------------------------------------- diff --git a/test/res/drawable-ldpi/ic_launcher.png b/test/res/drawable-ldpi/ic_launcher.png deleted file mode 100755 index cd5032a..0000000 Binary files a/test/res/drawable-ldpi/ic_launcher.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/res/drawable-mdpi/ic_launcher.png ---------------------------------------------------------------------- diff --git a/test/res/drawable-mdpi/ic_launcher.png b/test/res/drawable-mdpi/ic_launcher.png deleted file mode 100755 index e79c606..0000000 Binary files a/test/res/drawable-mdpi/ic_launcher.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/res/drawable/icon.png ---------------------------------------------------------------------- diff --git a/test/res/drawable/icon.png b/test/res/drawable/icon.png deleted file mode 100755 index 697df7f..0000000 Binary files a/test/res/drawable/icon.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/res/layout/main.xml ---------------------------------------------------------------------- diff --git a/test/res/layout/main.xml b/test/res/layout/main.xml deleted file mode 100644 index 978e176..0000000 --- a/test/res/layout/main.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:orientation="vertical" > - - <org.apache.cordova.engine.SystemWebView - android:id="@+id/cordovaWebView" - android:layout_width="fill_parent" - android:layout_height="fill_parent" /> - - -</LinearLayout> http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/res/values/strings.xml ---------------------------------------------------------------------- diff --git a/test/res/values/strings.xml b/test/res/values/strings.xml deleted file mode 100644 index 59e22e6..0000000 --- a/test/res/values/strings.xml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<resources> - <string name="app_name">CordovaNativeTests</string> -</resources> http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/res/xml/config.xml ---------------------------------------------------------------------- diff --git a/test/res/xml/config.xml b/test/res/xml/config.xml deleted file mode 100644 index b7570de..0000000 --- a/test/res/xml/config.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version='1.0' encoding='utf-8'?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<widget id="io.cordova.helloCordova" version="2.0.0" xmlns="http://www.w3.org/ns/widgets"> - <name>Hello Cordova</name> - <description> - A sample Apache Cordova application that responds to the deviceready event. - </description> - <author email="[email protected]" href="http://cordova.io"> - Apache Cordova Team - </author> - <access origin="*.apache.org" /> - <access origin="http://*.google.com/*" /> - <access origin="https://*.google.com/*" /> - <access origin="https://*.googleapis.com/*" /> - <access origin="https://*.gstatic.com/*" /> - <content src="index.html" /> - <preference name="loglevel" value="DEBUG" /> - <preference name="useBrowserHistory" value="true" /> - <preference name="exit-on-suspend" value="false" /> - <preference name="showTitle" value="true" /> - <preference name="BackgroundColor" value="#000000" /> - <feature name="Activity"> - <param name="android-package" value="org.apache.cordova.test.ActivityPlugin" /> - </feature> - <feature name="LifeCycle"> - <param name="android-package" value="org.apache.cordova.test.LifeCyclePlugin" /> - <param name="onload" value="true" /> - </feature> -</widget> http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/settings.gradle ---------------------------------------------------------------------- diff --git a/test/settings.gradle b/test/settings.gradle index 1de1589..0113229 100644 --- a/test/settings.gradle +++ b/test/settings.gradle @@ -1,22 +1,3 @@ -/* Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ - -include ":" +include ':app' include ":CordovaLib" project(':CordovaLib').projectDir = new File('../framework') - http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/src/org/apache/cordova/test/ActivityPlugin.java ---------------------------------------------------------------------- diff --git a/test/src/org/apache/cordova/test/ActivityPlugin.java b/test/src/org/apache/cordova/test/ActivityPlugin.java deleted file mode 100755 index c6a96ec..0000000 --- a/test/src/org/apache/cordova/test/ActivityPlugin.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ -package org.apache.cordova.test; - -import org.apache.cordova.CordovaArgs; -import org.apache.cordova.LOG; -import org.json.JSONArray; -import org.json.JSONException; - -import android.content.Intent; - -import org.apache.cordova.CallbackContext; -import org.apache.cordova.CordovaPlugin; -import org.apache.cordova.PluginResult; -import org.json.JSONObject; - -import java.util.Collections; -import java.util.Iterator; - -public class ActivityPlugin extends CordovaPlugin { - - static String TAG = "ActivityPlugin"; - public static final String BACKBUTTONMULTIPAGE_URL = "file:///android_asset/www/backbuttonmultipage/index.html"; - - public boolean execute(String action, CordovaArgs args, final CallbackContext callbackContext) throws JSONException { - if (action.equals("start")) { - String className = args.isNull(0) ? MainTestActivity.class.getCanonicalName() : args.getString(0); - String startUrl = args.getString(1); - JSONObject extraPrefs = args.getJSONObject(2); - this.startActivity(className, startUrl, extraPrefs); - callbackContext.success(); - return true; - } - return false; - } - - public void startActivity(String className, String startUrl, JSONObject extraPrefs) throws JSONException { - try { - if (!startUrl.contains(":")) { - startUrl = "file:///android_asset/www/" + startUrl; - } - Intent intent = new Intent(this.cordova.getActivity(), Class.forName(className)); - intent.putExtra("testStartUrl", startUrl); - Iterator<String> iter = extraPrefs.keys(); - while (iter.hasNext()) { - String key = iter.next(); - intent.putExtra(key, extraPrefs.getString(key)); - } - LOG.d(TAG, "Starting activity %s", className); - this.cordova.getActivity().startActivity(intent); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - LOG.e(TAG, "Error starting activity %s", className); - } - } - -} http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/src/org/apache/cordova/test/BaseTestCordovaActivity.java ---------------------------------------------------------------------- diff --git a/test/src/org/apache/cordova/test/BaseTestCordovaActivity.java b/test/src/org/apache/cordova/test/BaseTestCordovaActivity.java deleted file mode 100644 index 0c50569..0000000 --- a/test/src/org/apache/cordova/test/BaseTestCordovaActivity.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ -package org.apache.cordova.test; - -import android.content.Intent; -import android.os.Bundle; - -import org.apache.cordova.CordovaActivity; -import org.apache.cordova.CordovaWebView; - -import java.util.concurrent.ArrayBlockingQueue; - -public class BaseTestCordovaActivity extends CordovaActivity { - public final ArrayBlockingQueue<String> onPageFinishedUrl = new ArrayBlockingQueue<String>(500); - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - } - - @Override - public Object onMessage(String id, Object data) { - if ("onPageFinished".equals(id)) { - onPageFinishedUrl.add((String) data); - } - return super.onMessage(id, data); - } - - public CordovaWebView getCordovaWebView() { - return appView; - } - - // By default, displayError shows a dialog, but for tests we just add the message to the queue - @Override - public void displayError(String title, String message, String button, boolean exit) { - onPageFinishedUrl.add(message); - } - -} http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java ---------------------------------------------------------------------- diff --git a/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java b/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java deleted file mode 100644 index e79e106..0000000 --- a/test/src/org/apache/cordova/test/CordovaWebViewTestActivity.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ - -package org.apache.cordova.test; - -import java.util.concurrent.ArrayBlockingQueue; - -import org.apache.cordova.Config; -import org.apache.cordova.ConfigXmlParser; -import org.apache.cordova.CordovaInterfaceImpl; -import org.apache.cordova.CordovaWebView; -import org.apache.cordova.CordovaWebViewImpl; -import org.apache.cordova.engine.SystemWebView; -import org.apache.cordova.engine.SystemWebViewEngine; - -import android.app.Activity; -import android.os.Bundle; - -/** - * Tests creating the views via inflating a layout, and also tests *not* using CordovaActivity. - */ -public class CordovaWebViewTestActivity extends Activity { - private CordovaWebView cordovaWebView; - public final ArrayBlockingQueue<String> onPageFinishedUrl = new ArrayBlockingQueue<String>(5); - public static final String START_URL = "file:///android_asset/www/index.html"; - - protected CordovaInterfaceImpl cordovaInterface = new CordovaInterfaceImpl(this) { - @Override - public Object onMessage(String id, Object data) { - if ("onPageFinished".equals(id)) { - onPageFinishedUrl.add((String) data); - } - return super.onMessage(id, data); - } - }; - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - - - //Set up the webview - ConfigXmlParser parser = new ConfigXmlParser(); - parser.parse(this); - - SystemWebView webView = (SystemWebView) findViewById(R.id.cordovaWebView); - cordovaWebView = new CordovaWebViewImpl(new SystemWebViewEngine(webView)); - cordovaWebView.init(cordovaInterface, parser.getPluginEntries(), parser.getPreferences()); - - cordovaWebView.loadUrl(START_URL); - } - - public CordovaWebView getCordovaWebView() { - return cordovaWebView; - } -} http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/src/org/apache/cordova/test/LifeCyclePlugin.java ---------------------------------------------------------------------- diff --git a/test/src/org/apache/cordova/test/LifeCyclePlugin.java b/test/src/org/apache/cordova/test/LifeCyclePlugin.java deleted file mode 100644 index 62ab7fa..0000000 --- a/test/src/org/apache/cordova/test/LifeCyclePlugin.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ -package org.apache.cordova.test; - -import org.apache.cordova.CordovaPlugin; -import org.apache.cordova.LOG; - -public class LifeCyclePlugin extends CordovaPlugin { - - static String TAG = "LifeCyclePlugin"; - String calls = ""; - - @Override - public void onStart() { - calls += "start,"; - LOG.d(TAG, "onStart"); - } - @Override - public void onPause(boolean multitasking) { - calls += "pause,"; - LOG.d(TAG, "onPause"); - } - @Override - public void onResume(boolean multitasking) { - calls += "resume,"; - LOG.d(TAG, "onResume"); - } - @Override - public void onStop() { - calls += "stop,"; - LOG.d(TAG, "onStop"); - } -} http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/src/org/apache/cordova/test/MainTestActivity.java ---------------------------------------------------------------------- diff --git a/test/src/org/apache/cordova/test/MainTestActivity.java b/test/src/org/apache/cordova/test/MainTestActivity.java deleted file mode 100644 index 76697c3..0000000 --- a/test/src/org/apache/cordova/test/MainTestActivity.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ -package org.apache.cordova.test; - -import android.os.Bundle; - -public class MainTestActivity extends BaseTestCordovaActivity { - public static final String START_URL = "file:///android_asset/www/index.html"; - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - String url = getIntent().getStringExtra("testStartUrl"); - if (url == null) { - url = START_URL; - } - super.loadUrl(url); - } - - @Override protected void loadConfig() { - super.loadConfig(); - // Need to set this explicitly in prefs since it's not settable via bundle extras. - String errorUrl = getIntent().getStringExtra("testErrorUrl"); - if (errorUrl != null) { - preferences.set("errorUrl", errorUrl); - } - } -} http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/src/org/apache/cordova/test/menus.java ---------------------------------------------------------------------- diff --git a/test/src/org/apache/cordova/test/menus.java b/test/src/org/apache/cordova/test/menus.java deleted file mode 100755 index 6ef12c5..0000000 --- a/test/src/org/apache/cordova/test/menus.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ -package org.apache.cordova.test; - -import android.os.Bundle; -import android.view.ContextMenu; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.ContextMenu.ContextMenuInfo; - -import org.apache.cordova.*; -import org.apache.cordova.LOG; - -public class menus extends BaseTestCordovaActivity { - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - // need the title to be shown (config.xml) for the options menu to be visible - super.init(); - super.registerForContextMenu(super.appView.getView()); - super.loadUrl("file:///android_asset/www/menus/index.html"); - } - - // Demonstrate how to add your own menus to app - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - super.onCreateOptionsMenu(menu); - int base = Menu.FIRST; - // Group, item id, order, title - menu.add(base, base, base, "Item1"); - menu.add(base, base + 1, base + 1, "Item2"); - menu.add(base, base + 2, base + 2, "Item3"); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - LOG.d("menus", "Item " + item.getItemId() + " pressed."); - this.appView.loadUrl("javascript:alert('Menu " + item.getItemId() + " pressed.')"); - return super.onOptionsItemSelected(item); - } - - @Override - public boolean onPrepareOptionsMenu(Menu menu) { - LOG.d("menus", "onPrepareOptionsMenu()"); - // this.appView.loadUrl("javascript:alert('onPrepareOptionsMenu()')"); - return true; - } - - @Override - public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo info) { - LOG.d("menus", "onCreateContextMenu()"); - menu.setHeaderTitle("Test Context Menu"); - menu.add(200, 200, 200, "Context Item1"); - } - - @Override - public boolean onContextItemSelected(MenuItem item) { - this.appView.loadUrl("javascript:alert('Context Menu " + item.getItemId() + " pressed.')"); - return true; - } - -} http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/src/org/apache/cordova/test/userwebview.java ---------------------------------------------------------------------- diff --git a/test/src/org/apache/cordova/test/userwebview.java b/test/src/org/apache/cordova/test/userwebview.java deleted file mode 100755 index a37114f..0000000 --- a/test/src/org/apache/cordova/test/userwebview.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ -package org.apache.cordova.test; - -import android.os.Bundle; -import android.webkit.WebView; -import android.webkit.GeolocationPermissions.Callback; - -import org.apache.cordova.*; -import org.apache.cordova.engine.SystemWebChromeClient; -import org.apache.cordova.engine.SystemWebViewClient; -import org.apache.cordova.engine.SystemWebViewEngine; - -public class userwebview extends MainTestActivity { - - public TestViewClient testViewClient; - public TestChromeClient testChromeClient; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - SystemWebViewEngine engine = (SystemWebViewEngine)appView.getEngine(); - testViewClient = new TestViewClient(engine); - testChromeClient = new TestChromeClient(engine); - super.init(); - WebView webView = (WebView)engine.getView(); - webView.setWebViewClient(testViewClient); - webView.setWebChromeClient(testChromeClient); - super.loadUrl("file:///android_asset/www/userwebview/index.html"); - } - - public class TestChromeClient extends SystemWebChromeClient { - public TestChromeClient(SystemWebViewEngine parentEngine) { - super(parentEngine); - LOG.d("userwebview", "TestChromeClient()"); - } - - @Override - public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) { - LOG.d("userwebview", "onGeolocationPermissionsShowPrompt(" + origin + ")"); - super.onGeolocationPermissionsShowPrompt(origin, callback); - callback.invoke(origin, true, false); - } - } - - /** - * This class can be used to override the GapViewClient and receive notification of webview events. - */ - public class TestViewClient extends SystemWebViewClient { - public TestViewClient(SystemWebViewEngine parentEngine) { - super(parentEngine); - LOG.d("userwebview", "TestViewClient()"); - } - - @Override - public boolean shouldOverrideUrlLoading(WebView view, String url) { - LOG.d("userwebview", "shouldOverrideUrlLoading(" + url + ")"); - return super.shouldOverrideUrlLoading(view, url); - } - - @Override - public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { - LOG.d("userwebview", "onReceivedError: Error code=" + errorCode + " Description=" + description + " URL=" + failingUrl); - super.onReceivedError(view, errorCode, description, failingUrl); - } - } - -} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
