Updated Branches:
  refs/heads/master 09b753d09 -> cdaf620f9

CB-582: Automating User WebView/WebViewClient/WebChromeClient 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/cdaf620f
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/cdaf620f
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/cdaf620f

Branch: refs/heads/master
Commit: cdaf620f9241a1aab32c26ab45a04b17b3f2c3a9
Parents: 09b753d
Author: Joe Bowser <[email protected]>
Authored: Thu Jun 14 10:33:32 2012 -0700
Committer: Joe Bowser <[email protected]>
Committed: Thu Jun 14 10:33:32 2012 -0700

----------------------------------------------------------------------
 .../org/apache/cordova/test/UserWebViewTest.java   |   44 +++++++++++++++
 test/src/org/apache/cordova/test/userwebview.java  |    6 ++
 2 files changed, 50 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/cdaf620f/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
index a3f82d8..1ddbbe4 100644
--- a/test/src/org/apache/cordova/test/UserWebViewTest.java
+++ b/test/src/org/apache/cordova/test/UserWebViewTest.java
@@ -1,6 +1,12 @@
 package org.apache.cordova.test;
 
+import org.apache.cordova.CordovaWebView;
+import org.apache.cordova.CordovaWebViewClient;
+import org.apache.cordova.CordovaChromeClient;
+
 import android.test.ActivityInstrumentationTestCase2;
+import android.widget.FrameLayout;
+import android.widget.LinearLayout;
 
 public class UserWebViewTest extends 
ActivityInstrumentationTestCase2<userwebview> {
 
@@ -8,4 +14,42 @@ public class UserWebViewTest extends 
ActivityInstrumentationTestCase2<userwebvie
   {
     super(userwebview.class);
   }
+  
+  private int TIMEOUT = 1000;
+  userwebview testActivity;
+  private FrameLayout containerView;
+  private LinearLayout innerContainer;
+  private CordovaWebView testView;
+  
+
+  
+  protected void setUp() throws Exception {
+      super.setUp();
+      testActivity = this.getActivity();
+      containerView = (FrameLayout) 
testActivity.findViewById(android.R.id.content);
+      innerContainer = (LinearLayout) containerView.getChildAt(0);
+      testView = (CordovaWebView) innerContainer.getChildAt(0);
+  }
+  
+  public void testPreconditions(){
+      assertNotNull(innerContainer);
+      assertNotNull(testView);
+  }
+  
+  public void customTest()
+  {
+    assertTrue(CordovaWebView.class.isInstance(testView));
+    
assertTrue(CordovaWebViewClient.class.isInstance(testActivity.testViewClient));
+    
assertTrue(CordovaChromeClient.class.isInstance(testActivity.testChromeClient));
+  }
+  
+
+  private void sleep() {
+      try {
+        Thread.sleep(TIMEOUT);
+      } catch (InterruptedException e) {
+        fail("Unexpected Timeout");
+      }
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/cdaf620f/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
index 405b474..665689f 100755
--- a/test/src/org/apache/cordova/test/userwebview.java
+++ b/test/src/org/apache/cordova/test/userwebview.java
@@ -26,9 +26,15 @@ import org.apache.cordova.*;
 import org.apache.cordova.api.LOG;
 
 public class userwebview extends DroidGap {
+    
+    public TestViewClient testViewClient;
+    public TestChromeClient testChromeClient;
+    
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+        testViewClient = new TestViewClient(this);
+        testChromeClient = new TestChromeClient(this);
         super.init(new CordovaWebView(this), new TestViewClient(this), new 
TestChromeClient(this));
         super.loadUrl("file:///android_asset/www/userwebview/index.html");
     }

Reply via email to