mirror of
https://github.com/apache/cordova-android.git
synced 2025-03-16 00:11:03 +08:00
Two automated tests completed
This commit is contained in:
parent
e35a8de4bb
commit
5edb3acad5
@ -8,6 +8,7 @@ import android.widget.LinearLayout;
|
|||||||
|
|
||||||
public class ErrorUrlTest extends ActivityInstrumentationTestCase2<errorurl> {
|
public class ErrorUrlTest extends ActivityInstrumentationTestCase2<errorurl> {
|
||||||
|
|
||||||
|
private int TIMEOUT = 1000;
|
||||||
errorurl testActivity;
|
errorurl testActivity;
|
||||||
private FrameLayout containerView;
|
private FrameLayout containerView;
|
||||||
private LinearLayout innerContainer;
|
private LinearLayout innerContainer;
|
||||||
@ -33,9 +34,21 @@ public class ErrorUrlTest extends ActivityInstrumentationTestCase2<errorurl> {
|
|||||||
|
|
||||||
public void testUrl()
|
public void testUrl()
|
||||||
{
|
{
|
||||||
|
sleep();
|
||||||
String good_url = "file:///android_asset/www/htmlnotfound/error.html";
|
String good_url = "file:///android_asset/www/htmlnotfound/error.html";
|
||||||
String url = testView.getUrl();
|
String url = testView.getUrl();
|
||||||
|
assertNotNull(url);
|
||||||
assertTrue(url.equals(good_url));
|
assertTrue(url.equals(good_url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void sleep() {
|
||||||
|
try {
|
||||||
|
Thread.sleep(TIMEOUT);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
fail("Unexpected Timeout");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import android.widget.LinearLayout;
|
|||||||
|
|
||||||
public class HtmlNotFoundTest extends ActivityInstrumentationTestCase2<htmlnotfound> {
|
public class HtmlNotFoundTest extends ActivityInstrumentationTestCase2<htmlnotfound> {
|
||||||
|
|
||||||
|
private int TIMEOUT = 1000;
|
||||||
private htmlnotfound testActivity;
|
private htmlnotfound testActivity;
|
||||||
private FrameLayout containerView;
|
private FrameLayout containerView;
|
||||||
private LinearLayout innerContainer;
|
private LinearLayout innerContainer;
|
||||||
@ -27,15 +27,26 @@ public class HtmlNotFoundTest extends ActivityInstrumentationTestCase2<htmlnotfo
|
|||||||
testView = (CordovaWebView) innerContainer.getChildAt(0);
|
testView = (CordovaWebView) innerContainer.getChildAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPreconditions(){
|
public void testPreconditions(){
|
||||||
assertNotNull(innerContainer);
|
assertNotNull(innerContainer);
|
||||||
assertNotNull(testView);
|
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user