mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 03:53:09 +08:00
Fixing up the tests so they crash less.
This commit is contained in:
parent
c416c77d7a
commit
df90bdb350
@ -49,6 +49,8 @@ public class CordovaTest extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testForCordovaView() {
|
public void testForCordovaView() {
|
||||||
|
//Sleep for no reason!!!!
|
||||||
|
sleep();
|
||||||
String className = testView.getClass().getSimpleName();
|
String className = testView.getClass().getSimpleName();
|
||||||
assertTrue(className.equals("CordovaWebView"));
|
assertTrue(className.equals("CordovaWebView"));
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ import java.util.concurrent.Executors;
|
|||||||
import org.apache.cordova.CordovaWebView;
|
import org.apache.cordova.CordovaWebView;
|
||||||
import org.apache.cordova.api.CordovaInterface;
|
import org.apache.cordova.api.CordovaInterface;
|
||||||
import org.apache.cordova.api.CordovaPlugin;
|
import org.apache.cordova.api.CordovaPlugin;
|
||||||
|
import org.apache.cordova.api.LOG;
|
||||||
import org.apache.cordova.test.R;
|
import org.apache.cordova.test.R;
|
||||||
import org.apache.cordova.test.R.id;
|
import org.apache.cordova.test.R.id;
|
||||||
import org.apache.cordova.test.R.layout;
|
import org.apache.cordova.test.R.layout;
|
||||||
@ -52,14 +53,6 @@ public class CordovaWebViewTestActivity extends Activity implements CordovaInter
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDestroy()
|
|
||||||
{
|
|
||||||
super.onDestroy();
|
|
||||||
if (cordovaWebView.pluginManager != null) {
|
|
||||||
cordovaWebView.pluginManager.onDestroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Context getContext() {
|
public Context getContext() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -95,4 +88,17 @@ public class CordovaWebViewTestActivity extends Activity implements CordovaInter
|
|||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return threadPool;
|
return threadPool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
/**
|
||||||
|
* The final call you receive before your activity is destroyed.
|
||||||
|
*/
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
if (cordovaWebView != null) {
|
||||||
|
// Send destroy event to JavaScript
|
||||||
|
cordovaWebView.loadUrl("javascript:try{cordova.require('cordova/channel').onDestroy.fire();}catch(e){console.log('exception firing destroy event from native');};");
|
||||||
|
cordovaWebView.handleDestroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user