Two automated tests completed

This commit is contained in:
Joe Bowser 2012-05-29 13:42:56 -07:00
parent e35a8de4bb
commit 5edb3acad5
2 changed files with 33 additions and 9 deletions

View File

@ -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");
}
}
}

View File

@ -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));
}
}