CB-12465: Writing new JUnit Test Instrumentation to replace tests and retire 
problmatic tests

This closes #363


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/3bbc7fb3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/3bbc7fb3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/3bbc7fb3

Branch: refs/heads/master
Commit: 3bbc7fb3284687fa5f3572499d56d49eba78fd92
Parents: ac6ad2d
Author: Joe Bowser <[email protected]>
Authored: Tue Feb 14 16:45:57 2017 -0800
Committer: Joe Bowser <[email protected]>
Committed: Mon Feb 27 09:28:02 2017 -0800

----------------------------------------------------------------------
 bin/templates/project/build.gradle              |    2 +-
 test/.classpath                                 |    9 -
 test/.gitignore                                 |    9 +
 test/.project                                   |   33 -
 test/AndroidManifest.xml                        |   87 -
 test/README.md                                  |   61 -
 .../cordova/test/BackButtonMultiPageTest.java   |  194 --
 .../test/BaseCordovaIntegrationTest.java        |   52 -
 .../cordova/test/CordovaActivityTest.java       |   48 -
 .../apache/cordova/test/CordovaPluginTest.java  |   68 -
 .../cordova/test/CordovaResourceApiTest.java    |  280 ---
 .../org/apache/cordova/test/ErrorUrlTest.java   |   44 -
 .../apache/cordova/test/HtmlNotFoundTest.java   |   46 -
 .../src/org/apache/cordova/test/IFrameTest.java |  107 -
 .../apache/cordova/test/InflateLayoutTest.java  |   56 -
 .../cordova/test/IntentPreferenceTest.java      |   44 -
 .../test/MessageChannelMultiPageTest.java       |  110 -
 .../org/apache/cordova/test/util/Purity.java    |  171 --
 test/app/.gitignore                             |    1 +
 test/app/build.gradle                           |   35 +
 test/app/proguard-rules.pro                     |   17 +
 .../unittests/BackButtonMultipageTest.java      |  158 ++
 .../cordova/unittests/EmbeddedWebViewTest.java  |   53 +
 .../apache/cordova/unittests/ErrorUrlTest.java  |   68 +
 .../apache/cordova/unittests/IFrameTest.java    |  114 +
 .../unittests/MessageChannelMultipageTest.java  |  111 +
 .../cordova/unittests/StandardActivityTest.java |  100 +
 test/app/src/main/AndroidManifest.xml           |   40 +
 .../assets/www/backbuttonmultipage/index.html   |   40 +
 .../assets/www/backbuttonmultipage/sample2.html |   40 +
 .../assets/www/backbuttonmultipage/sample3.html |   42 +
 .../main/assets/www/backgroundcolor/index.html  |   39 +
 test/app/src/main/assets/www/cordova.js         | 2208 ++++++++++++++++++
 test/app/src/main/assets/www/cordova_plugins.js |   22 +
 .../src/main/assets/www/fullscreen/index.html   |   40 +
 .../src/main/assets/www/htmlnotfound/error.html |   38 +
 test/app/src/main/assets/www/iframe/index.html  |   49 +
 test/app/src/main/assets/www/iframe/index2.html |   40 +
 test/app/src/main/assets/www/index.html         |   56 +
 .../src/main/assets/www/lifecycle/index.html    |  112 +
 .../src/main/assets/www/lifecycle/index2.html   |  110 +
 test/app/src/main/assets/www/main.js            |   27 +
 test/app/src/main/assets/www/master.css         |  136 ++
 .../src/main/assets/www/whitelist/index.html    |   45 +
 .../src/main/assets/www/whitelist/index2.html   |   39 +
 .../unittests/EmbeddedWebViewActivity.java      |  110 +
 .../cordova/unittests/LifeCyclePlugin.java      |   49 +
 .../cordova/unittests/StandardActivity.java     |   42 +
 .../apache/cordova/unittests/TestActivity.java  |   67 +
 test/app/src/main/res/layout/activity_main.xml  |   16 +
 .../src/main/res/mipmap-hdpi/ic_launcher.png    |  Bin 0 -> 3418 bytes
 .../src/main/res/mipmap-mdpi/ic_launcher.png    |  Bin 0 -> 2206 bytes
 .../src/main/res/mipmap-xhdpi/ic_launcher.png   |  Bin 0 -> 4842 bytes
 .../src/main/res/mipmap-xxhdpi/ic_launcher.png  |  Bin 0 -> 7718 bytes
 .../src/main/res/mipmap-xxxhdpi/ic_launcher.png |  Bin 0 -> 10486 bytes
 test/app/src/main/res/values-w820dp/dimens.xml  |    6 +
 test/app/src/main/res/values/colors.xml         |    6 +
 test/app/src/main/res/values/dimens.xml         |    5 +
 test/app/src/main/res/values/strings.xml        |    3 +
 test/app/src/main/res/values/styles.xml         |   11 +
 test/app/src/main/res/xml/config.xml            |   44 +
 .../unittests/NativeToJsMessageQueueTest.java   |  126 +
 test/assets/www/backbuttonmultipage/index.html  |   40 -
 .../assets/www/backbuttonmultipage/sample2.html |   40 -
 .../assets/www/backbuttonmultipage/sample3.html |   42 -
 test/assets/www/background/index.html           |  103 -
 test/assets/www/background/index2.html          |  102 -
 test/assets/www/backgroundcolor/index.html      |   39 -
 test/assets/www/basicauth/index.html            |   40 -
 test/assets/www/cordova_plugins.js              |   22 -
 test/assets/www/fullscreen/index.html           |   40 -
 test/assets/www/htmlnotfound/error.html         |   38 -
 test/assets/www/iframe/index.html               |   49 -
 test/assets/www/iframe/index2.html              |   40 -
 test/assets/www/index.html                      |   63 -
 test/assets/www/jqmtabbackbutton/index.html     |   67 -
 test/assets/www/jqmtabbackbutton/tab1.html      |   47 -
 test/assets/www/jqmtabbackbutton/tab2.html      |   48 -
 test/assets/www/jqmtabbackbutton/tab3.html      |   48 -
 test/assets/www/lifecycle/index.html            |  112 -
 test/assets/www/lifecycle/index2.html           |  110 -
 test/assets/www/main.js                         |   27 -
 test/assets/www/master.css                      |  136 --
 test/assets/www/menus/index.html                |   45 -
 test/assets/www/userwebview/index.html          |   65 -
 test/assets/www/whitelist/index.html            |   45 -
 test/assets/www/whitelist/index2.html           |   39 -
 test/assets/www/xhr/index.html                  |   64 -
 test/build.gradle                               |   83 +-
 test/gradle.properties                          |   17 +
 test/gradle/wrapper/gradle-wrapper.properties   |    6 +
 test/gradlew                                    |  160 ++
 test/gradlew.bat                                |   90 +
 test/project.properties                         |   12 -
 test/res/drawable-hdpi/ic_launcher.png          |  Bin 6080 -> 0 bytes
 test/res/drawable-ldpi/ic_launcher.png          |  Bin 3096 -> 0 bytes
 test/res/drawable-mdpi/ic_launcher.png          |  Bin 4090 -> 0 bytes
 test/res/drawable/icon.png                      |  Bin 5800 -> 0 bytes
 test/res/layout/main.xml                        |   31 -
 test/res/values/strings.xml                     |   22 -
 test/res/xml/config.xml                         |   46 -
 test/settings.gradle                            |   21 +-
 .../org/apache/cordova/test/ActivityPlugin.java |   73 -
 .../cordova/test/BaseTestCordovaActivity.java   |   56 -
 .../test/CordovaWebViewTestActivity.java        |   74 -
 .../apache/cordova/test/LifeCyclePlugin.java    |   49 -
 .../apache/cordova/test/MainTestActivity.java   |   45 -
 test/src/org/apache/cordova/test/menus.java     |   81 -
 .../org/apache/cordova/test/userwebview.java    |   84 -
 109 files changed, 4556 insertions(+), 3591 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/bin/templates/project/build.gradle
