Permalink
Browse files

Tests to verify Android native features.

  • Loading branch information...
1 parent dfc86b1 commit c18c0b415e998276e2a904fdf60b1a7f1c4e788f @brycecurtis brycecurtis committed Mar 29, 2012
Showing with 6,621 additions and 0 deletions.
  1. +9 −0 test/.classpath
  2. +33 −0 test/.project
  3. +87 −0 test/AndroidManifest.xml
  4. +23 −0 test/assets/www/backbuttonmultipage/index.html
  5. +23 −0 test/assets/www/backbuttonmultipage/sample2.html
  6. +25 −0 test/assets/www/backbuttonmultipage/sample3.html
  7. +99 −0 test/assets/www/background/index.html
  8. +98 −0 test/assets/www/background/index2.html
  9. +4,895 −0 test/assets/www/cordova-1.6.0rc1.js
  10. +2 −0 test/assets/www/cordova.js
  11. +1 −0 test/assets/www/htmlnotfound/error.html
  12. +32 −0 test/assets/www/iframe/index.html
  13. +23 −0 test/assets/www/iframe/index2.html
  14. +44 −0 test/assets/www/index.html
  15. +49 −0 test/assets/www/jqmtabbackbutton/index.html
  16. +29 −0 test/assets/www/jqmtabbackbutton/tab1.html
  17. +30 −0 test/assets/www/jqmtabbackbutton/tab2.html
  18. +30 −0 test/assets/www/jqmtabbackbutton/tab3.html
  19. +99 −0 test/assets/www/lifecycle/index.html
  20. +98 −0 test/assets/www/lifecycle/index2.html
  21. +146 −0 test/assets/www/main.js
  22. +117 −0 test/assets/www/master.css
  23. +29 −0 test/assets/www/menus/index.html
  24. +22 −0 test/assets/www/splashscreen/index.html
  25. +49 −0 test/assets/www/userwebview/index.html
  26. +28 −0 test/assets/www/whitelist/index.html
  27. +23 −0 test/assets/www/whitelist/index2.html
  28. +47 −0 test/assets/www/xhr/index.html
  29. BIN test/libs/cordova-1.6.0rc1.jar
  30. +11 −0 test/project.properties
  31. BIN test/res/drawable-hdpi/ic_launcher.png
  32. BIN test/res/drawable-ldpi/ic_launcher.png
  33. BIN test/res/drawable-mdpi/ic_launcher.png
  34. BIN test/res/drawable/icon.png
  35. BIN test/res/drawable/sandy.jpg
  36. +13 −0 test/res/layout/main.xml
  37. +4 −0 test/res/values/strings.xml
  38. +5 −0 test/res/xml/cordova.xml
  39. +19 −0 test/res/xml/plugins.xml
  40. +63 −0 test/src/org/apache/cordova/test/ActivityPlugin.java
  41. +25 −0 test/src/org/apache/cordova/test/FixWebView.java
  42. +12 −0 test/src/org/apache/cordova/test/backbuttonmultipage.java
  43. +16 −0 test/src/org/apache/cordova/test/background.java
  44. +14 −0 test/src/org/apache/cordova/test/errorurl.java
  45. +13 −0 test/src/org/apache/cordova/test/htmlnotfound.java
  46. +12 −0 test/src/org/apache/cordova/test/iframe.java
  47. +12 −0 test/src/org/apache/cordova/test/jqmtabbackbutton.java
  48. +12 −0 test/src/org/apache/cordova/test/lifecycle.java
  49. +13 −0 test/src/org/apache/cordova/test/loading.java
  50. +62 −0 test/src/org/apache/cordova/test/menus.java
  51. +17 −0 test/src/org/apache/cordova/test/splashscreen.java
  52. +14 −0 test/src/org/apache/cordova/test/tests.java
  53. +16 −0 test/src/org/apache/cordova/test/timeout.java
  54. +54 −0 test/src/org/apache/cordova/test/userwebview.java
  55. +12 −0 test/src/org/apache/cordova/test/whitelist.java
  56. +12 −0 test/src/org/apache/cordova/test/xhr.java
