cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [01/17] added fireos code from https://github.com/archananaik/cordova-amazon-fireos sans history
Date Mon, 25 Nov 2013 23:43:34 GMT
Updated Branches:
  refs/heads/master 29be45368 -> b3b7c0b9d


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/ErrorUrlTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/ErrorUrlTest.java b/test/src/org/apache/cordova/test/ErrorUrlTest.java
new file mode 100644
index 0000000..35f6a92
--- /dev/null
+++ b/test/src/org/apache/cordova/test/ErrorUrlTest.java
@@ -0,0 +1,79 @@
+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;
+
+	private AmazonWebViewOnUiThread mUiThread;
+
+	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);
+		mUiThread = new AmazonWebViewOnUiThread(this, testView);
+	}
+
+	public void testPreconditions() {
+		assertNotNull(innerContainer);
+		assertNotNull(testView);
+	}
+
+	// This will fail for AWV because the current url on a wrong page will
+	// return the URL used to load
+	public void testUrl() {
+		mUiThread.loadUrl("file:///android_asset/www/htmlnotfound/index.html");
+		sleep();
+		String good_url = "file:///android_asset/www/error.html";
+		String url = mUiThread.getUrl();
+		assertNotNull(url);
+		assertTrue(url.equals(good_url));
+	}
+
+	private void sleep() {
+		try {
+			Thread.sleep(TIMEOUT);
+		} catch (InterruptedException e) {
+			fail("Unexpected Timeout");
+		}
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/FixWebView.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/FixWebView.java b/test/src/org/apache/cordova/test/FixWebView.java
new file mode 100755
index 0000000..ac911ec
--- /dev/null
+++ b/test/src/org/apache/cordova/test/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;
+
+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/b3b7c0b9/test/src/org/apache/cordova/test/GapClientTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/GapClientTest.java b/test/src/org/apache/cordova/test/GapClientTest.java
new file mode 100644
index 0000000..a3c2a62
--- /dev/null
+++ b/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.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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/HtmlNotFoundTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/HtmlNotFoundTest.java b/test/src/org/apache/cordova/test/HtmlNotFoundTest.java
new file mode 100644
index 0000000..daf6af2
--- /dev/null
+++ b/test/src/org/apache/cordova/test/HtmlNotFoundTest.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.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/b3b7c0b9/test/src/org/apache/cordova/test/IFrameTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/IFrameTest.java b/test/src/org/apache/cordova/test/IFrameTest.java
new file mode 100644
index 0000000..d8adcfc
--- /dev/null
+++ b/test/src/org/apache/cordova/test/IFrameTest.java
@@ -0,0 +1,94 @@
+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.util.Purity;
+import org.apache.cordova.test.actions.iframe;
+
+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/b3b7c0b9/test/src/org/apache/cordova/test/LifecycleTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/LifecycleTest.java b/test/src/org/apache/cordova/test/LifecycleTest.java
new file mode 100644
index 0000000..396036d
--- /dev/null
+++ b/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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/MenuTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/MenuTest.java b/test/src/org/apache/cordova/test/MenuTest.java
new file mode 100644
index 0000000..1486cca
--- /dev/null
+++ b/test/src/org/apache/cordova/test/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;
+
+import org.apache.cordova.test.actions.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/b3b7c0b9/test/src/org/apache/cordova/test/PluginManagerTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/PluginManagerTest.java b/test/src/org/apache/cordova/test/PluginManagerTest.java
new file mode 100644
index 0000000..c767e7d
--- /dev/null
+++ b/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.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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/SplashscreenTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/SplashscreenTest.java b/test/src/org/apache/cordova/test/SplashscreenTest.java
new file mode 100644
index 0000000..edb8758
--- /dev/null
+++ b/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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/UserWebViewTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/UserWebViewTest.java b/test/src/org/apache/cordova/test/UserWebViewTest.java
new file mode 100644
index 0000000..e7a240a
--- /dev/null
+++ b/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 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/b3b7c0b9/test/src/org/apache/cordova/test/XhrTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/XhrTest.java b/test/src/org/apache/cordova/test/XhrTest.java
new file mode 100644
index 0000000..7c3ed9f
--- /dev/null
+++ b/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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/CordovaActivity.java b/test/src/org/apache/cordova/test/actions/CordovaActivity.java
new file mode 100644
index 0000000..f709737
--- /dev/null
+++ b/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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/CordovaDriverAction.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/CordovaDriverAction.java b/test/src/org/apache/cordova/test/actions/CordovaDriverAction.java
new file mode 100644
index 0000000..2021346
--- /dev/null
+++ b/test/src/org/apache/cordova/test/actions/CordovaDriverAction.java
@@ -0,0 +1,87 @@
+/*
+       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.CordovaInterface;
+import org.apache.cordova.CordovaPlugin;
+
+import com.amazon.android.webkit.AmazonWebKitFactories;
+import com.amazon.android.webkit.AmazonWebKitFactory;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+
+
+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;
+    }
+
+    @Override
+    public AmazonWebKitFactory getFactory() {
+        return AmazonWebKitFactories.getDefaultFactory();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java b/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java
new file mode 100644
index 0000000..b96e48f
--- /dev/null
+++ b/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java
@@ -0,0 +1,112 @@
+/*
+       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.CordovaInterface;
+import org.apache.cordova.CordovaPlugin;
+import org.apache.cordova.LOG;
+import org.apache.cordova.test.R;
+import org.apache.cordova.test.R.id;
+import org.apache.cordova.test.R.layout;
+
+import com.amazon.android.webkit.AmazonWebKitFactories;
+import com.amazon.android.webkit.AmazonWebKitFactory;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+
+public class CordovaWebViewTestActivity extends Activity implements CordovaInterface {
+    public 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.handleDestroy();
+        }
+    }
+
+    @Override
+    public AmazonWebKitFactory getFactory() {
+        return AmazonWebKitFactories.getDefaultFactory();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/backbuttonmultipage.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/backbuttonmultipage.java b/test/src/org/apache/cordova/test/actions/backbuttonmultipage.java
new file mode 100755
index 0000000..3b90484
--- /dev/null
+++ b/test/src/org/apache/cordova/test/actions/backbuttonmultipage.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 backbuttonmultipage extends DroidGap {
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        super.loadUrl("file:///android_asset/www/backbuttonmultipage/index.html");
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/background.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/background.java b/test/src/org/apache/cordova/test/actions/background.java
new file mode 100755
index 0000000..47c6bc7
--- /dev/null
+++ b/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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/backgroundcolor.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/backgroundcolor.java b/test/src/org/apache/cordova/test/actions/backgroundcolor.java
new file mode 100755
index 0000000..d501824
--- /dev/null
+++ b/test/src/org/apache/cordova/test/actions/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.actions;
+
+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");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/basicauth.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/basicauth.java b/test/src/org/apache/cordova/test/actions/basicauth.java
new file mode 100755
index 0000000..ad739c9
--- /dev/null
+++ b/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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/errorurl.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/errorurl.java b/test/src/org/apache/cordova/test/actions/errorurl.java
new file mode 100755
index 0000000..8015c4f
--- /dev/null
+++ b/test/src/org/apache/cordova/test/actions/errorurl.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 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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/fullscreen.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/fullscreen.java b/test/src/org/apache/cordova/test/actions/fullscreen.java
new file mode 100755
index 0000000..60726ad
--- /dev/null
+++ b/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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/htmlnotfound.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/htmlnotfound.java b/test/src/org/apache/cordova/test/actions/htmlnotfound.java
new file mode 100755
index 0000000..da849e0
--- /dev/null
+++ b/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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/iframe.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/iframe.java b/test/src/org/apache/cordova/test/actions/iframe.java
new file mode 100755
index 0000000..3398aa4
--- /dev/null
+++ b/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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/lifecycle.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/lifecycle.java b/test/src/org/apache/cordova/test/actions/lifecycle.java
new file mode 100755
index 0000000..8419b0e
--- /dev/null
+++ b/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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/loading.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/loading.java b/test/src/org/apache/cordova/test/actions/loading.java
new file mode 100755
index 0000000..4c52c9f
--- /dev/null
+++ b/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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/menus.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/menus.java b/test/src/org/apache/cordova/test/actions/menus.java
new file mode 100755
index 0000000..c4cb674
--- /dev/null
+++ b/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.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/b3b7c0b9/test/src/org/apache/cordova/test/actions/splashscreen.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/splashscreen.java b/test/src/org/apache/cordova/test/actions/splashscreen.java
new file mode 100755
index 0000000..3d924e0
--- /dev/null
+++ b/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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/tests.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/tests.java b/test/src/org/apache/cordova/test/actions/tests.java
new file mode 100755
index 0000000..bc326e3
--- /dev/null
+++ b/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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/timeout.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/timeout.java b/test/src/org/apache/cordova/test/actions/timeout.java
new file mode 100755
index 0000000..22c0881
--- /dev/null
+++ b/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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/actions/userwebview.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/userwebview.java b/test/src/org/apache/cordova/test/actions/userwebview.java
new file mode 100755
index 0000000..2beb793
--- /dev/null
+++ b/test/src/org/apache/cordova/test/actions/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.actions;
+
+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/b3b7c0b9/test/src/org/apache/cordova/test/actions/whitelist.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/whitelist.java b/test/src/org/apache/cordova/test/actions/whitelist.java
new file mode 100755
index 0000000..85a4dcb
--- /dev/null
+++ b/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 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/b3b7c0b9/test/src/org/apache/cordova/test/actions/xhr.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/xhr.java b/test/src/org/apache/cordova/test/actions/xhr.java
new file mode 100755
index 0000000..3695c11
--- /dev/null
+++ b/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-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/util/PollingCheck.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/util/PollingCheck.java b/test/src/org/apache/cordova/test/util/PollingCheck.java
new file mode 100644
index 0000000..9d4d559
--- /dev/null
+++ b/test/src/org/apache/cordova/test/util/PollingCheck.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed 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.util;
+
+import java.util.concurrent.Callable;
+
+import junit.framework.Assert;
+
+public abstract class PollingCheck {
+	private static final long TIME_SLICE = 50;
+	private long mTimeout = 3000;
+
+	public PollingCheck() {
+	}
+
+	public PollingCheck(long timeout) {
+		mTimeout = timeout;
+	}
+
+	protected abstract boolean check();
+
+	public void run() {
+		if (check()) {
+			return;
+		}
+
+		long timeout = mTimeout;
+		while (timeout > 0) {
+			try {
+				Thread.sleep(TIME_SLICE);
+			} catch (InterruptedException e) {
+				Assert.fail("unexpected InterruptedException");
+			}
+
+			if (check()) {
+				return;
+			}
+
+			timeout -= TIME_SLICE;
+		}
+
+		Assert.fail("unexpected timeout");
+	}
+
+	public static void check(CharSequence message, long timeout,
+			Callable<Boolean> condition) throws Exception {
+		while (timeout > 0) {
+			if (condition.call()) {
+				return;
+			}
+
+			Thread.sleep(TIME_SLICE);
+			timeout -= TIME_SLICE;
+		}
+
+		Assert.fail(message.toString());
+	}
+}

http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/b3b7c0b9/test/src/org/apache/cordova/test/util/Purity.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/util/Purity.java b/test/src/org/apache/cordova/test/util/Purity.java
new file mode 100644
index 0000000..ec6ac79
--- /dev/null
+++ b/test/src/org/apache/cordova/test/util/Purity.java
@@ -0,0 +1,171 @@
+/*
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+*/
+
+/*
+ * Purity is a small set of Android utility methods that allows us to simulate touch events on 
+ * Android applications.  This is important for simulating some of the most annoying tests.
+ */
+
+package org.apache.cordova.test.util;
+
+import android.app.Instrumentation;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Picture;
+import android.os.SystemClock;
+import android.util.DisplayMetrics;
+import android.view.MotionEvent;
+
+import com.amazon.android.webkit.AmazonWebView;
+
+public class Purity {
+
+    Instrumentation inst;
+    int width, height;
+    float density;
+    Bitmap state;
+    boolean fingerDown = false;
+   
+    public Purity(Context ctx, Instrumentation i)
+    {
+        inst = i;
+        DisplayMetrics display = ctx.getResources().getDisplayMetrics();
+        density = display.density;
+        width = display.widthPixels;
+        height = display.heightPixels;
+        
+    }
+    
+    /*
+     * WebKit doesn't give you real pixels anymore, this is done for subpixel fonts to appear on
+     * iOS and Android.  However, Android automation requires real pixels
+     */
+    private int getRealCoord(int coord)
+    {
+        return (int) (coord * density);
+    }
+
+    public int getViewportWidth()
+    {
+        return (int) (width/density);
+    }
+    
+    public int getViewportHeight()
+    {
+        return (int) (height/density);
+    }
+    
+    public void touch(int x, int y)
+    {
+        int realX = getRealCoord(x);
+        int realY = getRealCoord(y);
+        long downTime = SystemClock.uptimeMillis();
+        // event time MUST be retrieved only by this way!
+        long eventTime = SystemClock.uptimeMillis();
+        if(!fingerDown)
+        {
+            MotionEvent downEvent = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, realX, realY, 0);
+            inst.sendPointerSync(downEvent);
+        }
+        MotionEvent upEvent = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP, realX, realY, 0);
+        inst.sendPointerSync(upEvent);
+    }
+    
+    public void touchStart(int x, int y)
+    {
+        int realX = getRealCoord(x);
+        int realY = getRealCoord(y);
+        long downTime = SystemClock.uptimeMillis();
+        // event time MUST be retrieved only by this way!
+        long eventTime = SystemClock.uptimeMillis();
+        MotionEvent event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, realX, realY, 0);
+        inst.sendPointerSync(event);
+        fingerDown = true;
+    }
+    
+    //Move from the touch start
+    public void touchMove(int x, int y)
+    {
+        if(!fingerDown)
+            touchStart(x,y);
+        else
+        {
+            int realX = getRealCoord(x);
+            int realY = getRealCoord(y);
+            long downTime = SystemClock.uptimeMillis();
+            // event time MUST be retrieved only by this way!
+            long eventTime = SystemClock.uptimeMillis();
+            MotionEvent event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, realX, realY, 0);
+            inst.sendPointerSync(event);
+        }
+    }
+    
+    public void touchEnd(int x, int y)
+    {
+        if(!fingerDown)
+        {
+            touch(x, y);
+        }
+        else
+        {
+            int realX = getRealCoord(x);
+            int realY = getRealCoord(y);
+            long downTime = SystemClock.uptimeMillis();
+            // event time MUST be retrieved only by this way!
+            long eventTime = SystemClock.uptimeMillis();
+            MotionEvent event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, realX, realY, 0);
+            inst.sendPointerSync(event);
+            fingerDown = false;
+        }
+    }
+    
+    public void setBitmap(AmazonWebView view)
+    {
+        Picture p = view.capturePicture();
+        state = Bitmap.createBitmap(p.getWidth(), p.getHeight(), Bitmap.Config.ARGB_8888);
+    }
+    
+    public boolean checkRenderView(AmazonWebView view)
+    {
+        if(state == null)
+        {
+            setBitmap(view);
+            return false;
+        }
+        else
+        {
+            Picture p = view.capturePicture();
+            Bitmap newState = Bitmap.createBitmap(p.getWidth(), p.getHeight(), Bitmap.Config.ARGB_8888);
+            boolean result = newState.equals(state);
+            newState.recycle();
+            return result;
+        }
+    }
+    
+    public void clearBitmap()
+    {
+        if(state != null)
+            state.recycle();
+    }
+    
+    protected void finalize()
+    {
+            clearBitmap();
+    }
+}


Mime
View raw message