incubator-callback-commits mailing list archives

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


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/5edb3aca
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/5edb3aca
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/5edb3aca

Branch: refs/heads/master
Commit: 5edb3acad5a0c5c0f4525788be41b2bd374d9fe0
Parents: e35a8de
Author: Joe Bowser <bowserj@apache.org>
Authored: Tue May 29 13:42:56 2012 -0700
Committer: Joe Bowser <bowserj@apache.org>
Committed: Tue May 29 13:42:56 2012 -0700

----------------------------------------------------------------------
 test/src/org/apache/cordova/test/ErrorUrlTest.java |   13 +++++++
 .../org/apache/cordova/test/HtmlNotFoundTest.java  |   29 ++++++++++-----
 2 files changed, 33 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/5edb3aca/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
index f60b272..59b1742 100644
--- a/test/src/org/apache/cordova/test/ErrorUrlTest.java
+++ b/test/src/org/apache/cordova/test/ErrorUrlTest.java
@@ -8,6 +8,7 @@ import android.widget.LinearLayout;
 
 public class ErrorUrlTest extends ActivityInstrumentationTestCase2<errorurl> {
 
+  private int TIMEOUT = 1000;
   errorurl testActivity;
   private FrameLayout containerView;
   private LinearLayout innerContainer;
@@ -33,9 +34,21 @@ public class ErrorUrlTest extends ActivityInstrumentationTestCase2<errorurl>
{
   
   public void testUrl()
   {
+    sleep();
     String good_url = "file:///android_asset/www/htmlnotfound/error.html";
     String url = testView.getUrl();
+    assertNotNull(url);
     assertTrue(url.equals(good_url));
   }
   
+
+  private void sleep() {
+      try {
+        Thread.sleep(TIMEOUT);
+      } catch (InterruptedException e) {
+        fail("Unexpected Timeout");
+      }
+    }
+
+  
 }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/5edb3aca/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 4dcf57f..15bb72a 100644
--- a/test/src/org/apache/cordova/test/HtmlNotFoundTest.java
+++ b/test/src/org/apache/cordova/test/HtmlNotFoundTest.java
@@ -8,7 +8,7 @@ import android.widget.LinearLayout;
 
 public class HtmlNotFoundTest extends ActivityInstrumentationTestCase2<htmlnotfound>
{
 
-  
+  private int TIMEOUT = 1000;
   private htmlnotfound testActivity;
   private FrameLayout containerView;
   private LinearLayout innerContainer;
@@ -27,15 +27,26 @@ public class HtmlNotFoundTest extends ActivityInstrumentationTestCase2<htmlnotfo
     testView = (CordovaWebView) innerContainer.getChildAt(0);
 }
 
-public void testPreconditions(){
+  public void testPreconditions(){
     assertNotNull(innerContainer);
     assertNotNull(testView);
-}
+  }
+
+  public void testUrl()
+  {
+      sleep();
+      String good_url = "file:///android_asset/www/htmlnotfound/error.html";
+      String url = testView.getUrl();
+      assertNotNull(url);
+      assertFalse(url.equals(good_url));
+  }
+
+  private void sleep() {
+      try {
+        Thread.sleep(TIMEOUT);
+      } catch (InterruptedException e) {
+        fail("Unexpected Timeout");
+      }
+    }
 
-public void testUrl()
-{
-  String good_url = "file:///android_asset/www/htmlnotfound/error.html";
-  String url = testView.getUrl();
-  assertFalse(url.equals(good_url));
-}
 }


Mime
View raw message