You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/01/22 02:57:58 UTC
[33/52] [partial] support for 2.4.0rc1. "vendored" the platform libs
in. added Gord and Braden as contributors. removed dependency on unzip and
axed the old download-cordova code.
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/BackButtonMultiPageTest.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/BackButtonMultiPageTest.java b/lib/cordova-android/test/src/org/apache/cordova/test/BackButtonMultiPageTest.java
new file mode 100644
index 0000000..6d4a7ac
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/BackButtonMultiPageTest.java
@@ -0,0 +1,158 @@
+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 org.apache.cordova.CordovaWebView;
+import org.apache.cordova.test.actions.backbuttonmultipage;
+
+import android.test.ActivityInstrumentationTestCase2;
+import android.view.KeyEvent;
+import android.view.inputmethod.BaseInputConnection;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+
+public class BackButtonMultiPageTest extends ActivityInstrumentationTestCase2<backbuttonmultipage> {
+
+ private int TIMEOUT = 1000;
+ backbuttonmultipage testActivity;
+ private FrameLayout containerView;
+ private LinearLayout innerContainer;
+ private CordovaWebView testView;
+
+
+ public BackButtonMultiPageTest() {
+ super("org.apache.cordova.test", backbuttonmultipage.class);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ testActivity = this.getActivity();
+ containerView = (FrameLayout) testActivity.findViewById(android.R.id.content);
+ innerContainer = (LinearLayout) containerView.getChildAt(0);
+ testView = (CordovaWebView) innerContainer.getChildAt(0);
+ }
+
+ public void testPreconditions(){
+ assertNotNull(innerContainer);
+ assertNotNull(testView);
+ }
+
+ public void testViaHref() {
+ testView.sendJavascript("window.location = 'sample2.html';");
+ sleep();
+ String url = testView.getUrl();
+ assertTrue(url.endsWith("sample2.html"));
+ testView.sendJavascript("window.location = 'sample3.html';");
+ sleep();
+ url = testView.getUrl();
+ assertTrue(url.endsWith("sample3.html"));
+ boolean didGoBack = testView.backHistory();
+ sleep();
+ url = testView.getUrl();
+ assertTrue(url.endsWith("sample2.html"));
+ assertTrue(didGoBack);
+ didGoBack = testView.backHistory();
+ sleep();
+ url = testView.getUrl();
+ assertTrue(url.endsWith("index.html"));
+ assertTrue(didGoBack);
+ }
+
+ public void testViaLoadUrl() {
+ testView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample2.html");
+ sleep();
+ String url = testView.getUrl();
+ assertTrue(url.endsWith("sample2.html"));
+ testView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample3.html");
+ sleep();
+ url = testView.getUrl();
+ assertTrue(url.endsWith("sample3.html"));
+ boolean didGoBack = testView.backHistory();
+ sleep();
+ url = testView.getUrl();
+ assertTrue(url.endsWith("sample2.html"));
+ assertTrue(didGoBack);
+ didGoBack = testView.backHistory();
+ sleep();
+ url = testView.getUrl();
+ assertTrue(url.endsWith("index.html"));
+ assertTrue(didGoBack);
+ }
+
+ public void testViaBackButtonOnView() {
+ testView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample2.html");
+ sleep();
+ String url = testView.getUrl();
+ assertTrue(url.endsWith("sample2.html"));
+ testView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample3.html");
+ sleep();
+ url = testView.getUrl();
+ assertTrue(url.endsWith("sample3.html"));
+ BaseInputConnection viewConnection = new BaseInputConnection(testView, 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);
+ sleep();
+ url = testView.getUrl();
+ assertTrue(url.endsWith("sample2.html"));
+ viewConnection.sendKeyEvent(backDown);
+ viewConnection.sendKeyEvent(backUp);
+ sleep();
+ url = testView.getUrl();
+ assertTrue(url.endsWith("index.html"));
+ }
+
+ public void testViaBackButtonOnLayout() {
+ testView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample2.html");
+ sleep();
+ String url = testView.getUrl();
+ assertTrue(url.endsWith("sample2.html"));
+ testView.loadUrl("file:///android_asset/www/backbuttonmultipage/sample3.html");
+ sleep();
+ url = testView.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);
+ sleep();
+ url = testView.getUrl();
+ assertTrue(url.endsWith("sample2.html"));
+ viewConnection.sendKeyEvent(backDown);
+ viewConnection.sendKeyEvent(backUp);
+ sleep();
+ url = testView.getUrl();
+ assertTrue(url.endsWith("index.html"));
+ }
+
+ private void sleep() {
+ try {
+ Thread.sleep(TIMEOUT);
+ } catch (InterruptedException e) {
+ fail("Unexpected Timeout");
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/CordovaActivityTest.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/CordovaActivityTest.java b/lib/cordova-android/test/src/org/apache/cordova/test/CordovaActivityTest.java
new file mode 100644
index 0000000..efb80c1
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/CordovaActivityTest.java
@@ -0,0 +1,90 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+package org.apache.cordova.test;
+
+import org.apache.cordova.CordovaWebView;
+import org.apache.cordova.api.PluginManager;
+import org.apache.cordova.test.actions.CordovaActivity;
+
+import android.app.Instrumentation;
+import android.test.ActivityInstrumentationTestCase2;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+
+public class CordovaActivityTest extends ActivityInstrumentationTestCase2<CordovaActivity> {
+
+ private CordovaActivity testActivity;
+ private FrameLayout containerView;
+ private LinearLayout innerContainer;
+ private CordovaWebView testView;
+ private Instrumentation mInstr;
+ private int TIMEOUT = 1000;
+
+ @SuppressWarnings("deprecation")
+ public CordovaActivityTest()
+ {
+ super("org.apache.cordova.test",CordovaActivity.class);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ mInstr = this.getInstrumentation();
+ testActivity = this.getActivity();
+ containerView = (FrameLayout) testActivity.findViewById(android.R.id.content);
+ innerContainer = (LinearLayout) containerView.getChildAt(0);
+ testView = (CordovaWebView) innerContainer.getChildAt(0);
+
+ }
+
+ public void testPreconditions(){
+ assertNotNull(innerContainer);
+ assertNotNull(testView);
+ }
+
+
+ public void testForCordovaView() {
+ String className = testView.getClass().getSimpleName();
+ assertTrue(className.equals("CordovaWebView"));
+ }
+
+ public void testForLinearLayout() {
+ String className = innerContainer.getClass().getSimpleName();
+ assertTrue(className.equals("LinearLayoutSoftKeyboardDetect"));
+ }
+
+
+ public void testPauseAndResume()
+ {
+ mInstr.callActivityOnPause(testActivity);
+ sleep();
+ assertTrue(testView.isPaused());
+ mInstr.callActivityOnResume(testActivity);
+ sleep();
+ assertFalse(testView.isPaused());
+ }
+
+ private void sleep() {
+ try {
+ Thread.sleep(TIMEOUT);
+ } catch (InterruptedException e) {
+ fail("Unexpected Timeout");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/CordovaTest.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/CordovaTest.java b/lib/cordova-android/test/src/org/apache/cordova/test/CordovaTest.java
new file mode 100644
index 0000000..8dd409c
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/CordovaTest.java
@@ -0,0 +1,115 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova.test;
+
+import org.apache.cordova.CordovaWebView;
+import org.apache.cordova.api.PluginManager;
+import org.apache.cordova.test.actions.CordovaWebViewTestActivity;
+
+import android.app.Instrumentation;
+import android.test.ActivityInstrumentationTestCase2;
+import android.view.View;
+
+public class CordovaTest extends
+ ActivityInstrumentationTestCase2<CordovaWebViewTestActivity> {
+
+ private static final long TIMEOUT = 1000;
+ private CordovaWebViewTestActivity testActivity;
+ private View testView;
+ private String rString;
+
+ public CordovaTest() {
+ super("org.apache.cordova.test.activities", CordovaWebViewTestActivity.class);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ testActivity = this.getActivity();
+ testView = testActivity.findViewById(R.id.cordovaWebView);
+ }
+
+ public void testPreconditions() {
+ assertNotNull(testView);
+ }
+
+ public void testForCordovaView() {
+ //Sleep for no reason!!!!
+ sleep();
+ String className = testView.getClass().getSimpleName();
+ assertTrue(className.equals("CordovaWebView"));
+ }
+
+ /*
+ public void testForPluginManager() {
+ CordovaWebView v = (CordovaWebView) testView;
+ PluginManager p = v.getPluginManager();
+ assertNotNull(p);
+ String className = p.getClass().getSimpleName();
+ assertTrue(className.equals("PluginManager"));
+ }
+
+ public void testBackButton() {
+ CordovaWebView v = (CordovaWebView) testView;
+ assertFalse(v.checkBackKey());
+ }
+
+ public void testLoadUrl() {
+ CordovaWebView v = (CordovaWebView) testView;
+ v.loadUrlIntoView("file:///android_asset/www/index.html");
+ sleep();
+ String url = v.getUrl();
+ boolean result = url.equals("file:///android_asset/www/index.html");
+ assertTrue(result);
+ int visible = v.getVisibility();
+ assertTrue(visible == View.VISIBLE);
+ }
+
+ public void testBackHistoryFalse() {
+ CordovaWebView v = (CordovaWebView) testView;
+ // Move back in the history
+ boolean test = v.backHistory();
+ assertFalse(test);
+ }
+
+ // Make sure that we can go back
+ public void testBackHistoryTrue() {
+ this.testLoadUrl();
+ CordovaWebView v = (CordovaWebView) testView;
+ v.loadUrlIntoView("file:///android_asset/www/compass/index.html");
+ sleep();
+ String url = v.getUrl();
+ assertTrue(url.equals("file:///android_asset/www/compass/index.html"));
+ // Move back in the history
+ boolean test = v.backHistory();
+ assertTrue(test);
+ sleep();
+ url = v.getUrl();
+ assertTrue(url.equals("file:///android_asset/www/index.html"));
+ }
+ */
+
+
+ private void sleep() {
+ try {
+ Thread.sleep(TIMEOUT);
+ } catch (InterruptedException e) {
+ fail("Unexpected Timeout");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/ErrorUrlTest.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/ErrorUrlTest.java b/lib/cordova-android/test/src/org/apache/cordova/test/ErrorUrlTest.java
new file mode 100644
index 0000000..5a7eb9c
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/ErrorUrlTest.java
@@ -0,0 +1,76 @@
+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 org.apache.cordova.CordovaWebView;
+import org.apache.cordova.test.actions.errorurl;
+
+import android.test.ActivityInstrumentationTestCase2;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+
+public class ErrorUrlTest extends ActivityInstrumentationTestCase2<errorurl> {
+
+ private int TIMEOUT = 1000;
+ errorurl testActivity;
+ private FrameLayout containerView;
+ private LinearLayout innerContainer;
+ private CordovaWebView testView;
+
+ public ErrorUrlTest() {
+ super("org.apache.cordova.test",errorurl.class);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ testActivity = this.getActivity();
+ containerView = (FrameLayout) testActivity.findViewById(android.R.id.content);
+ innerContainer = (LinearLayout) containerView.getChildAt(0);
+ testView = (CordovaWebView) innerContainer.getChildAt(0);
+ }
+
+ public void testPreconditions(){
+ assertNotNull(innerContainer);
+ assertNotNull(testView);
+ }
+
+ public void testUrl()
+ {
+ sleep();
+ String good_url = "file:///android_asset/www/htmlnotfound/error.html";
+ String url = testView.getUrl();
+ assertNotNull(url);
+ assertTrue(url.equals(good_url));
+ }
+
+
+ private void sleep() {
+ try {
+ Thread.sleep(TIMEOUT);
+ } catch (InterruptedException e) {
+ fail("Unexpected Timeout");
+ }
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/FixWebView.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/FixWebView.java b/lib/cordova-android/test/src/org/apache/cordova/test/FixWebView.java
new file mode 100755
index 0000000..46f155b
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/FixWebView.java
@@ -0,0 +1,43 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova.test;
+
+import android.content.Context;
+import android.webkit.WebView;
+
+public class FixWebView extends WebView {
+
+ public FixWebView(Context context) {
+ super(context);
+ }
+
+ @Override
+ public void pauseTimers() {
+ // Do nothing
+ }
+
+ /**
+ * This method is with different signature in order to stop the timers while move application to background
+ * @param realPause
+ */
+ public void pauseTimers(@SuppressWarnings("unused") boolean realPause) {
+ super.pauseTimers();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/GapClientTest.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/GapClientTest.java b/lib/cordova-android/test/src/org/apache/cordova/test/GapClientTest.java
new file mode 100644
index 0000000..b9b113b
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/GapClientTest.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.test;
+
+import org.apache.cordova.CordovaWebView;
+import org.apache.cordova.CordovaChromeClient;
+import org.apache.cordova.api.PluginManager;
+import org.apache.cordova.test.actions.CordovaWebViewTestActivity;
+
+import android.content.Context;
+import android.content.res.AssetManager;
+import android.content.res.Resources;
+import android.test.ActivityInstrumentationTestCase2;
+import android.view.View;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+
+public class GapClientTest extends ActivityInstrumentationTestCase2<CordovaWebViewTestActivity> {
+
+ private CordovaWebViewTestActivity testActivity;
+ private FrameLayout containerView;
+ private LinearLayout innerContainer;
+ private View testView;
+ private String rString;
+ private CordovaChromeClient appCode;
+
+ public GapClientTest() {
+ super("org.apache.cordova.test.activities",CordovaWebViewTestActivity.class);
+ }
+
+ protected void setUp() throws Exception{
+ super.setUp();
+ testActivity = this.getActivity();
+ containerView = (FrameLayout) testActivity.findViewById(android.R.id.content);
+ innerContainer = (LinearLayout) containerView.getChildAt(0);
+ testView = innerContainer.getChildAt(0);
+
+ }
+
+ public void testPreconditions(){
+ assertNotNull(innerContainer);
+ assertNotNull(testView);
+ }
+
+ public void testForCordovaView() {
+ String className = testView.getClass().getSimpleName();
+ assertTrue(className.equals("CordovaWebView"));
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/HtmlNotFoundTest.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/HtmlNotFoundTest.java b/lib/cordova-android/test/src/org/apache/cordova/test/HtmlNotFoundTest.java
new file mode 100644
index 0000000..e47d5b8
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/HtmlNotFoundTest.java
@@ -0,0 +1,74 @@
+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 org.apache.cordova.CordovaWebView;
+import org.apache.cordova.test.actions.htmlnotfound;
+
+import android.test.ActivityInstrumentationTestCase2;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+
+public class HtmlNotFoundTest extends ActivityInstrumentationTestCase2<htmlnotfound> {
+
+ private int TIMEOUT = 1000;
+ private htmlnotfound testActivity;
+ private FrameLayout containerView;
+ private LinearLayout innerContainer;
+ private CordovaWebView testView;
+
+ public HtmlNotFoundTest() {
+ super("org.apache.cordova.test",htmlnotfound.class);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ testActivity = this.getActivity();
+ containerView = (FrameLayout) testActivity.findViewById(android.R.id.content);
+ innerContainer = (LinearLayout) containerView.getChildAt(0);
+ testView = (CordovaWebView) innerContainer.getChildAt(0);
+ }
+
+ public void testPreconditions(){
+ assertNotNull(innerContainer);
+ assertNotNull(testView);
+ }
+
+ public void testUrl()
+ {
+ sleep();
+ String good_url = "file:///android_asset/www/htmlnotfound/error.html";
+ String url = testView.getUrl();
+ assertNotNull(url);
+ assertFalse(url.equals(good_url));
+ }
+
+ private void sleep() {
+ try {
+ Thread.sleep(TIMEOUT);
+ } catch (InterruptedException e) {
+ fail("Unexpected Timeout");
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/IFrameTest.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/IFrameTest.java b/lib/cordova-android/test/src/org/apache/cordova/test/IFrameTest.java
new file mode 100644
index 0000000..02bb130
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/IFrameTest.java
@@ -0,0 +1,34 @@
+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 org.apache.cordova.test.actions.iframe;
+
+import android.test.ActivityInstrumentationTestCase2;
+
+public class IFrameTest extends ActivityInstrumentationTestCase2<iframe> {
+
+ public IFrameTest() {
+ super("org.apache.cordova.test",iframe.class);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/JQMTabTest.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/JQMTabTest.java b/lib/cordova-android/test/src/org/apache/cordova/test/JQMTabTest.java
new file mode 100644
index 0000000..8d01ff2
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/JQMTabTest.java
@@ -0,0 +1,35 @@
+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 org.apache.cordova.test.actions.jqmtabbackbutton;
+
+import android.test.ActivityInstrumentationTestCase2;
+
+public class JQMTabTest extends ActivityInstrumentationTestCase2<jqmtabbackbutton> {
+
+ public JQMTabTest(Class<jqmtabbackbutton> activityClass) {
+ super(activityClass);
+ // TODO Auto-generated constructor stub
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/LifecycleTest.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/LifecycleTest.java b/lib/cordova-android/test/src/org/apache/cordova/test/LifecycleTest.java
new file mode 100644
index 0000000..396036d
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/LifecycleTest.java
@@ -0,0 +1,34 @@
+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 org.apache.cordova.test.actions.lifecycle;
+
+import android.test.ActivityInstrumentationTestCase2;
+
+public class LifecycleTest extends ActivityInstrumentationTestCase2<lifecycle> {
+
+ public LifecycleTest()
+ {
+ super("org.apache.cordova.test",lifecycle.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/PluginManagerTest.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/PluginManagerTest.java b/lib/cordova-android/test/src/org/apache/cordova/test/PluginManagerTest.java
new file mode 100644
index 0000000..d322e6c
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/PluginManagerTest.java
@@ -0,0 +1,70 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+package org.apache.cordova.test;
+
+import org.apache.cordova.CordovaWebView;
+import org.apache.cordova.api.PluginManager;
+import org.apache.cordova.test.actions.CordovaWebViewTestActivity;
+
+import android.test.ActivityInstrumentationTestCase2;
+import android.view.View;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+
+public class PluginManagerTest extends ActivityInstrumentationTestCase2<CordovaWebViewTestActivity> {
+
+ private CordovaWebViewTestActivity testActivity;
+ private FrameLayout containerView;
+ private LinearLayout innerContainer;
+ private View testView;
+ private String rString;
+ private PluginManager pMan;
+
+ public PluginManagerTest() {
+ super("org.apache.cordova.test.activities",CordovaWebViewTestActivity.class);
+ }
+
+ protected void setUp() throws Exception{
+ super.setUp();
+ testActivity = this.getActivity();
+ containerView = (FrameLayout) testActivity.findViewById(android.R.id.content);
+ innerContainer = (LinearLayout) containerView.getChildAt(0);
+ testView = innerContainer.getChildAt(0);
+
+ }
+
+ public void testPreconditions(){
+ assertNotNull(innerContainer);
+ assertNotNull(testView);
+ }
+
+
+ public void testForPluginManager() {
+ /*
+ CordovaWebView v = (CordovaWebView) testView;
+ pMan = v.getPluginManager();
+ assertNotNull(pMan);
+ String className = pMan.getClass().getSimpleName();
+ assertTrue(className.equals("PluginManager"));
+ */
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/SplashscreenTest.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/SplashscreenTest.java b/lib/cordova-android/test/src/org/apache/cordova/test/SplashscreenTest.java
new file mode 100644
index 0000000..edb8758
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/SplashscreenTest.java
@@ -0,0 +1,49 @@
+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 org.apache.cordova.CordovaWebView;
+import org.apache.cordova.test.actions.splashscreen;
+
+import android.app.Dialog;
+import android.test.ActivityInstrumentationTestCase2;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+
+public class SplashscreenTest extends ActivityInstrumentationTestCase2<splashscreen> {
+
+ private splashscreen testActivity;
+ private Dialog containerView;
+
+ public SplashscreenTest()
+ {
+ super("org.apache.cordova.test",splashscreen.class);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ testActivity = this.getActivity();
+ //containerView = (FrameLayout) testActivity.findViewById(android.R.id.content);
+ //containerView = (Dialog) testActivity.findViewById(id);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/UserWebViewTest.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/UserWebViewTest.java b/lib/cordova-android/test/src/org/apache/cordova/test/UserWebViewTest.java
new file mode 100644
index 0000000..12ff161
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/UserWebViewTest.java
@@ -0,0 +1,76 @@
+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 org.apache.cordova.CordovaWebView;
+import org.apache.cordova.CordovaWebViewClient;
+import org.apache.cordova.CordovaChromeClient;
+import org.apache.cordova.test.actions.userwebview;
+
+import android.test.ActivityInstrumentationTestCase2;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+
+public class UserWebViewTest extends ActivityInstrumentationTestCase2<userwebview> {
+
+ public UserWebViewTest ()
+ {
+ super(userwebview.class);
+ }
+
+ private int TIMEOUT = 1000;
+ userwebview testActivity;
+ private FrameLayout containerView;
+ private LinearLayout innerContainer;
+ private CordovaWebView testView;
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ testActivity = this.getActivity();
+ containerView = (FrameLayout) testActivity.findViewById(android.R.id.content);
+ innerContainer = (LinearLayout) containerView.getChildAt(0);
+ testView = (CordovaWebView) innerContainer.getChildAt(0);
+ }
+
+ public void testPreconditions(){
+ assertNotNull(innerContainer);
+ assertNotNull(testView);
+ }
+
+ public void customTest()
+ {
+ assertTrue(CordovaWebView.class.isInstance(testView));
+ assertTrue(CordovaWebViewClient.class.isInstance(testActivity.testViewClient));
+ assertTrue(CordovaChromeClient.class.isInstance(testActivity.testChromeClient));
+ }
+
+
+ private void sleep() {
+ try {
+ Thread.sleep(TIMEOUT);
+ } catch (InterruptedException e) {
+ fail("Unexpected Timeout");
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/XhrTest.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/XhrTest.java b/lib/cordova-android/test/src/org/apache/cordova/test/XhrTest.java
new file mode 100644
index 0000000..7c3ed9f
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/XhrTest.java
@@ -0,0 +1,34 @@
+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 org.apache.cordova.test.actions.xhr;
+
+import android.test.ActivityInstrumentationTestCase2;
+
+public class XhrTest extends ActivityInstrumentationTestCase2<xhr> {
+
+ public XhrTest()
+ {
+ super(xhr.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/CordovaActivity.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/CordovaActivity.java
new file mode 100644
index 0000000..f709737
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/CordovaActivity.java
@@ -0,0 +1,33 @@
+/*
+ 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.actions;
+
+import org.apache.cordova.DroidGap;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class CordovaActivity extends DroidGap {
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.loadUrl("file:///android_asset/www/index.html");
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/CordovaDriverAction.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/CordovaDriverAction.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/CordovaDriverAction.java
new file mode 100644
index 0000000..e6156ec
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/CordovaDriverAction.java
@@ -0,0 +1,78 @@
+/*
+ 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.actions;
+
+import java.util.concurrent.ExecutorService;
+
+import org.apache.cordova.api.CordovaInterface;
+import org.apache.cordova.api.CordovaPlugin;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+
+
+public class CordovaDriverAction extends Activity implements CordovaInterface {
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+
+ public void startActivityForResult(CordovaPlugin command, Intent intent,
+ int requestCode) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setActivityResultCallback(CordovaPlugin plugin) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Activity getActivity() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Deprecated
+ public Context getContext() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Deprecated
+ public void cancelLoadUrl() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Object onMessage(String id, Object data) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ExecutorService getThreadPool() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java
new file mode 100644
index 0000000..ee65190
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java
@@ -0,0 +1,104 @@
+/*
+ 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.actions;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.apache.cordova.CordovaWebView;
+import org.apache.cordova.api.CordovaInterface;
+import org.apache.cordova.api.CordovaPlugin;
+import org.apache.cordova.api.LOG;
+import org.apache.cordova.test.R;
+import org.apache.cordova.test.R.id;
+import org.apache.cordova.test.R.layout;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+
+public class CordovaWebViewTestActivity extends Activity implements CordovaInterface {
+ CordovaWebView cordovaWebView;
+
+ private final ExecutorService threadPool = Executors.newCachedThreadPool();
+
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.main);
+
+ cordovaWebView = (CordovaWebView) findViewById(R.id.cordovaWebView);
+
+ cordovaWebView.loadUrl("file:///android_asset/www/index.html");
+
+ }
+
+ public Context getContext() {
+ return this;
+ }
+
+ public void startActivityForResult(CordovaPlugin command, Intent intent,
+ int requestCode) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setActivityResultCallback(CordovaPlugin plugin) {
+ // TODO Auto-generated method stub
+
+ }
+
+ //Note: This must always return an activity!
+ public Activity getActivity() {
+ return this;
+ }
+
+ @Deprecated
+ public void cancelLoadUrl() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Object onMessage(String id, Object data) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ExecutorService getThreadPool() {
+ // TODO Auto-generated method stub
+ return threadPool;
+ }
+
+ @Override
+ /**
+ * The final call you receive before your activity is destroyed.
+ */
+ public void onDestroy() {
+ super.onDestroy();
+ if (cordovaWebView != null) {
+ // Send destroy event to JavaScript
+ cordovaWebView.loadUrl("javascript:try{cordova.require('cordova/channel').onDestroy.fire();}catch(e){console.log('exception firing destroy event from native');};");
+ cordovaWebView.handleDestroy();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/backbuttonmultipage.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/backbuttonmultipage.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/backbuttonmultipage.java
new file mode 100755
index 0000000..4929831
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/backbuttonmultipage.java
@@ -0,0 +1,30 @@
+/*
+ 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.actions;
+
+import android.os.Bundle;
+import org.apache.cordova.*;
+
+public class backbuttonmultipage extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.loadUrl("file:///android_asset/www/backbuttonmultipage/index.html");
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/background.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/background.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/background.java
new file mode 100755
index 0000000..47c6bc7
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/background.java
@@ -0,0 +1,33 @@
+/*
+ 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.actions;
+
+import android.os.Bundle;
+
+import org.apache.cordova.*;
+
+public class background extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ //super.init(new FixWebView(this), new CordovaWebViewClient(this), new CordovaChromeClient(this));
+ super.setBooleanProperty("keepRunning", false);
+ super.loadUrl("file:///android_asset/www/background/index.html");
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/basicauth.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/basicauth.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/basicauth.java
new file mode 100755
index 0000000..ad739c9
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/basicauth.java
@@ -0,0 +1,44 @@
+/*
+ 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.actions;
+
+import android.os.Bundle;
+import org.apache.cordova.*;
+
+public class basicauth extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.init();
+
+ // LogCat: onReceivedHttpAuthRequest(browserspy.dk:80,BrowserSpy.dk - HTTP Password Test)
+ AuthenticationToken token = new AuthenticationToken();
+ token.setUserName("test");
+ token.setPassword("test");
+ super.setAuthenticationToken(token, "browserspy.dk:80", "BrowserSpy.dk - HTTP Password Test");
+
+ // Add web site to whitelist
+ Config.init();
+ Config.addWhiteListEntry("http://browserspy.dk*", true);
+
+ // Load test
+ super.loadUrl("file:///android_asset/www/basicauth/index.html");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/errorurl.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/errorurl.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/errorurl.java
new file mode 100755
index 0000000..10c20f7
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/errorurl.java
@@ -0,0 +1,34 @@
+/*
+ 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.actions;
+
+import android.os.Bundle;
+import org.apache.cordova.*;
+
+public class errorurl extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.init();
+ this.setStringProperty("errorUrl", "file:///android_asset/www/htmlnotfound/error.html");
+ super.loadUrl("file:///android_asset/www/htmlnotfound/index.html");
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/fullscreen.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/fullscreen.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/fullscreen.java
new file mode 100755
index 0000000..60726ad
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/fullscreen.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.
+*/
+package org.apache.cordova.test.actions;
+
+import android.os.Bundle;
+import org.apache.cordova.*;
+
+public class fullscreen extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Properties must be set before init() is called, since some are processed during init().
+
+ // fullscreen can also be set in cordova.xml. For example,
+ // <preference name="fullscreen" value="true" />
+ super.setBooleanProperty("fullscreen", true);
+
+ super.init();
+ super.loadUrl("file:///android_asset/www/fullscreen/index.html");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/htmlnotfound.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/htmlnotfound.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/htmlnotfound.java
new file mode 100755
index 0000000..da849e0
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/htmlnotfound.java
@@ -0,0 +1,31 @@
+/*
+ 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.actions;
+
+import android.os.Bundle;
+import org.apache.cordova.*;
+
+public class htmlnotfound extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.init();
+ super.loadUrl("file:///android_asset/www/htmlnotfound/index.html");
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/iframe.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/iframe.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/iframe.java
new file mode 100755
index 0000000..3398aa4
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/iframe.java
@@ -0,0 +1,30 @@
+/*
+ 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.actions;
+
+import android.os.Bundle;
+import org.apache.cordova.*;
+
+public class iframe extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.loadUrl("file:///android_asset/www/iframe/index.html");
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/jqmtabbackbutton.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/jqmtabbackbutton.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/jqmtabbackbutton.java
new file mode 100755
index 0000000..737bb36
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/jqmtabbackbutton.java
@@ -0,0 +1,30 @@
+/*
+ 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.actions;
+
+import android.os.Bundle;
+import org.apache.cordova.*;
+
+public class jqmtabbackbutton extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.loadUrl("file:///android_asset/www/jqmtabbackbutton/index.html");
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/lifecycle.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/lifecycle.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/lifecycle.java
new file mode 100755
index 0000000..8419b0e
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/lifecycle.java
@@ -0,0 +1,30 @@
+/*
+ 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.actions;
+
+import android.os.Bundle;
+import org.apache.cordova.*;
+
+public class lifecycle extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.loadUrl("file:///android_asset/www/lifecycle/index.html");
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/loading.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/loading.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/loading.java
new file mode 100755
index 0000000..4c52c9f
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/loading.java
@@ -0,0 +1,31 @@
+/*
+ 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.actions;
+
+import android.os.Bundle;
+import org.apache.cordova.*;
+
+public class loading extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.setStringProperty("loadingDialog", "Testing,Loading...");
+ super.loadUrl("http://www.google.com");
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/menus.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/menus.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/menus.java
new file mode 100755
index 0000000..e567905
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/menus.java
@@ -0,0 +1,80 @@
+/*
+ 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.actions;
+
+import android.os.Bundle;
+import android.view.ContextMenu;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ContextMenu.ContextMenuInfo;
+
+import org.apache.cordova.*;
+import org.apache.cordova.api.LOG;
+
+public class menus extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.init();
+ super.registerForContextMenu(super.appView);
+ super.loadUrl("file:///android_asset/www/menus/index.html");
+ }
+
+ // Demonstrate how to add your own menus to app
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+ int base = Menu.FIRST;
+ // Group, item id, order, title
+ menu.add(base, base, base, "Item1");
+ menu.add(base, base + 1, base + 1, "Item2");
+ menu.add(base, base + 2, base + 2, "Item3");
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ LOG.d("menus", "Item " + item.getItemId() + " pressed.");
+ this.appView.loadUrl("javascript:alert('Menu " + item.getItemId() + " pressed.')");
+ return super.onOptionsItemSelected(item);
+ }
+
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ LOG.d("menus", "onPrepareOptionsMenu()");
+ // this.appView.loadUrl("javascript:alert('onPrepareOptionsMenu()')");
+ return true;
+ }
+
+ @Override
+ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo info) {
+ LOG.d("menus", "onCreateContextMenu()");
+ menu.setHeaderTitle("Test Context Menu");
+ menu.add(200, 200, 200, "Context Item1");
+ }
+
+ @Override
+ public boolean onContextItemSelected(MenuItem item) {
+ this.appView.loadUrl("javascript:alert('Context Menu " + item.getItemId() + " pressed.')");
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/splashscreen.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/splashscreen.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/splashscreen.java
new file mode 100755
index 0000000..3d924e0
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/splashscreen.java
@@ -0,0 +1,37 @@
+/*
+ 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.actions;
+
+import android.os.Bundle;
+import org.apache.cordova.*;
+import org.apache.cordova.test.R;
+import org.apache.cordova.test.R.drawable;
+
+public class splashscreen extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.init();
+
+ // Show splashscreen
+ this.setIntegerProperty("splashscreen", R.drawable.sandy);
+
+ super.loadUrl("file:///android_asset/www/splashscreen/index.html", 2000);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/tests.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/tests.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/tests.java
new file mode 100755
index 0000000..bc326e3
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/tests.java
@@ -0,0 +1,32 @@
+/*
+ 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.actions;
+
+import android.os.Bundle;
+import org.apache.cordova.*;
+
+public class tests extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.init();
+ //super.pluginManager.addService("Activity", "org.apache.cordova.test.ActivityPlugin");
+ super.loadUrl("file:///android_asset/www/index.html");
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/timeout.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/timeout.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/timeout.java
new file mode 100755
index 0000000..22c0881
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/timeout.java
@@ -0,0 +1,34 @@
+/*
+ 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.actions;
+
+import android.os.Bundle;
+import org.apache.cordova.*;
+
+public class timeout extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.init();
+
+ // Short timeout to cause error
+ this.setIntegerProperty("loadUrlTimeoutValue", 10);
+ super.loadUrl("http://www.google.com");
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/userwebview.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/userwebview.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/userwebview.java
new file mode 100755
index 0000000..84320f4
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/userwebview.java
@@ -0,0 +1,78 @@
+/*
+ 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.actions;
+
+import android.os.Bundle;
+import android.webkit.WebView;
+import android.webkit.GeolocationPermissions.Callback;
+
+import org.apache.cordova.*;
+import org.apache.cordova.api.LOG;
+
+public class userwebview extends DroidGap {
+
+ public TestViewClient testViewClient;
+ public TestChromeClient testChromeClient;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ testViewClient = new TestViewClient(this);
+ testChromeClient = new TestChromeClient(this);
+ super.init(new CordovaWebView(this), new TestViewClient(this), new TestChromeClient(this));
+ super.loadUrl("file:///android_asset/www/userwebview/index.html");
+ }
+
+ public class TestChromeClient extends CordovaChromeClient {
+ public TestChromeClient(DroidGap arg0) {
+ super(arg0);
+ LOG.d("userwebview", "TestChromeClient()");
+ }
+
+ @Override
+ public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) {
+ LOG.d("userwebview", "onGeolocationPermissionsShowPrompt(" + origin + ")");
+ super.onGeolocationPermissionsShowPrompt(origin, callback);
+ callback.invoke(origin, true, false);
+ }
+ }
+
+ /**
+ * This class can be used to override the GapViewClient and receive notification of webview events.
+ */
+ public class TestViewClient extends CordovaWebViewClient {
+ public TestViewClient(DroidGap arg0) {
+ super(arg0);
+ LOG.d("userwebview", "TestViewClient()");
+ }
+
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url) {
+ LOG.d("userwebview", "shouldOverrideUrlLoading(" + url + ")");
+ return super.shouldOverrideUrlLoading(view, url);
+ }
+
+ @Override
+ public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
+ LOG.d("userwebview", "onReceivedError: Error code=" + errorCode + " Description=" + description + " URL=" + failingUrl);
+ super.onReceivedError(view, errorCode, description, failingUrl);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/whitelist.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/whitelist.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/whitelist.java
new file mode 100755
index 0000000..57a0723
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/whitelist.java
@@ -0,0 +1,51 @@
+/*
+ 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.actions;
+
+import android.os.Bundle;
+import android.webkit.WebView;
+
+import org.apache.cordova.*;
+import org.apache.cordova.api.LOG;
+
+public class whitelist extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.init(new CordovaWebView(this), new TestViewClient(this), new CordovaChromeClient(this));
+ super.loadUrl("file:///android_asset/www/whitelist/index.html");
+ }
+
+ /**
+ * This class can be used to override the GapViewClient and receive notification of webview events.
+ */
+ public class TestViewClient extends CordovaWebViewClient {
+
+ public TestViewClient(DroidGap arg0) {
+ super(arg0);
+ }
+
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url) {
+ LOG.d("whitelist", "shouldOverrideUrlLoading(" + url + ")");
+ LOG.d("whitelist", "originalUrl=" + view.getOriginalUrl());
+ return super.shouldOverrideUrlLoading(view, url);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/actions/xhr.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/actions/xhr.java b/lib/cordova-android/test/src/org/apache/cordova/test/actions/xhr.java
new file mode 100755
index 0000000..3695c11
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/actions/xhr.java
@@ -0,0 +1,30 @@
+/*
+ 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.actions;
+
+import android.os.Bundle;
+import org.apache.cordova.*;
+
+public class xhr extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.loadUrl("file:///android_asset/www/xhr/index.html");
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d61deccd/lib/cordova-android/test/src/org/apache/cordova/test/backgroundcolor.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/test/src/org/apache/cordova/test/backgroundcolor.java b/lib/cordova-android/test/src/org/apache/cordova/test/backgroundcolor.java
new file mode 100755
index 0000000..f40a673
--- /dev/null
+++ b/lib/cordova-android/test/src/org/apache/cordova/test/backgroundcolor.java
@@ -0,0 +1,40 @@
+/*
+ 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.graphics.Color;
+import android.os.Bundle;
+import org.apache.cordova.*;
+
+public class backgroundcolor extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Properties must be set before init() is called, since some are processed during init().
+
+ // backgroundColor can also be set in cordova.xml, but you must use the number equivalent of the color. For example, Color.RED is
+ // <preference name="backgroundColor" value="-65536" />
+ super.setIntegerProperty("backgroundColor", Color.GREEN);
+
+ super.init();
+ super.loadUrl("file:///android_asset/www/backgroundcolor/index.html");
+ }
+
+}