incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject [14/50] [abbrv] android commit: Working on tests
Date Thu, 07 Jun 2012 20:20:54 GMT
Working on tests


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

Branch: refs/heads/master
Commit: 59f9b6f3593053dd2eb87f706c4dd4883aec0cb9
Parents: 43df9f6
Author: Joe Bowser <bowserj@apache.org>
Authored: Wed May 30 13:33:07 2012 -0700
Committer: Joe Bowser <bowserj@apache.org>
Committed: Wed May 30 13:33:07 2012 -0700

----------------------------------------------------------------------
 .../org/apache/cordova/test/HtmlNotFoundTest.java  |    2 +-
 .../org/apache/cordova/test/LoadTimeoutTest.java   |   42 ++++++++++++++-
 .../org/apache/cordova/test/SplashscreenTest.java  |   15 +++++
 3 files changed, 57 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/59f9b6f3/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
index 15bb72a..89eb195 100644
--- a/test/src/org/apache/cordova/test/HtmlNotFoundTest.java
+++ b/test/src/org/apache/cordova/test/HtmlNotFoundTest.java
@@ -25,7 +25,7 @@ public class HtmlNotFoundTest extends ActivityInstrumentationTestCase2<htmlnotfo
     containerView = (FrameLayout) testActivity.findViewById(android.R.id.content);
     innerContainer = (LinearLayout) containerView.getChildAt(0);
     testView = (CordovaWebView) innerContainer.getChildAt(0);
-}
+  }
 
   public void testPreconditions(){
     assertNotNull(innerContainer);

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/59f9b6f3/test/src/org/apache/cordova/test/LoadTimeoutTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/LoadTimeoutTest.java b/test/src/org/apache/cordova/test/LoadTimeoutTest.java
index e161058..1978f7e 100644
--- a/test/src/org/apache/cordova/test/LoadTimeoutTest.java
+++ b/test/src/org/apache/cordova/test/LoadTimeoutTest.java
@@ -1,10 +1,50 @@
 package org.apache.cordova.test;
 
+import org.apache.cordova.CordovaWebView;
+
 import android.test.ActivityInstrumentationTestCase2;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
 
 public class LoadTimeoutTest extends ActivityInstrumentationTestCase2<loading> {
-  public LoadTimeoutTest()
+  private loading testActivity;
+  private FrameLayout containerView;
+  private LinearLayout innerContainer;
+  private CordovaWebView testView;
+  private long TIMEOUT = 1000;
+
+public LoadTimeoutTest()
   {
     super("org.apache.cordova.test",loading.class);
   }
+  
+  protected void setUp() throws Exception {
+      super.setUp();
+      testActivity = this.getActivity();
+      containerView = (FrameLayout) testActivity.findViewById(android.R.id.content);
+      innerContainer = (LinearLayout) containerView.getChildAt(0);
+      testView = (CordovaWebView) innerContainer.getChildAt(0);
+    }
+
+    public void testPreconditions(){
+      assertNotNull(innerContainer);
+      assertNotNull(testView);
+    }
+
+    public void testUrl()
+    {
+        sleep();
+        String good_url = "http://www.google.com";
+        String url = testView.getUrl();
+        assertNotNull(url);
+        assertFalse(url.equals(good_url));
+    }
+
+    private void sleep() {
+        try {
+          Thread.sleep(TIMEOUT );
+        } catch (InterruptedException e) {
+          fail("Unexpected Timeout");
+        }
+      }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/59f9b6f3/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
index 2935991..9d81c2c 100644
--- a/test/src/org/apache/cordova/test/SplashscreenTest.java
+++ b/test/src/org/apache/cordova/test/SplashscreenTest.java
@@ -1,12 +1,27 @@
 package org.apache.cordova.test;
 
+import org.apache.cordova.CordovaWebView;
+
+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);
+    }
 
 }


Mime
View raw message