cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From csantan...@apache.org
Subject android commit: fix HtmlNotFoundTest so that it passes when file not found is handled correctly This Closes #256
Date Mon, 01 Feb 2016 21:12:50 GMT
Repository: cordova-android
Updated Branches:
  refs/heads/master 088140aca -> 2ac191fbb


fix HtmlNotFoundTest so that it passes when file not found is handled correctly
This Closes #256


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/2ac191fb
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/2ac191fb
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/2ac191fb

Branch: refs/heads/master
Commit: 2ac191fbb851cf0c75908522ec4fd5f81adce67c
Parents: 088140a
Author: Tony Homer <tony.homer@intel.com>
Authored: Fri Jan 29 21:28:07 2016 -0500
Committer: Carlos Santana <csantana23@gmail.com>
Committed: Mon Feb 1 16:11:17 2016 -0500

----------------------------------------------------------------------
 .../src/org/apache/cordova/test/HtmlNotFoundTest.java     | 10 ++++++++--
 .../org/apache/cordova/test/BaseTestCordovaActivity.java  |  6 ++++++
 2 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/2ac191fb/test/androidTest/src/org/apache/cordova/test/HtmlNotFoundTest.java
----------------------------------------------------------------------
diff --git a/test/androidTest/src/org/apache/cordova/test/HtmlNotFoundTest.java b/test/androidTest/src/org/apache/cordova/test/HtmlNotFoundTest.java
index 235e0af..3f92919 100644
--- a/test/androidTest/src/org/apache/cordova/test/HtmlNotFoundTest.java
+++ b/test/androidTest/src/org/apache/cordova/test/HtmlNotFoundTest.java
@@ -30,11 +30,17 @@ public class HtmlNotFoundTest extends BaseCordovaIntegrationTest {
   }
   public void testUrl() throws Throwable
   {
-      assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
       runTestOnUiThread(new Runnable() {
           public void run() {
-              assertFalse(START_URL.equals(testActivity.getCordovaWebView().getUrl()));
+              assertTrue(START_URL.equals(testActivity.getCordovaWebView().getUrl()));
           }
       });
+
+      //loading a not-found file causes an application error and displayError is called
+      //the test activity overrides displayError to add message to onPageFinishedUrl
+      String message = testActivity.onPageFinishedUrl.take();
+      assertTrue(message.contains(START_URL));
+      assertTrue(message.contains("ERR_FILE_NOT_FOUND"));
   }
+
 }

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/2ac191fb/test/src/org/apache/cordova/test/BaseTestCordovaActivity.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/BaseTestCordovaActivity.java b/test/src/org/apache/cordova/test/BaseTestCordovaActivity.java
index 0a28036..0c50569 100644
--- a/test/src/org/apache/cordova/test/BaseTestCordovaActivity.java
+++ b/test/src/org/apache/cordova/test/BaseTestCordovaActivity.java
@@ -47,4 +47,10 @@ public class BaseTestCordovaActivity extends CordovaActivity {
         return appView;
     }
 
+    // By default, displayError shows a dialog, but for tests we just add the message to
the queue
+    @Override
+    public void displayError(String title, String message, String button, boolean exit) {
+        onPageFinishedUrl.add(message);
+    }
+
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message