diff --git a/test/AndroidManifest.xml b/test/AndroidManifest.xml
index 705385c0..2f99b9ae 100755
--- a/test/AndroidManifest.xml
+++ b/test/AndroidManifest.xml
@@ -45,7 +45,7 @@
-
+
+
+
+
diff --git a/test/src/org/apache/cordova/pluginApi/pluginStub.java b/test/src/org/apache/cordova/pluginApi/pluginStub.java
new file mode 100644
index 00000000..b91a7af6
--- /dev/null
+++ b/test/src/org/apache/cordova/pluginApi/pluginStub.java
@@ -0,0 +1,39 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+/*
+ * This plugin is a test of all the message callbacks and actions available to plugins
+ *
+ */
+
+package org.apache.cordova.pluginApi;
+
+import org.apache.cordova.CordovaPlugin;
+
+public class pluginStub extends CordovaPlugin {
+
+ public String id;
+ public Object data;
+
+ public Object onMessage(String id, Object input)
+ {
+ this.data = input;
+ return input;
+ }
+}
diff --git a/test/src/org/apache/cordova/test/junit/BackButtonMultiPageTest.java b/test/src/org/apache/cordova/test/junit/BackButtonMultiPageTest.java
index 5c718ef1..923b3763 100644
--- a/test/src/org/apache/cordova/test/junit/BackButtonMultiPageTest.java
+++ b/test/src/org/apache/cordova/test/junit/BackButtonMultiPageTest.java
@@ -25,6 +25,7 @@ import org.apache.cordova.CordovaWebView;
import org.apache.cordova.test.backbuttonmultipage;
import android.test.ActivityInstrumentationTestCase2;
+import android.test.UiThreadTest;
import android.view.KeyEvent;
import android.view.inputmethod.BaseInputConnection;
import android.widget.FrameLayout;
@@ -43,6 +44,7 @@ public class BackButtonMultiPageTest extends ActivityInstrumentationTestCase2 {
assertNotNull(testView);
}
- public void testUrl()
+ public void testUrl() throws Throwable
{
sleep();
- String good_url = "file:///android_asset/www/htmlnotfound/error.html";
- String url = testView.getUrl();
- assertNotNull(url);
- assertTrue(url.equals(good_url));
+ runTestOnUiThread(new Runnable() {
+ public void run()
+ {
+ String good_url = "file:///android_asset/www/htmlnotfound/error.html";
+ String url = testView.getUrl();
+ assertNotNull(url);
+ assertTrue(url.equals(good_url));
+
+ }
+ });
}
diff --git a/test/src/org/apache/cordova/test/junit/HtmlNotFoundTest.java b/test/src/org/apache/cordova/test/junit/HtmlNotFoundTest.java
index 93f9cdb2..abc4802a 100644
--- a/test/src/org/apache/cordova/test/junit/HtmlNotFoundTest.java
+++ b/test/src/org/apache/cordova/test/junit/HtmlNotFoundTest.java
@@ -54,13 +54,19 @@ public class HtmlNotFoundTest extends ActivityInstrumentationTestCase2 {
+ private CordovaWebViewTestActivity testActivity;
+ private CordovaWebView testView;
+ private pluginStub testPlugin;
+ private int TIMEOUT = 1000;
+
+ private Solo solo;
+
+ public MessageTest() {
+ super("org.apache.cordova.test.activities", CordovaWebViewTestActivity.class);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ testActivity = this.getActivity();
+ testView = (CordovaWebView) testActivity.findViewById(R.id.cordovaWebView);
+ testPlugin = (pluginStub) testView.pluginManager.getPlugin("PluginStub");
+ solo = new Solo(getInstrumentation(), getActivity());
+ }
+
+ public void testOnScrollChanged()
+ {
+ solo.waitForWebElement(By.textContent("Cordova Android Tests"));
+ solo.scrollDown();
+ sleep();
+ Object data = testPlugin.data;
+ assertTrue(data.getClass().getSimpleName().equals("ScrollEvent"));
+ }
+
+
+
+ private void sleep() {
+ try {
+ Thread.sleep(TIMEOUT);
+ } catch (InterruptedException e) {
+ fail("Unexpected Timeout");
+ }
+ }
+}