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/06/07 22:20:55 UTC
[32/50] [abbrv] android commit: CB-369: Authentication Code doesn't
seem to work. -- Verified basic auth works and provided test case.
CB-369: Authentication Code doesn't seem to work. -- Verified basic auth works and provided test case.
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/2fbb9c28
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/2fbb9c28
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/2fbb9c28
Branch: refs/heads/master
Commit: 2fbb9c285d52ce9ffd43359fa25e95edad074b13
Parents: 47d99e5
Author: Bryce Curtis <cu...@gmail.com>
Authored: Wed May 16 15:13:42 2012 -0500
Committer: Bryce Curtis <cu...@gmail.com>
Committed: Wed May 16 15:13:42 2012 -0500
----------------------------------------------------------------------
test/AndroidManifest.xml | 3 +
test/assets/www/basicauth/index.html | 42 ++++++++++++++++
test/assets/www/index.html | 33 +++++++------
test/src/org/apache/cordova/test/basicauth.java | 46 ++++++++++++++++++
4 files changed, 108 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/2fbb9c28/test/AndroidManifest.xml
----------------------------------------------------------------------
diff --git a/test/AndroidManifest.xml b/test/AndroidManifest.xml
old mode 100644
new mode 100755
index b8038c7..4918fe5
--- a/test/AndroidManifest.xml
+++ b/test/AndroidManifest.xml
@@ -144,5 +144,8 @@
<activity android:name="xhr" android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden">
</activity>
+ <activity android:name="basicauth" android:label="@string/app_name"
+ android:configChanges="orientation|keyboardHidden">
+ </activity>
</application>
</manifest>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/2fbb9c28/test/assets/www/basicauth/index.html
----------------------------------------------------------------------
diff --git a/test/assets/www/basicauth/index.html b/test/assets/www/basicauth/index.html
new file mode 100755
index 0000000..02ff0b2
--- /dev/null
+++ b/test/assets/www/basicauth/index.html
@@ -0,0 +1,42 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <meta name="viewport" content="width=320; user-scalable=no" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
+ <title>Cordova Tests</title>
+ <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../main.js"></script>
+ </head>
+ <body onload="init();" id="stage" class="theme">
+ <h1>Basic Auth</h1>
+ <div id="info">
+ <h4>Platform: <span id="platform"> </span>, Version: <span id="version"> </span></h4>
+ <h4>UUID: <span id="uuid"> </span>, Name: <span id="name"> </span></h4>
+ <h4>Width: <span id="width"> </span>, Height: <span id="height">
+ </span>, Color Depth: <span id="colorDepth"></span></h4>
+ </div>
+ <div id="info">
+ Loading link below should be successful and show page indicating username=test & password=test. <br>
+ </div>
+ <a href="http://browserspy.dk/password-ok.php" class="btn large">Test password</a>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/2fbb9c28/test/assets/www/index.html
----------------------------------------------------------------------
diff --git a/test/assets/www/index.html b/test/assets/www/index.html
index 0fd4eaf..6838156 100755
--- a/test/assets/www/index.html
+++ b/test/assets/www/index.html
@@ -1,20 +1,20 @@
<!--
- Licensed to the Apache Software Foundation (ASF) under one$
- or more contributor license agreements. See the NOTICE file$
- distributed with this work for additional information$
- regarding copyright ownership. The ASF licenses this file$
- to you under the Apache License, Version 2.0 (the$
- "License"); you may not use this file except in compliance$
- with the License. You may obtain a copy of the License at$
-$
- http://www.apache.org/licenses/LICENSE-2.0$
-$
- Unless required by applicable law or agreed to in writing,$
- software distributed under the License is distributed on an$
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY$
- KIND, either express or implied. See the License for the$
- specific language governing permissions and limitations$
- under the License.$
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
-->
<!DOCTYPE HTML>
<html>
@@ -49,6 +49,7 @@ $
</div>
<button class="btn large" onclick="startActivity('org.apache.cordova.test.jqmtabbackbutton');">Backbutton jQM tab</button>
<button class="btn large" onclick="startActivity('org.apache.cordova.test.backbuttonmultipage');">Backbutton with multiple pages</button>
+ <button class="btn large" onclick="startActivity('org.apache.cordova.test.basicauth');">Basic Authentication</button>
<button class="btn large" onclick="startActivity('org.apache.cordova.test.errorurl');">Error URL</button>
<button class="btn large" onclick="startActivity('org.apache.cordova.test.htmlnotfound');">HTML not found</button>
<button class="btn large" onclick="startActivity('org.apache.cordova.test.iframe');">IFrame</button>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/2fbb9c28/test/src/org/apache/cordova/test/basicauth.java
----------------------------------------------------------------------
diff --git a/test/src/org/apache/cordova/test/basicauth.java b/test/src/org/apache/cordova/test/basicauth.java
new file mode 100755
index 0000000..4007c97
--- /dev/null
+++ b/test/src/org/apache/cordova/test/basicauth.java
@@ -0,0 +1,46 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+package org.apache.cordova.test;
+
+import android.os.Bundle;
+import android.webkit.WebView;
+
+import org.apache.cordova.*;
+import org.apache.cordova.api.LOG;
+
+public class basicauth extends DroidGap {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ super.init();
+
+ // LogCat: onReceivedHttpAuthRequest(browserspy.dk:80,BrowserSpy.dk - HTTP Password Test)
+ AuthenticationToken token = new AuthenticationToken();
+ token.setUserName("test");
+ token.setPassword("test");
+ super.setAuthenticationToken(token, "browserspy.dk:80", "BrowserSpy.dk - HTTP Password Test");
+
+ // Add web site to whitelist
+ super.appView.addWhiteListEntry("http://browserspy.dk*", true);
+
+ // Load test
+ super.loadUrl("file:///android_asset/www/basicauth/index.html");
+ }
+
+}