View
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="gen"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+ <classpathentry kind="lib" path="libs/cordova-1.6.0rc1.jar"/>
+ <classpathentry kind="output" path="bin/classes"/>
+</classpath>
View
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>CordovaTest</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
View
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:windowSoftInputMode="adjustPan"
+ package="org.apache.cordova.test" android:versionName="1.1" android:versionCode="5">
+ <supports-screens
+ android:largeScreens="true"
+ android:normalScreens="true"
+ android:smallScreens="true"
+ android:xlargeScreens="true"
+ android:resizeable="true"
+ android:anyDensity="true"
+ />
+
+ <uses-permission android:name="android.permission.CAMERA" />
+ <uses-permission android:name="android.permission.VIBRATE" />
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+ <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.RECEIVE_SMS" />
+ <uses-permission android:name="android.permission.RECORD_AUDIO" />
+ <uses-permission android:name="android.permission.RECORD_VIDEO"/>
+ <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
+ <uses-permission android:name="android.permission.READ_CONTACTS" />
+ <uses-permission android:name="android.permission.WRITE_CONTACTS" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+ <uses-permission android:name="android.permission.GET_ACCOUNTS" />
+ <uses-permission android:name="android.permission.BROADCAST_STICKY" />
+
+ <uses-feature android:name="android.hardware.camera" />
+ <uses-feature android:name="android.hardware.camera.autofocus" />
+
+ <application android:icon="@drawable/icon" android:label="@string/app_name"
+ android:debuggable="true">
+ <activity android:name="tests" android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name="splashscreen" android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ </activity>
+ <activity android:name="timeout" android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ </activity>
+ <activity android:name="htmlnotfound" android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ </activity>
+ <activity android:name="errorurl" android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ </activity>
+ <activity android:name="userwebview" android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ </activity>
+ <activity android:name="menus" android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ </activity>
+ <activity android:name="loading" android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ </activity>
+ <activity android:name="lifecycle" android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ </activity>
+ <activity android:name="jqmtabbackbutton" android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ </activity>
+ <activity android:name="backbuttonmultipage" android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ </activity>
+ <activity android:name="whitelist" android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ </activity>
+ <activity android:name="background" android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ </activity>
+ <activity android:name="iframe" android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ </activity>
+ <activity android:name="xhr" android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ </activity>
+ </application>
+
+ <uses-sdk android:minSdkVersion="5" />
+</manifest>
@@ -0,0 +1,23 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Backbutton</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>
+
+<body onload="init();" id="stage" class="theme">
+ <h1>Cordova Android Tests</h1>
+ <div id="info">
+ <h4>Platform: <span id="platform"> &nbsp;</span>, Version: <span id="version">&nbsp;</span></h4>
+ <h4>UUID: <span id="uuid"> &nbsp;</span>, Name: <span id="name">&nbsp;</span></h4>
+ <h4>Width: <span id="width"> &nbsp;</span>, Height: <span id="height">&nbsp;</span>, Color Depth: <span id="colorDepth"></span></h4>
+ </div>
+ <div id="info">
+ <h4>Page 1</h4>
+ Go to next page.<br>
+ If returning from previous page, press "backbutton". You should exit this app.
+ </div>
+ <a href="sample2.html" class="btn large">Next page</a>
+</body>
+</html>
@@ -0,0 +1,23 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Backbutton</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>
+
+<body onload="init();" id="stage" class="theme">
+ <h1>Cordova Android Tests</h1>
+ <div id="info">
+ <h4>Platform: <span id="platform"> &nbsp;</span>, Version: <span id="version">&nbsp;</span></h4>
+ <h4>UUID: <span id="uuid"> &nbsp;</span>, Name: <span id="name">&nbsp;</span></h4>
+ <h4>Width: <span id="width"> &nbsp;</span>, Height: <span id="height">&nbsp;</span>, Color Depth: <span id="colorDepth"></span></h4>
+ </div>
+ <div id="info">
+ <h4>Page 2</h4>
+ Go to next page.<br>
+ If returning from previous page, press "backbutton". You should go to Page 1.
+ </div>
+ <a href="sample3.html" class="btn large">Next page</a>
+</body>
+</html>
@@ -0,0 +1,25 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Backbutton</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>
+
+<body onload="init();" id="stage" class="theme">
+ <h1>Cordova Android Tests</h1>
+ <div id="info">
+ <h4>Platform: <span id="platform"> &nbsp;</span>, Version: <span id="version">&nbsp;</span></h4>
+ <h4>UUID: <span id="uuid"> &nbsp;</span>, Name: <span id="name">&nbsp;</span></h4>
+ <h4>Width: <span id="width"> &nbsp;</span>, Height: <span id="height">&nbsp;</span>, Color Depth: <span id="colorDepth"></span></h4>
+ </div>
+ <div id="info">
+ <h4>Page 3</h4>
+ Press the 3 buttons below. You should stay on same page. (NOTE: IS THIS CORRECT? - DOESN'T SEEM TO WORK.)<br>
+ Press "backbutton". You should go to Page 2.
+ </div>
+ <a href="sample3.html#test1" class="btn large">page3#test1</a>
+ <a href="sample3.html#test2" class="btn large">page3#test2</a>
+ <a href="sample3.html#test3" class="btn large">page3#test3</a>
+</body>
+</html>
@@ -0,0 +1,99 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<head>
+<meta http-equiv="Content-type" content="text/html; charset=utf-8">
+<title>Background 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("platform").innerHTML = device.platform;
+ document.getElementById("version").innerHTML = device.version;
+ document.getElementById("uuid").innerHTML = device.uuid;
+ document.getElementById("name").innerHTML = device.name;
+ document.getElementById("width").innerHTML = screen.width;
+ document.getElementById("height").innerHTML = screen.height;
+ document.getElementById("colorDepth").innerHTML = screen.colorDepth;
+
+ document.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.backgroundstatus = status;
+ }
+
+ function clearStatus() {
+ console.log("clear()");
+ localStorage.backgroundstatus = "";
+ document.getElementById('status').innerHTML = "";
+ }
+
+</script>
+</head>
+<body onload="onLoad()" onunload="onUnLoaded()" id="stage" class="theme">
+ <h1>Events</h1>
+ <div id="info">
+ <h4>
+ Platform: <span id="platform"> &nbsp;</span>, Version: <span
+ id="version">&nbsp;</span>
+ </h4>
+ <h4>
+ UUID: <span id="uuid"> &nbsp;</span>, Name: <span id="name">&nbsp;</span>
+ </h4>
+ <h4>
+ Width: <span id="width"> &nbsp;</span>, Height: <span id="height">&nbsp;
+ </span>, Color Depth: <span id="colorDepth"></span>
+ </h4>
+ </div>
+ <div id="info">
+ <h4>Press "Home" button, then return to this app to see pause/resume.<br>
+ There shouldn't be any "Running" entries between pause and resume.</h4>
+ </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.backgroundstatus;
+ </script>
+</body>
+</html>
+
+
Oops, something went wrong.

0 comments on commit c18c0b4

Please sign in to comment.