summaryrefslogtreecommitdiffstats
path: root/chrome/browser/login_prompt_unittest.cc
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-15 06:43:48 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-15 06:43:48 +0000
commit515838ce76cb8bec7f51f6143cac74f113e247ad (patch)
tree71b70d594974310b35d1c8f7843aeda5717c044b /chrome/browser/login_prompt_unittest.cc
parent92352a66515fd9a01f538529356ad45870109f28 (diff)
downloadchromium_src-515838ce76cb8bec7f51f6143cac74f113e247ad.zip
chromium_src-515838ce76cb8bec7f51f6143cac74f113e247ad.tar.gz
chromium_src-515838ce76cb8bec7f51f6143cac74f113e247ad.tar.bz2
post-winhttp cleanup: refactor net/base/auth_cache into net/ftp/ftp_auth_cache.
Also moves AuthCache::HttpKey() --> GetSignonRealmKey(). Review URL: http://codereview.chromium.org/18218 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8085 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/login_prompt_unittest.cc')
-rw-r--r--chrome/browser/login_prompt_unittest.cc43
1 files changed, 43 insertions, 0 deletions
diff --git a/chrome/browser/login_prompt_unittest.cc b/chrome/browser/login_prompt_unittest.cc
new file mode 100644
index 0000000..e16093a
--- /dev/null
+++ b/chrome/browser/login_prompt_unittest.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/login_prompt.h"
+#include "googleurl/src/gurl.h"
+#include "net/base/auth.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+
+TEST(LoginHandlerTest, GetSignonRealm) {
+ scoped_refptr<net::AuthChallengeInfo> auth_info = new net::AuthChallengeInfo;
+ auth_info->is_proxy = false; // server auth
+ // auth_info->host is intentionally left empty.
+ auth_info->scheme = L"Basic";
+ auth_info->realm = L"WallyWorld";
+
+ std::string url[] = {
+ "https://www.nowhere.org/dir/index.html",
+ "https://www.nowhere.org:443/dir/index.html", // default port
+ "https://www.nowhere.org:8443/dir/index.html", // non-default port
+ "https://www.nowhere.org", // no trailing slash
+ "https://foo:bar@www.nowhere.org/dir/index.html", // username:password
+ "https://www.nowhere.org/dir/index.html?id=965362", // query
+ "https://www.nowhere.org/dir/index.html#toc", // reference
+ };
+
+ std::string expected[] = {
+ "https://www.nowhere.org/WallyWorld",
+ "https://www.nowhere.org/WallyWorld",
+ "https://www.nowhere.org:8443/WallyWorld",
+ "https://www.nowhere.org/WallyWorld",
+ "https://www.nowhere.org/WallyWorld",
+ "https://www.nowhere.org/WallyWorld",
+ "https://www.nowhere.org/WallyWorld"
+ };
+
+ for (size_t i = 0; i < arraysize(url); i++) {
+ std::string key = LoginHandler::GetSignonRealm(GURL(url[i]), *auth_info);
+ EXPECT_EQ(expected[i], key);
+ }
+}
+