----------------------------------------------------------------------
diff --git a/bin/templates/project/build.gradle 
b/bin/templates/project/build.gradle
index 5146c99..ef22971 100644
--- a/bin/templates/project/build.gradle
+++ b/bin/templates/project/build.gradle
@@ -30,7 +30,7 @@ buildscript {
     // 
http://tools.android.com/tech-docs/new-build-system/version-compatibility
     // and https://issues.apache.org/jira/browse/CB-8143
     dependencies {
-        classpath 'com.android.tools.build:gradle:2.2.1'
+        classpath 'com.android.tools.build:gradle:2.2.3'
     }
 }
 

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/.classpath
----------------------------------------------------------------------
diff --git a/test/.classpath b/test/.classpath
deleted file mode 100644
index 5176974..0000000
--- a/test/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry kind="con" 
path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
-       <classpathentry exported="true" kind="con" 
path="com.android.ide.eclipse.adt.LIBRARIES"/>
-       <classpathentry exported="true" kind="con" 
path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
-       <classpathentry kind="src" path="src"/>
-       <classpathentry kind="src" path="gen"/>
-       <classpathentry kind="output" path="bin/classes"/>
-</classpath>

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/.gitignore
----------------------------------------------------------------------
diff --git a/test/.gitignore b/test/.gitignore
new file mode 100644
index 0000000..39fb081
--- /dev/null
+++ b/test/.gitignore
@@ -0,0 +1,9 @@
+*.iml
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
+.externalNativeBuild

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/.project
----------------------------------------------------------------------
diff --git a/test/.project b/test/.project
deleted file mode 100644
index 7bacb6f..0000000
--- a/test/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>CordovaViewTestActivity</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>

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/AndroidManifest.xml
----------------------------------------------------------------------
diff --git a/test/AndroidManifest.xml b/test/AndroidManifest.xml
deleted file mode 100755
index 3507bed..0000000
--- a/test/AndroidManifest.xml
+++ /dev/null
@@ -1,87 +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.
--->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"; 
android:windowSoftInputMode="adjustPan"
-      package="org.apache.cordova.test" android:versionName="1.0" 
android:versionCode="1">
-    <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.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.READ_PHONE_STATE" />
-    <uses-permission android:name="android.permission.RECEIVE_SMS" />
-    <uses-permission android:name="android.permission.RECORD_AUDIO" />
-    <uses-permission android:name="android.permission.RECORD_VIDEO"/>
-    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
-    <uses-permission android:name="android.permission.READ_CONTACTS" />
-    <uses-permission android:name="android.permission.WRITE_CONTACTS" />   
-    <uses-permission android:name="android.permission.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-sdk android:minSdkVersion="16" android:targetSdkVersion="24"/>
-
-    <instrumentation
-        android:name="android.test.InstrumentationTestRunner"
-        android:targetPackage="org.apache.cordova.test" />
-
-    <application
-        android:icon="@drawable/icon"
-        android:label="@string/app_name" >
-        <uses-library android:name="android.test.runner" />
-        <activity
-            android:windowSoftInputMode="adjustPan"
-            android:label="@string/app_name" 
-            android:configChanges="orientation|keyboardHidden"
-            android:name="org.apache.cordova.test.CordovaWebViewTestActivity" >
-            <intent-filter >
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-        <activity
-            android:windowSoftInputMode="adjustPan"
-            android:label="@string/app_name" 
-            android:configChanges="orientation|keyboardHidden"
-            android:name="org.apache.cordova.test.MainTestActivity" >
-        </activity>
-        <activity
-            android:windowSoftInputMode="adjustPan"
-            android:label="@string/app_name" 
-            android:configChanges="orientation|keyboardHidden"
-            android:name="org.apache.cordova.test.menus" >
-        </activity>
-        <activity
-            android:windowSoftInputMode="adjustPan"
-            android:label="@string/app_name" 
-            android:configChanges="orientation|keyboardHidden"
-            android:name="org.apache.cordova.test.userwebview" >
-        </activity>
-    </application>
-</manifest> 

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/README.md
----------------------------------------------------------------------
diff --git a/test/README.md b/test/README.md
deleted file mode 100755
index 61957df..0000000
--- a/test/README.md
+++ /dev/null
@@ -1,61 +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.
-#
--->
-# Android Native Tests
-
-These tests are designed to verify Android native features and other Android 
specific features.
-
-## Initial Setup
-
-### Setting env vars
-
-Run:
-
-    ../bin/check_reqs
-
-Use the output to set your `ANDROID_HOME` and `JAVA_HOME` environment 
variables.
-
-### Adding `gradlew`
-
-Copy it from a freshly created project:
-
-    ../bin/create foo
-    (cd foo && cordova/build --gradle; cp -r gradlew gradle ..)
-    rm -r foo
-
-## Running
-
-To run manual tests:
-
-    ./gradlew installDebug
-
-To run unit tests:
-
-    ./gradlew connectedAndroidTest
-
-`BUILD SUCCESSFUL` means that the tests all passed :)
-
-## Android Studio
-
-1. Use "Import Project" and import the `test` directory.
-2. Right click on the `org.apache.cordova.test` package on the left-hand nav.
-3. Select `Create Run Configuration` -> `Tests in ...` (The one with the 
Android icon)
-4. Review options (mainly - target device)
-5. Click the bug icon in the top toolbar to run with debugger attached

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/androidTest/src/org/apache/cordova/test/BackButtonMultiPageTest.java
----------------------------------------------------------------------
diff --git 
a/test/androidTest/src/org/apache/cordova/test/BackButtonMultiPageTest.java 
b/test/androidTest/src/org/apache/cordova/test/BackButtonMultiPageTest.java
deleted file mode 100644
index 7dddec6..0000000
--- a/test/androidTest/src/org/apache/cordova/test/BackButtonMultiPageTest.java
+++ /dev/null
@@ -1,194 +0,0 @@
-package org.apache.cordova.test;
-/*
- *
- * 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.
- *
-*/
-
-
-import android.view.KeyEvent;
-import android.view.inputmethod.BaseInputConnection;
-
-public class BackButtonMultiPageTest extends BaseCordovaIntegrationTest {
-  private static final String START_URL = 
"file:///android_asset/www/backbuttonmultipage/index.html";
-
-  @Override
-  public void setUp() throws Exception {
-      super.setUp();
-      setUpWithStartUrl(START_URL);
-  }
-
-  public void testViaHref() throws Throwable {
-      assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run()
-          {
-              cordovaWebView.sendJavascript("window.location = 
'sample2.html';");
-          }
-      });
-      
assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", 
testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run()
-          {
-              cordovaWebView.sendJavascript("window.location = 
'sample3.html';");          }
-      });
-
-      
assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", 
testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run()
-          {
-              assertTrue(cordovaWebView.backHistory());
-          }
-      });
-      
assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", 
testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run()
-          {
-              assertTrue(cordovaWebView.backHistory());
-          }
-      });
-      assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run()
-          {
-              assertFalse(cordovaWebView.backHistory());
-          }
-      });
-  }
-  
-  public void testViaLoadUrl() throws Throwable {
-      assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run()
-          {
-              
cordovaWebView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample2.html");
-          }
-      });
-      
assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", 
testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run()
-          {
-              
cordovaWebView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample3.html");
-          }
-      });
-      
assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", 
testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run()
-          {
-              assertTrue(cordovaWebView.backHistory());
-          }
-      });
-      
assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", 
testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run()
-          {
-              assertTrue(cordovaWebView.backHistory());
-          }
-      });
-      assertEquals("file:///android_asset/www/backbuttonmultipage/index.html", 
testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run()
-          {
-              assertFalse(cordovaWebView.backHistory());
-          }
-      });
-  }
-
-  public void testViaBackButtonOnView() throws Throwable {
-      assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run() {
-              
cordovaWebView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample2.html");
-          }
-      });
-      
assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", 
testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run() {
-              
cordovaWebView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample3.html");
-          }
-      });
-      
assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", 
testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run()
-          {
-              String url = cordovaWebView.getUrl();
-              assertTrue(url.endsWith("sample3.html"));
-              BaseInputConnection viewConnection = new 
BaseInputConnection(cordovaWebView.getView(), true);
-              KeyEvent backDown = new KeyEvent(KeyEvent.ACTION_DOWN, 
KeyEvent.KEYCODE_BACK);
-              KeyEvent backUp = new KeyEvent(KeyEvent.ACTION_UP, 
KeyEvent.KEYCODE_BACK);
-              viewConnection.sendKeyEvent(backDown);
-              viewConnection.sendKeyEvent(backUp);
-          }
-      });
-      
assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", 
testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run()
-          {
-              String url = cordovaWebView.getUrl();
-              assertTrue(url.endsWith("sample2.html"));
-              BaseInputConnection viewConnection = new 
BaseInputConnection(cordovaWebView.getView(), true);
-              KeyEvent backDown = new KeyEvent(KeyEvent.ACTION_DOWN, 
KeyEvent.KEYCODE_BACK);
-              KeyEvent backUp = new KeyEvent(KeyEvent.ACTION_UP, 
KeyEvent.KEYCODE_BACK);
-              viewConnection.sendKeyEvent(backDown);
-              viewConnection.sendKeyEvent(backUp);
-          }
-      });
-      assertEquals("file:///android_asset/www/backbuttonmultipage/index.html", 
testActivity.onPageFinishedUrl.take());
-  }
-  
-  public void testViaBackButtonOnLayout() throws Throwable {
-      assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run() {
-              
cordovaWebView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample2.html");
-          }
-      });
-      
assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", 
testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run() {
-              
cordovaWebView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample3.html");
-          }
-      });
-      
assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", 
testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run() {
-              String url = cordovaWebView.getUrl();
-              assertTrue(url.endsWith("sample3.html"));
-              BaseInputConnection viewConnection = new 
BaseInputConnection(containerView, true);
-              KeyEvent backDown = new KeyEvent(KeyEvent.ACTION_DOWN, 
KeyEvent.KEYCODE_BACK);
-              KeyEvent backUp = new KeyEvent(KeyEvent.ACTION_UP, 
KeyEvent.KEYCODE_BACK);
-              viewConnection.sendKeyEvent(backDown);
-              viewConnection.sendKeyEvent(backUp);
-          }
-      });
-      
assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", 
testActivity.onPageFinishedUrl.take());
-      runTestOnUiThread(new Runnable() {
-          public void run() {
-              String url = cordovaWebView.getUrl();
-              assertTrue(url.endsWith("sample2.html"));
-              BaseInputConnection viewConnection = new 
BaseInputConnection(containerView, true);
-              KeyEvent backDown = new KeyEvent(KeyEvent.ACTION_DOWN, 
KeyEvent.KEYCODE_BACK);
-              KeyEvent backUp = new KeyEvent(KeyEvent.ACTION_UP, 
KeyEvent.KEYCODE_BACK);
-              viewConnection.sendKeyEvent(backDown);
-              viewConnection.sendKeyEvent(backUp);
-          }
-      });
-      assertEquals("file:///android_asset/www/backbuttonmultipage/index.html", 
testActivity.onPageFinishedUrl.take());
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/androidTest/src/org/apache/cordova/test/BaseCordovaIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/test/androidTest/src/org/apache/cordova/test/BaseCordovaIntegrationTest.java 
b/test/androidTest/src/org/apache/cordova/test/BaseCordovaIntegrationTest.java
deleted file mode 100644
index ecc40f6..0000000
--- 
a/test/androidTest/src/org/apache/cordova/test/BaseCordovaIntegrationTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.apache.cordova.test;
-/*
- *
- * 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.
- *
-*/
-
-
-import android.content.Intent;
-import android.test.ActivityInstrumentationTestCase2;
-import android.widget.FrameLayout;
-
-import org.apache.cordova.CordovaWebView;
-
-public class BaseCordovaIntegrationTest extends 
ActivityInstrumentationTestCase2<MainTestActivity> {
-    protected MainTestActivity testActivity;
-    protected FrameLayout containerView;
-    protected CordovaWebView cordovaWebView;
-
-
-    public BaseCordovaIntegrationTest() {
-    super(MainTestActivity.class);
-  }
-
-    protected void setUpWithStartUrl(String url, String... prefsAndValues) {
-        Intent intent = new Intent(getInstrumentation().getContext(), 
MainTestActivity.class);
-        intent.putExtra("testStartUrl", url);
-        for (int i = 0; i < prefsAndValues.length; i += 2) {
-            intent.putExtra(prefsAndValues[i], prefsAndValues[i + 1]);
-        }
-        setActivityIntent(intent);
-        testActivity = getActivity();
-        containerView = (FrameLayout) 
testActivity.findViewById(android.R.id.content);
-        cordovaWebView = testActivity.getCordovaWebView();
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/androidTest/src/org/apache/cordova/test/CordovaActivityTest.java
----------------------------------------------------------------------
diff --git 
a/test/androidTest/src/org/apache/cordova/test/CordovaActivityTest.java 
b/test/androidTest/src/org/apache/cordova/test/CordovaActivityTest.java
deleted file mode 100644
index 1533e79..0000000
--- a/test/androidTest/src/org/apache/cordova/test/CordovaActivityTest.java
+++ /dev/null
@@ -1,48 +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.view.View;
-import android.view.ViewGroup;
-import android.widget.LinearLayout;
-
-import org.apache.cordova.CordovaWebViewEngine;
-import org.apache.cordova.engine.SystemWebView;
-
-public class CordovaActivityTest extends BaseCordovaIntegrationTest {
-    private ViewGroup innerContainer;
-    private View testView;
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        setUpWithStartUrl(null);
-        testView = (ViewGroup)containerView.getChildAt(0);
-    }
-
-    public void testBasicLoad() throws Exception {
-        assertTrue(testView instanceof SystemWebView);
-        
assertTrue(((CordovaWebViewEngine.EngineView)testView).getCordovaWebView() != 
null);
-        String onPageFinishedUrl = testActivity.onPageFinishedUrl.take();
-        assertEquals(MainTestActivity.START_URL, onPageFinishedUrl);
-    }
-    protected void createViews() {
-        assertTrue(testView instanceof SystemWebView);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/androidTest/src/org/apache/cordova/test/CordovaPluginTest.java
----------------------------------------------------------------------
diff --git 
a/test/androidTest/src/org/apache/cordova/test/CordovaPluginTest.java 
b/test/androidTest/src/org/apache/cordova/test/CordovaPluginTest.java
deleted file mode 100644
index a7c9504..0000000
--- a/test/androidTest/src/org/apache/cordova/test/CordovaPluginTest.java
+++ /dev/null
@@ -1,68 +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.app.Activity;
-import android.test.ActivityInstrumentationTestCase2;
-
-import org.apache.cordova.CordovaWebView;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-
-public class CordovaPluginTest extends BaseCordovaIntegrationTest {
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        setUpWithStartUrl(null);
-    }
-
-    private void invokeBlockingCallToLifeCycleEvent(final String 
lifeCycleEventName) {
-        testActivity.runOnUiThread( new Runnable() {
-            public void run() {
-                try {
-                    Method method = 
getInstrumentation().getClass().getMethod(lifeCycleEventName, Activity.class);
-                    method.invoke(getInstrumentation(), testActivity);
-                } catch (Exception e) {
-                    fail("An Exception occurred in 
invokeBlockingCallToLifeCycleEvent while invoking " + lifeCycleEventName);
-                }
-            }
-        });
-        getInstrumentation().waitForIdleSync();
-    }
-
-    public void testPluginLifeCycle() throws IOException {
-        //TODO: add coverage for both cases where handleOnStart is called in 
CordovaActivity (onStart and init)
-        //currently only one of the cases is covered
-        //TODO: add coverage for both cases where onStart is called in 
CordovaWebViewImpl (handleOnStart and init)
-        //currently only one of the cases is covered
-        LifeCyclePlugin testPlugin = 
(LifeCyclePlugin)cordovaWebView.getPluginManager().getPlugin("LifeCycle");
-        testPlugin.calls = "";
-        // testOnStart
-        invokeBlockingCallToLifeCycleEvent("callActivityOnStart");
-        invokeBlockingCallToLifeCycleEvent("callActivityOnResume");
-        invokeBlockingCallToLifeCycleEvent("callActivityOnPause");
-        invokeBlockingCallToLifeCycleEvent("callActivityOnStop");
-        assertEquals("start,resume,pause,stop,", testPlugin.calls);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/androidTest/src/org/apache/cordova/test/CordovaResourceApiTest.java
----------------------------------------------------------------------
diff --git 
a/test/androidTest/src/org/apache/cordova/test/CordovaResourceApiTest.java 
b/test/androidTest/src/org/apache/cordova/test/CordovaResourceApiTest.java
deleted file mode 100644
index 7295987..0000000
--- a/test/androidTest/src/org/apache/cordova/test/CordovaResourceApiTest.java
+++ /dev/null
@@ -1,280 +0,0 @@
-
-package org.apache.cordova.test;
-
-/*
- *
- * 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.
- *
- */
-
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.net.Uri;
-import android.os.Environment;
-import android.provider.MediaStore;
-
-import org.apache.cordova.CallbackContext;
-import org.apache.cordova.CordovaPlugin;
-import org.apache.cordova.CordovaResourceApi;
-import org.apache.cordova.CordovaResourceApi.OpenForReadResult;
-import org.apache.cordova.PluginEntry;
-import org.json.JSONArray;
-import org.json.JSONException;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.charset.StandardCharsets;
-import java.util.Scanner;
-
-public class CordovaResourceApiTest extends BaseCordovaIntegrationTest {
-    CordovaResourceApi resourceApi;
-    String execPayload;
-    Integer execStatus;
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        setUpWithStartUrl(null);
-        resourceApi = cordovaWebView.getResourceApi();
-        resourceApi.setThreadCheckingEnabled(false);
-        cordovaWebView.getPluginManager().addService(new 
PluginEntry("CordovaResourceApiTestPlugin1", new CordovaPlugin() {
-            @Override
-            public Uri remapUri(Uri uri) {
-                if (uri.getQuery() != null && 
uri.getQuery().contains("pluginRewrite")) {
-                    return cordovaWebView.getResourceApi().remapUri(
-                            Uri.parse("data:text/plain;charset=utf-8,pass"));
-                }
-                if (uri.getQuery() != null && 
uri.getQuery().contains("pluginUri")) {
-                    return toPluginUri(uri);
-                }
-                return null;
-            }
-            @Override
-            public OpenForReadResult handleOpenForRead(Uri uri) throws 
IOException {
-                Uri orig = fromPluginUri(uri);
-                ByteArrayInputStream retStream = new 
ByteArrayInputStream(orig.toString().getBytes(StandardCharsets.UTF_8));
-                return new OpenForReadResult(uri, retStream, "text/plain", 
retStream.available(), null);
-            }
-            @Override
-            public boolean execute(String action, JSONArray args, 
CallbackContext callbackContext) throws JSONException {
-                synchronized (CordovaResourceApiTest.this) {
-                    execPayload = args.getString(0);
-                    execStatus = args.getInt(1);
-                    CordovaResourceApiTest.this.notify();
-                }
-                return true;
-            }
-        }));
-    }
-
-    private Uri createTestImageContentUri() {
-        Bitmap imageBitmap = 
BitmapFactory.decodeResource(testActivity.getResources(), R.drawable.icon);
-        String stored = 
MediaStore.Images.Media.insertImage(testActivity.getContentResolver(),
-                imageBitmap, "app-icon", "desc");
-        return Uri.parse(stored);
-    }
-
-    private void performApiTest(Uri uri, String expectedMimeType, File 
expectedLocalFile,
-            boolean expectRead, boolean expectWrite) throws IOException {
-        uri = resourceApi.remapUri(uri);
-        assertEquals(expectedLocalFile, resourceApi.mapUriToFile(uri));
-        
-        try {
-            OpenForReadResult readResult = resourceApi.openForRead(uri);
-            String mimeType2 = resourceApi.getMimeType(uri);
-            assertEquals("openForRead mime-type", expectedMimeType, 
readResult.mimeType);
-            assertEquals("getMimeType mime-type", expectedMimeType, mimeType2);
-            readResult.inputStream.read();
-            if (!expectRead) {
-                fail("Expected getInputStream to throw.");
-            }
-        } catch (IOException e) {
-            if (expectRead) {
-                throw e;
-            }
-        }
-        try {
-            OutputStream outStream = resourceApi.openOutputStream(uri);
-            outStream.write(123);
-            if (!expectWrite) {
-                fail("Expected getOutputStream to throw.");
-            }
-            outStream.close();
-        } catch (IOException e) {
-            if (expectWrite) {
-                throw e;
-            }
-        }
-    }
-
-    public void testJavaApis() throws IOException {
-        // testValidContentUri
-        {
-            Uri contentUri = createTestImageContentUri();
-            File localFile = resourceApi.mapUriToFile(contentUri);
-            assertNotNull(localFile);
-            performApiTest(contentUri, "image/jpeg", localFile, true, true);
-        }
-        // testInvalidContentUri
-        {
-            Uri contentUri = 
Uri.parse("content://media/external/images/media/999999999");
-            performApiTest(contentUri, null, null, false, false);
-        }
-        // testValidAssetUri
-        {
-            Uri assetUri = 
Uri.parse("file:///android_asset/www/index.html?foo#bar"); // Also check for 
stripping off ? and # correctly.
-            performApiTest(assetUri, "text/html", null, true, false);
-        }
-        // testInvalidAssetUri
-        {
-            Uri assetUri = Uri.parse("file:///android_asset/www/missing.html");
-            performApiTest(assetUri, "text/html", null, false, false);
-        }
-        // testFileUriToExistingFile
-        {
-            File f = File.createTempFile("te s t", ".txt"); // Also check for 
dealing with spaces.
-            try {
-                Uri fileUri = Uri.parse(f.toURI().toString() + "?foo#bar"); // 
Also check for stripping off ? and # correctly.
-                performApiTest(fileUri, "text/plain", f, true, true);
-            } finally {
-                f.delete();
-            }
-        }
-        // testFileUriToMissingFile
-        {
-            File f = new File(Environment.getExternalStorageDirectory() + 
"/somefilethatdoesntexist");
-            Uri fileUri = Uri.parse(f.toURI().toString());
-            try {
-                performApiTest(fileUri, null, f, false, true);
-            } finally {
-                f.delete();
-            }
-        }
-        // testFileUriToMissingFileWithMissingParent
-        {
-            File f = new File(Environment.getExternalStorageDirectory() + 
"/somedirthatismissing" + System.currentTimeMillis() + 
"/somefilethatdoesntexist");
-            Uri fileUri = Uri.parse(f.toURI().toString());
-            performApiTest(fileUri, null, f, false, true);
-        }
-        // testUnrecognizedUri
-        {
-            Uri uri = Uri.parse("somescheme://foo");
-            performApiTest(uri, null, null, false, false);
-        }
-        // testRelativeUri
-        {
-            try {
-                resourceApi.openForRead(Uri.parse("/foo"));
-                fail("Should have thrown for relative URI 1.");
-            } catch (Throwable t) {
-            }
-            try {
-                resourceApi.openForRead(Uri.parse("//foo/bar"));
-                fail("Should have thrown for relative URI 2.");
-            } catch (Throwable t) {
-            }
-            try {
-                resourceApi.openForRead(Uri.parse("foo.png"));
-                fail("Should have thrown for relative URI 3.");
-            } catch (Throwable t) {
-            }
-        }
-        // testPluginOverride
-        {
-            Uri uri = 
Uri.parse("plugin-uri://foohost/android_asset/www/index.html?pluginRewrite=yes");
-            performApiTest(uri, "text/plain", null, true, false);
-        }
-        // testMainThreadUsage
-        {
-            Uri assetUri = Uri.parse("file:///android_asset/www/index.html");
-            resourceApi.setThreadCheckingEnabled(true);
-            try {
-                resourceApi.openForRead(assetUri);
-                fail("Should have thrown for main thread check.");
-            } catch (Throwable t) {
-            }
-        }
-        // testDataUriPlain
-        {
-            Uri uri = Uri.parse("data:text/plain;charset=utf-8,pa%20ss");
-            OpenForReadResult readResult = resourceApi.openForRead(uri);
-            assertEquals("text/plain", readResult.mimeType);
-            String data = new Scanner(readResult.inputStream, 
"UTF-8").useDelimiter("\\A").next();
-            assertEquals("pa ss", data);
-        }
-        // testDataUriBase64
-        {
-            Uri uri = Uri.parse("data:text/js;charset=utf-8;base64,cGFzcw==");
-            OpenForReadResult readResult = resourceApi.openForRead(uri);
-            assertEquals("text/js", readResult.mimeType);
-            String data = new Scanner(readResult.inputStream, 
"UTF-8").useDelimiter("\\A").next();
-            assertEquals("pass", data);
-        }
-        // testPluginUris
-        {
-            String origUri = "http://orig/foo?pluginUri";;
-            Uri uri = resourceApi.remapUri(Uri.parse(origUri));
-            OpenForReadResult readResult = resourceApi.openForRead(uri);
-            assertEquals("openForRead mime-type", "text/plain", 
readResult.mimeType);
-            String data = new Scanner(readResult.inputStream, 
"UTF-8").useDelimiter("\\A").next();
-            assertEquals(origUri, data);
-            assertEquals(origUri.length(), readResult.length);
-        }
-    }
-    
-    public void testWebViewRequestIntercept() throws Throwable
-    {
-        testActivity.onPageFinishedUrl.take();
-        execPayload = null;
-        execStatus = null;
-        cordovaWebView.sendJavascript(
-                "var x = new XMLHttpRequest;\n" +
-                        "x.open('GET', 'file:///foo?pluginRewrite=1', 
false);\n" +
-                        "x.send();\n" +
-                        
"cordova.require('cordova/exec')(null,null,'CordovaResourceApiTestPlugin1', 
'foo', [x.responseText, x.status])");
-        try {
-            synchronized (this) {
-                this.wait(2000);
-            }
-        } catch (InterruptedException e) {
-        }
-        assertEquals("pass", execPayload);
-        assertEquals(execStatus.intValue(), 200);
-    }
-    
-    public void testWebViewWhiteListRejection() throws Throwable
-    {
-        testActivity.onPageFinishedUrl.take();
-        execPayload = null;
-        execStatus = null;
-        cordovaWebView.sendJavascript(
-            "var x = new XMLHttpRequest;\n" +
-            "x.open('GET', 'http://foo/bar', false);\n" + 
-            "x.send();\n" + 
-            
"cordova.require('cordova/exec')(null,null,'CordovaResourceApiTestPlugin1', 
'foo', [x.responseText, x.status])");
-        try {
-            synchronized (this) {
-                this.wait(2000);
-            }
-        } catch (InterruptedException e) {
-        }
-        assertEquals("", execPayload);
-        assertEquals(execStatus.intValue(), 404);
-    }    
-}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/androidTest/src/org/apache/cordova/test/ErrorUrlTest.java
----------------------------------------------------------------------
diff --git a/test/androidTest/src/org/apache/cordova/test/ErrorUrlTest.java 
b/test/androidTest/src/org/apache/cordova/test/ErrorUrlTest.java
deleted file mode 100644
index d880f63..0000000
--- a/test/androidTest/src/org/apache/cordova/test/ErrorUrlTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.apache.cordova.test;
-/*
- *
- * 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.
- *
-*/
-
-
-public class ErrorUrlTest extends BaseCordovaIntegrationTest {
-    private static final String START_URL = 
"file:///android_asset/www/htmlnotfound/index.html";
-    private static final String ERROR_URL = 
"file:///android_asset/www/htmlnotfound/error.html";
-    private static final String INVALID_URL = 
"file:///android_asset/www/invalid.html";
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        // INVALID_URL tests that errorUrl and url are *not* settable via the 
intent.
-        setUpWithStartUrl(START_URL, "testErrorUrl", ERROR_URL, "errorurl", 
INVALID_URL, "url", INVALID_URL);
-    }
-
-    public void testUrl() throws Throwable {
-        assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
-        assertEquals(ERROR_URL, testActivity.onPageFinishedUrl.take());
-        runTestOnUiThread(new Runnable() {
-            public void run() {
-                assertEquals(ERROR_URL, 
testActivity.getCordovaWebView().getUrl());
-            }
-        });
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/androidTest/src/org/apache/cordova/test/HtmlNotFoundTest.java
----------------------------------------------------------------------
diff --git a/test/androidTest/src/org/apache/cordova/test/HtmlNotFoundTest.java 
b/test/androidTest/src/org/apache/cordova/test/HtmlNotFoundTest.java
deleted file mode 100644
index 3f92919..0000000
--- a/test/androidTest/src/org/apache/cordova/test/HtmlNotFoundTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.apache.cordova.test;
-/*
- *
- * 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.
- *
-*/
-
-
-public class HtmlNotFoundTest extends BaseCordovaIntegrationTest {
-  private static final String START_URL = 
"file:///android_asset/www/htmlnotfound/index.html";
-
-  protected void setUp() throws Exception {
-    super.setUp();
-    setUpWithStartUrl(START_URL);
-  }
-  public void testUrl() throws Throwable
-  {
-      runTestOnUiThread(new Runnable() {
-          public void run() {
-              
assertTrue(START_URL.equals(testActivity.getCordovaWebView().getUrl()));
-          }
-      });
-
-      //loading a not-found file causes an application error and displayError 
is called
-      //the test activity overrides displayError to add message to 
onPageFinishedUrl
-      String message = testActivity.onPageFinishedUrl.take();
-      assertTrue(message.contains(START_URL));
-      assertTrue(message.contains("ERR_FILE_NOT_FOUND"));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/androidTest/src/org/apache/cordova/test/IFrameTest.java
----------------------------------------------------------------------
diff --git a/test/androidTest/src/org/apache/cordova/test/IFrameTest.java 
b/test/androidTest/src/org/apache/cordova/test/IFrameTest.java
deleted file mode 100644
index 48dae38..0000000
--- a/test/androidTest/src/org/apache/cordova/test/IFrameTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.apache.cordova.test;
-/*
- *
- * 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.
- *
-*/
-
-
-import android.test.TouchUtils;
-
-import org.apache.cordova.test.util.Purity;
-
-public class IFrameTest extends BaseCordovaIntegrationTest {
-    private static final String START_URL = 
"file:///android_asset/www/iframe/index.html";
-
-    private TouchUtils touch;
-    private Purity touchTool;
-    
-    protected void setUp() throws Exception {
-      super.setUp();
-      setUpWithStartUrl(START_URL);
-      touch = new TouchUtils();
-      touchTool = new Purity(testActivity, getInstrumentation());
-    }
-  
-  
-    public void testIframeDest() throws Throwable {
-        assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
-        runTestOnUiThread(new Runnable() {
-            public void run()
-            {
-                
cordovaWebView.sendJavascript("loadUrl('http://maps.google.com/maps?output=embed');");
-            }
-        });
-        sleep(3000);
-        runTestOnUiThread(new Runnable() {
-            public void run()
-            {
-                cordovaWebView.sendJavascript("loadUrl('index2.html')");
-            }
-        });
-        sleep(1000);
-        runTestOnUiThread(new Runnable() {
-            public void run()
-            {
-                String url = cordovaWebView.getUrl();
-                assertTrue(url.endsWith("index.html"));
-            }
-        });
-    }
-    
-    public void testIframeHistory() throws Throwable
-    {
-        runTestOnUiThread(new Runnable() {
-            public void run()
-            {
-                
cordovaWebView.sendJavascript("loadUrl('http://maps.google.com/maps?output=embed');");
-            }
-        });
-        sleep(3000);
-        runTestOnUiThread(new Runnable() {
-            public void run()
-            {
-                cordovaWebView.sendJavascript("loadUrl('index2.html')");
-            }
-        });
-        sleep(1000);
-        runTestOnUiThread(new Runnable() {
-            public void run()
-            {
-                String url = cordovaWebView.getUrl();
-                cordovaWebView.backHistory();
-            }
-        });
-        sleep(1000);
-        runTestOnUiThread(new Runnable() {
-            public void run()
-            {
-                String url = cordovaWebView.getUrl();
-                assertTrue(url.endsWith("index.html"));
-            }
-        });
-    }
-    
-    private void sleep(int timeout) {
-        try {
-          Thread.sleep(timeout);
-        } catch (InterruptedException e) {
-          fail("Unexpected Timeout");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/androidTest/src/org/apache/cordova/test/InflateLayoutTest.java
----------------------------------------------------------------------
diff --git 
a/test/androidTest/src/org/apache/cordova/test/InflateLayoutTest.java 
b/test/androidTest/src/org/apache/cordova/test/InflateLayoutTest.java
deleted file mode 100644
index 6fbc50f..0000000
--- a/test/androidTest/src/org/apache/cordova/test/InflateLayoutTest.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.test.ActivityInstrumentationTestCase2;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.FrameLayout;
-import android.widget.LinearLayout;
-
-import org.apache.cordova.engine.SystemWebView;
-
-public class InflateLayoutTest extends 
ActivityInstrumentationTestCase2<CordovaWebViewTestActivity> {
-
-    private CordovaWebViewTestActivity testActivity;
-    private ViewGroup innerContainer;
-    private View testView;
-
-    @SuppressWarnings("deprecation")
-    public InflateLayoutTest()
-    {
-        super("org.apache.cordova.test",CordovaWebViewTestActivity.class);
-    }
-    
-    protected void setUp() throws Exception {
-        super.setUp();
-        testActivity = this.getActivity();
-        FrameLayout containerView = (FrameLayout) 
testActivity.findViewById(android.R.id.content);
-        innerContainer = (ViewGroup)containerView.getChildAt(0);
-        testView = innerContainer.getChildAt(0);
-    }
-
-    public void testBasicLoad() throws Exception {
-        assertTrue(testView instanceof SystemWebView);
-        assertTrue(innerContainer instanceof LinearLayout);
-        String onPageFinishedUrl = testActivity.onPageFinishedUrl.take();
-        assertEquals(CordovaWebViewTestActivity.START_URL, onPageFinishedUrl);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/androidTest/src/org/apache/cordova/test/IntentPreferenceTest.java
----------------------------------------------------------------------
diff --git 
a/test/androidTest/src/org/apache/cordova/test/IntentPreferenceTest.java 
b/test/androidTest/src/org/apache/cordova/test/IntentPreferenceTest.java
deleted file mode 100644
index 2d7b259..0000000
--- a/test/androidTest/src/org/apache/cordova/test/IntentPreferenceTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.apache.cordova.test;
-/*
- *
- * 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.
- *
-*/
-
-import android.graphics.Color;
-
-import org.apache.cordova.CordovaPreferences;
-
-public class IntentPreferenceTest extends BaseCordovaIntegrationTest {
-    private static final String GREEN = Integer.toHexString(Color.GREEN);
-    private static final String START_URL = 
"file:///android_asset/www/index.html";
-
-    CordovaPreferences prefs;
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        // INVALID_URL tests that errorUrl and url are *not* settable via the 
intent.
-        setUpWithStartUrl(START_URL, "backgroundcolor", GREEN);
-        prefs = cordovaWebView.getPreferences();
-    }
-
-    public void testUrl() throws Throwable {
-        assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
-        assertFalse(prefs.getInteger("backgroundcolor", Color.BLACK) == 
Color.GREEN);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/androidTest/src/org/apache/cordova/test/MessageChannelMultiPageTest.java
----------------------------------------------------------------------
diff --git 
a/test/androidTest/src/org/apache/cordova/test/MessageChannelMultiPageTest.java 
b/test/androidTest/src/org/apache/cordova/test/MessageChannelMultiPageTest.java
deleted file mode 100644
index 8521a09..0000000
--- 
a/test/androidTest/src/org/apache/cordova/test/MessageChannelMultiPageTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.apache.cordova.test;
-/*
- *
- * 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.
- *
-*/
-
-
-import android.view.KeyEvent;
-import android.view.inputmethod.BaseInputConnection;
-
-import org.apache.cordova.CallbackContext;
-import org.apache.cordova.CordovaWebViewImpl;
-import org.apache.cordova.PluginManager;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-public class MessageChannelMultiPageTest extends BaseCordovaIntegrationTest {
-    private static final String START_URL = 
"file:///android_asset/www/backbuttonmultipage/index.html";
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        setUpWithStartUrl(START_URL);
-    }
-
-    //test that after a page load the cached callback id and the live callback 
id match
-    //this is to prevent a regression
-    //the issue was that CordovaWebViewImpl's cached instance of CoreAndroid 
would become stale on page load
-    //this is because the cached instance was not being cleared when the 
pluginManager was reset on page load
-    //the plugin manager would get a new instance which would be updated with 
a new callback id
-    //the cached instance's message channel callback id would become stale
-    //effectively this caused message channel events to not be delivered
-    public void testThatCachedCallbackIdIsValid() throws Throwable {
-        Class cordovaWebViewImpl = CordovaWebViewImpl.class;
-        //send a test event - this initializes cordovaWebViewImpl.appPlugin 
(the cached instance of CoreAndroid)
-        Method method = 
cordovaWebViewImpl.getDeclaredMethod("sendJavascriptEvent", String.class);
-        method.setAccessible(true);
-        method.invoke(cordovaWebView, "testEvent");
-        sleep(1000);
-
-        //load a page - this resets the plugin manager and nulls 
cordovaWebViewImpl.appPlugin
-        //(previously this resets plugin manager but did not null 
cordovaWebViewImpl.appPlugin, leading to the issue)
-        runTestOnUiThread(new Runnable() {
-            public void run() {
-                cordovaWebView.loadUrl(START_URL);
-            }
-        });
-        assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
-
-        //send a test event - this initializes cordovaWebViewImpl.appPlugin 
(the cached instance of CoreAndroid)
-        method.invoke(cordovaWebView, "testEvent");
-        sleep(1000);
-
-        //get reference to package protected class CoreAndroid
-        Class coreAndroid = Class.forName("org.apache.cordova.CoreAndroid");
-
-        //get cached CoreAndroid
-        Field appPluginField = 
cordovaWebViewImpl.getDeclaredField("appPlugin");
-        appPluginField.setAccessible(true);
-        Object cachedAppPlugin = appPluginField.get(cordovaWebView);
-        //get cached CallbackContext
-        Field messageChannelField = 
coreAndroid.getDeclaredField("messageChannel");
-        messageChannelField.setAccessible(true);
-        CallbackContext cachedCallbackContext = (CallbackContext) 
messageChannelField.get(cachedAppPlugin);
-
-        //get live CoreAndroid
-        PluginManager pluginManager = 
MessageChannelMultiPageTest.this.cordovaWebView.getPluginManager();
-        Field coreAndroidPluginNameField = coreAndroid.getField("PLUGIN_NAME");
-        String coreAndroidPluginName = (String) 
coreAndroidPluginNameField.get(null);
-        Object liveAppPlugin = pluginManager.getPlugin(coreAndroidPluginName);
-        //get live CallbackContext
-        CallbackContext liveCallbackContext = (CallbackContext) 
messageChannelField.get(liveAppPlugin);
-
-        //get callback id from live callbackcontext
-        String liveCallbackId = (liveCallbackContext != null) ? 
liveCallbackContext.getCallbackId() : null;
-        //get callback id from cached callbackcontext
-        String cachedCallbackId = (cachedCallbackContext != null) ? 
cachedCallbackContext.getCallbackId() : null;
-
-        //verify that the live message channel has been initialized
-        assertNotNull(liveCallbackId);
-        //verify that the cached message channel and the live message channel 
have the same id
-        assertEquals(liveCallbackId, cachedCallbackId);
-    }
-
-    private void sleep(int timeout) {
-        try {
-            Thread.sleep(timeout);
-        } catch (InterruptedException e) {
-            fail("Unexpected Timeout");
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/androidTest/src/org/apache/cordova/test/util/Purity.java
----------------------------------------------------------------------
diff --git a/test/androidTest/src/org/apache/cordova/test/util/Purity.java 
b/test/androidTest/src/org/apache/cordova/test/util/Purity.java
deleted file mode 100644
index 7171338..0000000
--- a/test/androidTest/src/org/apache/cordova/test/util/Purity.java
+++ /dev/null
@@ -1,171 +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.
-*/
-
-/*
- * Purity is a small set of Android utility methods that allows us to simulate 
touch events on 
- * Android applications.  This is important for simulating some of the most 
annoying tests.
- */
-
-package org.apache.cordova.test.util;
-
-import android.app.Instrumentation;
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Picture;
-import android.os.SystemClock;
-import android.util.DisplayMetrics;
-import android.view.MotionEvent;
-import android.webkit.WebView;
-
-
-public class Purity {
-
-    Instrumentation inst;
-    int width, height;
-    float density;
-    Bitmap state;
-    boolean fingerDown = false;
-   
-    public Purity(Context ctx, Instrumentation i)
-    {
-        inst = i;
-        DisplayMetrics display = ctx.getResources().getDisplayMetrics();
-        density = display.density;
-        width = display.widthPixels;
-        height = display.heightPixels;
-        
-    }
-    
-    /*
-     * WebKit doesn't give you real pixels anymore, this is done for subpixel 
fonts to appear on
-     * iOS and Android.  However, Android automation requires real pixels
-     */
-    private int getRealCoord(int coord)
-    {
-        return (int) (coord * density);
-    }
-
-    public int getViewportWidth()
-    {
-        return (int) (width/density);
-    }
-    
-    public int getViewportHeight()
-    {
-        return (int) (height/density);
-    }
-    
-    public void touch(int x, int y)
-    {
-        int realX = getRealCoord(x);
-        int realY = getRealCoord(y);
-        long downTime = SystemClock.uptimeMillis();
-        // event time MUST be retrieved only by this way!
-        long eventTime = SystemClock.uptimeMillis();
-        if(!fingerDown)
-        {
-            MotionEvent downEvent = MotionEvent.obtain(downTime, eventTime, 
MotionEvent.ACTION_DOWN, realX, realY, 0);
-            inst.sendPointerSync(downEvent);
-        }
-        MotionEvent upEvent = MotionEvent.obtain(downTime, eventTime, 
MotionEvent.ACTION_UP, realX, realY, 0);
-        inst.sendPointerSync(upEvent);
-    }
-    
-    public void touchStart(int x, int y)
-    {
-        int realX = getRealCoord(x);
-        int realY = getRealCoord(y);
-        long downTime = SystemClock.uptimeMillis();
-        // event time MUST be retrieved only by this way!
-        long eventTime = SystemClock.uptimeMillis();
-        MotionEvent event = MotionEvent.obtain(downTime, eventTime, 
MotionEvent.ACTION_DOWN, realX, realY, 0);
-        inst.sendPointerSync(event);
-        fingerDown = true;
-    }
-    
-    //Move from the touch start
-    public void touchMove(int x, int y)
-    {
-        if(!fingerDown)
-            touchStart(x,y);
-        else
-        {
-            int realX = getRealCoord(x);
-            int realY = getRealCoord(y);
-            long downTime = SystemClock.uptimeMillis();
-            // event time MUST be retrieved only by this way!
-            long eventTime = SystemClock.uptimeMillis();
-            MotionEvent event = MotionEvent.obtain(downTime, eventTime, 
MotionEvent.ACTION_MOVE, realX, realY, 0);
-            inst.sendPointerSync(event);
-        }
-    }
-    
-    public void touchEnd(int x, int y)
-    {
-        if(!fingerDown)
-        {
-            touch(x, y);
-        }
-        else
-        {
-            int realX = getRealCoord(x);
-            int realY = getRealCoord(y);
-            long downTime = SystemClock.uptimeMillis();
-            // event time MUST be retrieved only by this way!
-            long eventTime = SystemClock.uptimeMillis();
-            MotionEvent event = MotionEvent.obtain(downTime, eventTime, 
MotionEvent.ACTION_DOWN, realX, realY, 0);
-            inst.sendPointerSync(event);
-            fingerDown = false;
-        }
-    }
-    
-    public void setBitmap(WebView view)
-    {
-        Picture p = view.capturePicture();
-        state = Bitmap.createBitmap(p.getWidth(), p.getHeight(), 
Bitmap.Config.ARGB_8888);
-    }
-    
-    public boolean checkRenderView(WebView view)
-    {
-        if(state == null)
-        {
-            setBitmap(view);
-            return false;
-        }
-        else
-        {
-            Picture p = view.capturePicture();
-            Bitmap newState = Bitmap.createBitmap(p.getWidth(), p.getHeight(), 
Bitmap.Config.ARGB_8888);
-            boolean result = newState.equals(state);
-            newState.recycle();
-            return result;
-        }
-    }
-    
-    public void clearBitmap()
-    {
-        if(state != null)
-            state.recycle();
-    }
-    
-    protected void finalize()
-    {
-            clearBitmap();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/app/.gitignore
----------------------------------------------------------------------
diff --git a/test/app/.gitignore b/test/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/test/app/.gitignore
@@ -0,0 +1 @@
+/build

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/app/build.gradle
----------------------------------------------------------------------
diff --git a/test/app/build.gradle b/test/app/build.gradle
new file mode 100644
index 0000000..5939414
--- /dev/null
+++ b/test/app/build.gradle
@@ -0,0 +1,35 @@
+apply plugin: 'com.android.application'
+
+android {
+    compileSdkVersion 25
+    buildToolsVersion "25.0.2"
+    defaultConfig {
+        applicationId "org.apache.cordova.unittests"
+        minSdkVersion 16
+        targetSdkVersion 25
+        versionCode 1
+        versionName "1.0"
+        testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
+        }
+    }
+}
+
+dependencies {
+    compile fileTree(dir: 'libs', include: ['*.jar'])
+    debugCompile project(path: ":CordovaLib", configuration: "debug")
+    releaseCompile project(path: ":CordovaLib", configuration: "release")
+    
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+        exclude group: 'com.android.support', module: 'support-annotations'
+    })
+    androidTestCompile 
('com.android.support.test.espresso:espresso-web:2.2.2', {
+        exclude group: 'com.android.support', module: 'support-annotations'
+    })
+    compile 'com.android.support:appcompat-v7:25.1.1'
+    testCompile 'junit:junit:4.12'
+    testCompile 'org.json:json:20140107'
+}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/app/proguard-rules.pro
----------------------------------------------------------------------
diff --git a/test/app/proguard-rules.pro b/test/app/proguard-rules.pro
new file mode 100644
index 0000000..73631af
--- /dev/null
+++ b/test/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Users/jbowser/Library/Android/sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/app/src/androidTest/java/org/apache/cordova/unittests/BackButtonMultipageTest.java
----------------------------------------------------------------------
diff --git 
a/test/app/src/androidTest/java/org/apache/cordova/unittests/BackButtonMultipageTest.java
 
b/test/app/src/androidTest/java/org/apache/cordova/unittests/BackButtonMultipageTest.java
new file mode 100644
index 0000000..c50c221
--- /dev/null
+++ 
b/test/app/src/androidTest/java/org/apache/cordova/unittests/BackButtonMultipageTest.java
@@ -0,0 +1,158 @@
+/*
+       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.unittests;
+
+import android.content.Intent;
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.apache.cordova.CordovaWebView;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static android.support.test.espresso.Espresso.onView;
+import static android.support.test.espresso.action.ViewActions.pressBack;
+import static android.support.test.espresso.matcher.ViewMatchers.withId;
+import static android.support.test.espresso.web.sugar.Web.onWebView;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+
+
+import static org.apache.cordova.unittests.R.id.cordovaWebView;
+
+
+@RunWith(AndroidJUnit4.class)
+public class BackButtonMultipageTest {
+
+    private static final String START_URL = 
"file:///android_asset/www/backbuttonmultipage/index.html";
+    //I have no idea why we picked 100, but we did.
+    private static final int WEBVIEW_ID = 100;
+    private TestActivity mActivity;
+
+    // Don't launch the activity, we're going to send it intents
+    @Rule
+    public ActivityTestRule mActivityRule = new ActivityTestRule<>(
+            TestActivity.class, true, false);
+
+    @Before
+    public void launchApplicationWithIntent() {
+        Intent intent = new Intent();
+        intent.putExtra("startUrl", START_URL);
+        mActivity = (TestActivity) mActivityRule.launchActivity(intent);
+    }
+
+    @Test
+    public void testViaHref() throws Throwable {
+        final CordovaWebView webInterface = mActivity.getWebInterface();
+        assertEquals(START_URL, mActivity.onPageFinishedUrl.take());
+
+        mActivityRule.runOnUiThread(new Runnable() {
+            public void run() {
+                webInterface.sendJavascript("window.location = 
'sample2.html';");
+            }
+        });
+        
assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", 
mActivity.onPageFinishedUrl.take());
+        mActivityRule.runOnUiThread(new Runnable() {
+            public void run() {
+                webInterface.sendJavascript("window.location = 
'sample3.html';");
+            }
+        });
+        
assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", 
mActivity.onPageFinishedUrl.take());
+        mActivityRule.runOnUiThread(new Runnable() {
+            public void run() {
+                assertTrue(webInterface.backHistory());
+            }
+        });
+        
assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", 
mActivity.onPageFinishedUrl.take());
+        mActivityRule.runOnUiThread(new Runnable() {
+            public void run() {
+                assertTrue(webInterface.backHistory());
+            }
+        });
+        assertEquals(START_URL, mActivity.onPageFinishedUrl.take());
+        mActivityRule.runOnUiThread(new Runnable() {
+            public void run() {
+                assertFalse(webInterface.backHistory());
+            }
+        });
+    }
+
+    @Test
+    public void testViaLoadUrl() throws Throwable {
+        final CordovaWebView webInterface = mActivity.getWebInterface();
+        assertEquals(START_URL, mActivity.onPageFinishedUrl.take());
+
+        mActivityRule.runOnUiThread(new Runnable() {
+            public void run() {
+                
webInterface.loadUrl("file:///android_asset/www/backbuttonmultipage/sample2.html");
+            }
+        });
+        
assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", 
mActivity.onPageFinishedUrl.take());
+        mActivityRule.runOnUiThread(new Runnable() {
+            public void run() {
+                
webInterface.loadUrl("file:///android_asset/www/backbuttonmultipage/sample3.html");
+            }
+        });
+        
assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", 
mActivity.onPageFinishedUrl.take());
+        mActivityRule.runOnUiThread(new Runnable() {
+            public void run() {
+                assertTrue(webInterface.backHistory());
+            }
+        });
+        
assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", 
mActivity.onPageFinishedUrl.take());
+        mActivityRule.runOnUiThread(new Runnable() {
+            public void run() {
+                assertTrue(webInterface.backHistory());
+            }
+        });
+        assertEquals(START_URL, mActivity.onPageFinishedUrl.take());
+        mActivityRule.runOnUiThread(new Runnable() {
+            public void run() {
+                assertFalse(webInterface.backHistory());
+            }
+        });
+    }
+
+    @Test
+    public void testViaBackButtonOnView() throws Throwable {
+        final CordovaWebView webInterface = mActivity.getWebInterface();
+        assertEquals(START_URL, mActivity.onPageFinishedUrl.take());
+
+        mActivityRule.runOnUiThread(new Runnable() {
+            public void run() {
+                
webInterface.loadUrl("file:///android_asset/www/backbuttonmultipage/sample2.html");
+            }
+        });
+        
assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", 
mActivity.onPageFinishedUrl.take());
+        mActivityRule.runOnUiThread(new Runnable() {
+            public void run() {
+                
webInterface.loadUrl("file:///android_asset/www/backbuttonmultipage/sample3.html");
+            }
+        });
+        
assertEquals("file:///android_asset/www/backbuttonmultipage/sample3.html", 
mActivity.onPageFinishedUrl.take());
+        onView(withId(WEBVIEW_ID)).perform(pressBack());
+        
assertEquals("file:///android_asset/www/backbuttonmultipage/sample2.html", 
mActivity.onPageFinishedUrl.take());
+        onView(withId(WEBVIEW_ID)).perform(pressBack());
+        assertEquals(START_URL, mActivity.onPageFinishedUrl.take());
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/app/src/androidTest/java/org/apache/cordova/unittests/EmbeddedWebViewTest.java
----------------------------------------------------------------------
diff --git 
a/test/app/src/androidTest/java/org/apache/cordova/unittests/EmbeddedWebViewTest.java
 
b/test/app/src/androidTest/java/org/apache/cordova/unittests/EmbeddedWebViewTest.java
new file mode 100644
index 0000000..0793377
--- /dev/null
+++ 
b/test/app/src/androidTest/java/org/apache/cordova/unittests/EmbeddedWebViewTest.java
@@ -0,0 +1,53 @@
+/*
+       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.unittests;
+
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.Assert.assertNotNull;
+
+/*
+ * This test is to cover the use case of Cordova Android used as a component 
in a larger Android
+ * application.  This test is strictly used to cover this use case.  In this 
example, the WebView
+ * should load, not be null, and the Plugin Manager should also be initialized.
+ *
+
+ */
+
+
+@RunWith(AndroidJUnit4.class)
+public class EmbeddedWebViewTest {
+
+    @Rule
+    public ActivityTestRule mActivityRule = new ActivityTestRule<>(
+            EmbeddedWebViewActivity.class);
+
+    @Test
+    public void checkWebViewTest() {
+        EmbeddedWebViewActivity activity = (EmbeddedWebViewActivity) 
mActivityRule.getActivity();
+        assertNotNull(activity.webInterface);
+        assertNotNull(activity.webInterface.getPluginManager());
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3bbc7fb3/test/app/src/androidTest/java/org/apache/cordova/unittests/ErrorUrlTest.java
----------------------------------------------------------------------
diff --git 
a/test/app/src/androidTest/java/org/apache/cordova/unittests/ErrorUrlTest.java 
b/test/app/src/androidTest/java/org/apache/cordova/unittests/ErrorUrlTest.java
new file mode 100644
index 0000000..7300d7c
--- /dev/null
+++ 
b/test/app/src/androidTest/java/org/apache/cordova/unittests/ErrorUrlTest.java
@@ -0,0 +1,68 @@
+/*
+       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.unittests;
+
+import android.content.Intent;
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.apache.cordova.CordovaWebView;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static junit.framework.Assert.assertEquals;
+
+@RunWith(AndroidJUnit4.class)
+public class ErrorUrlTest {
+    private static final String START_URL = 
"file:///android_asset/www/htmlnotfound/index.html";
+    private static final String ERROR_URL = 
"file:///android_asset/www/htmlnotfound/error.html";
+    private static final String INVALID_URL = 
"file:///android_asset/www/invalid.html";
+
+    //I have no idea why we picked 100, but we did.
+    private static final int WEBVIEW_ID = 100;
+    private TestActivity mActivity;
+
+    @Rule
+    public ActivityTestRule mActivityRule = new ActivityTestRule<>(
+            TestActivity.class);
+
+    @Before
+    public void launchApplicationWithIntent() {
+        Intent intent = new Intent();
+        intent.putExtra("startUrl", START_URL);
+        intent.putExtra("errorurl", INVALID_URL);
+        intent.putExtra("url", INVALID_URL);
+        mActivity = (TestActivity) mActivityRule.launchActivity(intent);
+    }
+
+    @Test
+    public void errorUrlTest() throws Throwable {
+        assertEquals(START_URL, mActivity.onPageFinishedUrl.take());
+        assertEquals(ERROR_URL, mActivity.onPageFinishedUrl.take());
+        mActivityRule.runOnUiThread(new Runnable() {
+            public void run() {
+                assertEquals(ERROR_URL, mActivity.getWebInterface().getUrl());
+            }
+        });
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to