From 4a7f825cfe829a1fd5a92402170fa233ec9211d6 Mon Sep 17 00:00:00 2001 From: Marcel Kinard Date: Fri, 29 Aug 2014 16:38:38 -0400 Subject: [PATCH] CB-7410 Fix Basic Authentication test Looks like the Chromium webview does not include the port number on the hostname during the callback challenge, but the classic webview does include the port number. Handle both cases here. --- test/src/org/apache/cordova/test/basicauth.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/src/org/apache/cordova/test/basicauth.java b/test/src/org/apache/cordova/test/basicauth.java index 1b09f3d5..a0aaa7c1 100755 --- a/test/src/org/apache/cordova/test/basicauth.java +++ b/test/src/org/apache/cordova/test/basicauth.java @@ -21,7 +21,7 @@ package org.apache.cordova.test; import android.os.Bundle; import org.apache.cordova.*; -public class basicauth extends DroidGap { +public class basicauth extends CordovaActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -31,11 +31,13 @@ public class basicauth extends DroidGap { AuthenticationToken token = new AuthenticationToken(); token.setUserName("test"); token.setPassword("test"); - super.setAuthenticationToken(token, "browserspy.dk:80", "BrowserSpy.dk - HTTP Password Test"); + // classic webview includes port in hostname, Chromium webview does not. Handle both here. + // BTW, the realm is optional. + setAuthenticationToken(token, "browserspy.dk:80", "BrowserSpy.dk - HTTP Password Test"); + setAuthenticationToken(token, "browserspy.dk", "BrowserSpy.dk - HTTP Password Test"); // Add web site to whitelist - Config.init(); - Config.addWhiteListEntry("http://browserspy.dk*", true); + Config.getWhitelist().addWhiteListEntry("http://browserspy.dk/*", true); // Load test super.loadUrl("file:///android_asset/www/basicauth/index.html");