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:19:01 GMT
Repository: cordova-android
Updated Branches:
  refs/heads/5.1.x f76653016 -> 2edb4c09c


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/2edb4c09
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/2edb4c09
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/2edb4c09

Branch: refs/heads/5.1.x
Commit: 2edb4c09cfdec789fc980a421f9f57b7f0e9ccb7
Parents: f766530
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:15:05 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/2edb4c09/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/2edb4c09/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