You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2012/11/19 19:37:01 UTC
[2/3] android commit: Fixing up the tests so they crash less.
Fixing up the tests so they crash less.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/df90bdb3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/df90bdb3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/df90bdb3
Branch: refs/heads/master
Commit: df90bdb3504995293995e043a674250021457401
Parents: c416c77
Author: Joe Bowser <bo...@apache.org>
Authored: Mon Nov 19 10:36:26 2012 -0800
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Nov 19 10:36:26 2012 -0800
----------------------------------------------------------------------
test/src/org/apache/cordova/test/CordovaTest.java | 2 +
.../test/actions/CordovaWebViewTestActivity.java | 22 +++++++++-----
2 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/df90bdb3/test/src/org/apache/cordova/test/CordovaTest.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/CordovaTest.java b/test/src/org/apache/cordova/test/CordovaTest.java
index 22c5b4b..8dd409c 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"));
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/df90bdb3/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java b/test/src/org/apache/cordova/test/actions/CordovaWebViewTestActivity.java
index 4f83283..ee65190 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