summaryrefslogtreecommitdiffstats
path: root/net/http/http_auth_sspi_win_unittest.cc
diff options
context:
space:
mode:
authorcbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-08 14:56:56 +0000
committercbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-08 14:56:56 +0000
commit7da0b3399c137070e5e5b9403428c98f52b9e2c5 (patch)
tree44045ed03614d156f9cc49f9404a3f0820d67d8b /net/http/http_auth_sspi_win_unittest.cc
parent50ada2e97cc6f1c1e0f1bf7ee33ff64a0d28d79a (diff)
downloadchromium_src-7da0b3399c137070e5e5b9403428c98f52b9e2c5.zip
chromium_src-7da0b3399c137070e5e5b9403428c98f52b9e2c5.tar.gz
chromium_src-7da0b3399c137070e5e5b9403428c98f52b9e2c5.tar.bz2
Abstracted and moved common SSPI functionality.
The NTLM and Negotiate authentication schemes follow very similar code paths when using the SSPI API on Windows. BUG=29862 TEST=New unittest, plus manual NTLM Authentication testing. Review URL: http://codereview.chromium.org/505048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35791 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_auth_sspi_win_unittest.cc')
-rwxr-xr-xnet/http/http_auth_sspi_win_unittest.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/net/http/http_auth_sspi_win_unittest.cc b/net/http/http_auth_sspi_win_unittest.cc
new file mode 100755
index 0000000..b421ca9
--- /dev/null
+++ b/net/http/http_auth_sspi_win_unittest.cc
@@ -0,0 +1,26 @@
+// Copyright (c) 2009 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 "base/basictypes.h"
+#include "net/http/http_auth_sspi_win.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace net {
+
+void MatchDomainUserAfterSplit(const std::wstring& combined,
+ const std::wstring& expected_domain,
+ const std::wstring& expected_user) {
+ std::wstring actual_domain;
+ std::wstring actual_user;
+ SplitDomainAndUser(combined, &actual_domain, &actual_user);
+ EXPECT_EQ(expected_domain, actual_domain);
+ EXPECT_EQ(expected_user, actual_user);
+}
+
+TEST(HttpAuthHandlerSspiWinTest, SplitUserAndDomain) {
+ MatchDomainUserAfterSplit(L"foobar", L"", L"foobar");
+ MatchDomainUserAfterSplit(L"FOO\\bar", L"FOO", L"bar");
+}
+
+} // namespace net