Fixing up the tests so they crash less.

This commit is contained in:
Joe Bowser 2012-11-19 10:36:26 -08:00
parent c416c77d7a
commit df90bdb350
2 changed files with 16 additions and 8 deletions

View File

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

View File

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