diff --git a/test/src/org/apache/cordova/test/CordovaTest.java b/test/src/org/apache/cordova/test/CordovaTest.java index 22c5b4be..8dd409c6 100644 --- a/test/src/org/apache/cordova/test/CordovaTest.java +++ b/test/src/org/apache/cordova/test/CordovaTest.java @@ -49,6 +49,8 @@ public class CordovaTest extends } public void testForCordovaView() { + //Sleep for no reason!!!! + sleep(); String className = testView.getClass().getSimpleName(); assertTrue(className.equals("CordovaWebView")); } diff --git a/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java b/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java index 4f832830..ee651906 100644 --- a/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java +++ b/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java @@ -25,6 +25,7 @@ import java.util.concurrent.Executors; import org.apache.cordova.CordovaWebView; import org.apache.cordova.api.CordovaInterface; import org.apache.cordova.api.CordovaPlugin; +import org.apache.cordova.api.LOG; import org.apache.cordova.test.R; import org.apache.cordova.test.R.id; 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() { return this; } @@ -95,4 +88,17 @@ public class CordovaWebViewTestActivity extends Activity implements CordovaInter // TODO Auto-generated method stub 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(); + } + } } \ No newline at end of file