You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2014/01/22 20:38:18 UTC
[07/50] [abbrv] CB-5302: Massive movement to get tests working again
http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/junit/FixWebView.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/junit/FixWebView.java b/test/src/org/apache/cordova/test/junit/FixWebView.java
new file mode 100755
index 0000000..9ac952f
--- /dev/null
+++ b/test/src/org/apache/cordova/test/junit/FixWebView.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.junit;
+
+import com.amazon.android.webkit.AmazonWebView;
+
+import android.content.Context;
+
+public class FixWebView extends AmazonWebView {
+
+ 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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/junit/GapClientTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/junit/GapClientTest.java b/test/src/org/apache/cordova/test/junit/GapClientTest.java
new file mode 100644
index 0000000..4540d92
--- /dev/null
+++ b/test/src/org/apache/cordova/test/junit/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.junit;
+
+import org.apache.cordova.CordovaWebView;
+import org.apache.cordova.CordovaChromeClient;
+import org.apache.cordova.PluginManager;
+import org.apache.cordova.test.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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/junit/HtmlNotFoundTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/junit/HtmlNotFoundTest.java b/test/src/org/apache/cordova/test/junit/HtmlNotFoundTest.java
new file mode 100644
index 0000000..9b3863e
--- /dev/null
+++ b/test/src/org/apache/cordova/test/junit/HtmlNotFoundTest.java
@@ -0,0 +1,76 @@
+package org.apache.cordova.test.junit;
+/*
+ *
+ * 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.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;
+ private AmazonWebViewOnUiThread mUiThread;
+
+ 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);
+ mUiThread = new AmazonWebViewOnUiThread(this, testView);
+ }
+
+ public void testPreconditions(){
+ assertNotNull(innerContainer);
+ assertNotNull(testView);
+ }
+
+ public void testUrl()
+ {
+ sleep();
+ String good_url = "file:///android_asset/www/htmlnotfound/error.html";
+ String url = mUiThread.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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/junit/IFrameTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/junit/IFrameTest.java b/test/src/org/apache/cordova/test/junit/IFrameTest.java
new file mode 100644
index 0000000..ba76463
--- /dev/null
+++ b/test/src/org/apache/cordova/test/junit/IFrameTest.java
@@ -0,0 +1,94 @@
+package org.apache.cordova.test.junit;
+/*
+ *
+ * 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.iframe;
+import org.apache.cordova.test.util.Purity;
+
+import android.app.Activity;
+import android.app.Instrumentation;
+import android.test.ActivityInstrumentationTestCase2;
+import android.test.TouchUtils;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
+
+public class IFrameTest extends ActivityInstrumentationTestCase2 {
+
+
+ private Instrumentation mInstr;
+ private Activity testActivity;
+ private FrameLayout containerView;
+ private LinearLayout innerContainer;
+ private CordovaWebView testView;
+ private AmazonWebViewOnUiThread mUiThread;
+ private TouchUtils touch;
+ private Purity touchTool;
+
+ public IFrameTest() {
+ super("org.apache.cordova.test",iframe.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);
+ mUiThread = new AmazonWebViewOnUiThread(this, testView);
+ touch = new TouchUtils();
+ touchTool = new Purity(testActivity, getInstrumentation());
+ }
+
+
+ public void testIframeDest()
+ {
+ testView.sendJavascript("loadUrl('http://maps.google.com/maps?output=embed');");
+ sleep(3000);
+ testView.sendJavascript("loadUrl('index2.html')");
+ sleep(1000);
+ String url = mUiThread.getUrl();
+ assertTrue(url.endsWith("index.html"));
+ }
+
+ public void testIframeHistory()
+ {
+ testView.sendJavascript("loadUrl('http://maps.google.com/maps?output=embed');");
+ sleep(3000);
+ testView.sendJavascript("loadUrl('index2.html')");
+ sleep(1000);
+ String url = mUiThread.getUrl();
+ mUiThread.backHistory();
+ sleep(1000);
+ 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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/junit/LifecycleTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/junit/LifecycleTest.java b/test/src/org/apache/cordova/test/junit/LifecycleTest.java
new file mode 100644
index 0000000..5423575
--- /dev/null
+++ b/test/src/org/apache/cordova/test/junit/LifecycleTest.java
@@ -0,0 +1,34 @@
+package org.apache.cordova.test.junit;
+/*
+ *
+ * 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.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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/junit/MenuTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/junit/MenuTest.java b/test/src/org/apache/cordova/test/junit/MenuTest.java
new file mode 100644
index 0000000..6c1ace6
--- /dev/null
+++ b/test/src/org/apache/cordova/test/junit/MenuTest.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.junit;
+
+import org.apache.cordova.test.menus;
+
+import android.test.ActivityInstrumentationTestCase2;
+
+public class MenuTest extends ActivityInstrumentationTestCase2<menus> {
+
+ public MenuTest() {
+ super("org.apache.cordova.test", menus.class);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/junit/PluginManagerTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/junit/PluginManagerTest.java b/test/src/org/apache/cordova/test/junit/PluginManagerTest.java
new file mode 100644
index 0000000..bcdead6
--- /dev/null
+++ b/test/src/org/apache/cordova/test/junit/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.junit;
+
+import org.apache.cordova.CordovaWebView;
+import org.apache.cordova.PluginManager;
+import org.apache.cordova.test.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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/junit/SplashscreenTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/junit/SplashscreenTest.java b/test/src/org/apache/cordova/test/junit/SplashscreenTest.java
new file mode 100644
index 0000000..14da5ac
--- /dev/null
+++ b/test/src/org/apache/cordova/test/junit/SplashscreenTest.java
@@ -0,0 +1,49 @@
+package org.apache.cordova.test.junit;
+/*
+ *
+ * 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.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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/junit/UserWebViewTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/junit/UserWebViewTest.java b/test/src/org/apache/cordova/test/junit/UserWebViewTest.java
new file mode 100644
index 0000000..62dcbe0
--- /dev/null
+++ b/test/src/org/apache/cordova/test/junit/UserWebViewTest.java
@@ -0,0 +1,76 @@
+package org.apache.cordova.test.junit;
+/*
+ *
+ * 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.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 testCustom()
+ {
+ 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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/junit/XhrTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/junit/XhrTest.java b/test/src/org/apache/cordova/test/junit/XhrTest.java
new file mode 100644
index 0000000..16c977f
--- /dev/null
+++ b/test/src/org/apache/cordova/test/junit/XhrTest.java
@@ -0,0 +1,34 @@
+package org.apache.cordova.test.junit;
+/*
+ *
+ * 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.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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/lifecycle.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/lifecycle.java b/test/src/org/apache/cordova/test/lifecycle.java
new file mode 100755
index 0000000..30c5b8b
--- /dev/null
+++ b/test/src/org/apache/cordova/test/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;
+
+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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/loading.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/loading.java b/test/src/org/apache/cordova/test/loading.java
new file mode 100755
index 0000000..b1b08ae
--- /dev/null
+++ b/test/src/org/apache/cordova/test/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;
+
+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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/menus.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/menus.java b/test/src/org/apache/cordova/test/menus.java
new file mode 100755
index 0000000..12d5230
--- /dev/null
+++ b/test/src/org/apache/cordova/test/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;
+
+import android.os.Bundle;
+import android.view.ContextMenu;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ContextMenu.ContextMenuInfo;
+
+import org.apache.cordova.*;
+import org.apache.cordova.LOG;
+
+public class menus extends 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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/splashscreen.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/splashscreen.java b/test/src/org/apache/cordova/test/splashscreen.java
new file mode 100755
index 0000000..ef49d73
--- /dev/null
+++ b/test/src/org/apache/cordova/test/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;
+
+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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/tests.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/tests.java b/test/src/org/apache/cordova/test/tests.java
new file mode 100755
index 0000000..80c7f24
--- /dev/null
+++ b/test/src/org/apache/cordova/test/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;
+
+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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/timeout.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/timeout.java b/test/src/org/apache/cordova/test/timeout.java
new file mode 100755
index 0000000..31edb8d
--- /dev/null
+++ b/test/src/org/apache/cordova/test/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;
+
+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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/userwebview.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/userwebview.java b/test/src/org/apache/cordova/test/userwebview.java
new file mode 100755
index 0000000..ff04abc
--- /dev/null
+++ b/test/src/org/apache/cordova/test/userwebview.java
@@ -0,0 +1,76 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova.test;
+
+import android.os.Bundle;
+import com.amazon.android.webkit.AmazonGeolocationPermissions.Callback;
+import org.apache.cordova.*;
+
+import com.amazon.android.webkit.AmazonWebView;
+
+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()");
+ }
+
+ 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(AmazonWebView view, String url) {
+ LOG.d("userwebview", "shouldOverrideUrlLoading(" + url + ")");
+ return super.shouldOverrideUrlLoading(view, url);
+ }
+
+ @Override
+ public void onReceivedError(AmazonWebView 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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/whitelist.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/whitelist.java b/test/src/org/apache/cordova/test/whitelist.java
new file mode 100755
index 0000000..518b52b
--- /dev/null
+++ b/test/src/org/apache/cordova/test/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;
+
+import android.os.Bundle;
+
+import org.apache.cordova.*;
+
+import com.amazon.android.webkit.AmazonWebView;
+
+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(AmazonWebView 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-amazon-fireos/blob/f768066d/test/src/org/apache/cordova/test/xhr.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/xhr.java b/test/src/org/apache/cordova/test/xhr.java
new file mode 100755
index 0000000..402e0ad
--- /dev/null
+++ b/test/src/org/apache/cordova/test/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;
+
+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");
+ }
+}