mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 12:03:28 +08:00
Working on tests
This commit is contained in:
parent
43df9f6b9c
commit
59f9b6f359
@ -1,10 +1,50 @@
|
|||||||
package org.apache.cordova.test;
|
package org.apache.cordova.test;
|
||||||
|
|
||||||
|
import org.apache.cordova.CordovaWebView;
|
||||||
|
|
||||||
import android.test.ActivityInstrumentationTestCase2;
|
import android.test.ActivityInstrumentationTestCase2;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
public class LoadTimeoutTest extends ActivityInstrumentationTestCase2<loading> {
|
public class LoadTimeoutTest extends ActivityInstrumentationTestCase2<loading> {
|
||||||
|
private loading testActivity;
|
||||||
|
private FrameLayout containerView;
|
||||||
|
private LinearLayout innerContainer;
|
||||||
|
private CordovaWebView testView;
|
||||||
|
private long TIMEOUT = 1000;
|
||||||
|
|
||||||
public LoadTimeoutTest()
|
public LoadTimeoutTest()
|
||||||
{
|
{
|
||||||
super("org.apache.cordova.test",loading.class);
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,27 @@
|
|||||||
package org.apache.cordova.test;
|
package org.apache.cordova.test;
|
||||||
|
|
||||||
|
import org.apache.cordova.CordovaWebView;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
import android.test.ActivityInstrumentationTestCase2;
|
import android.test.ActivityInstrumentationTestCase2;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
public class SplashscreenTest extends ActivityInstrumentationTestCase2<splashscreen> {
|
public class SplashscreenTest extends ActivityInstrumentationTestCase2<splashscreen> {
|
||||||
|
|
||||||
|
private splashscreen testActivity;
|
||||||
|
private Dialog containerView;
|
||||||
|
|
||||||
public SplashscreenTest()
|
public SplashscreenTest()
|
||||||
{
|
{
|
||||||
super("org.apache.cordova.test",splashscreen.class);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user