1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/basictypes.h"
6 #include "net/http/http_auth_sspi_win.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace net {
10
MatchDomainUserAfterSplit(const std::wstring & combined,const std::wstring & expected_domain,const std::wstring & expected_user)11 void MatchDomainUserAfterSplit(const std::wstring& combined,
12 const std::wstring& expected_domain,
13 const std::wstring& expected_user) {
14 std::wstring actual_domain;
15 std::wstring actual_user;
16 SplitDomainAndUser(combined, &actual_domain, &actual_user);
17 EXPECT_EQ(expected_domain, actual_domain);
18 EXPECT_EQ(expected_user, actual_user);
19 }
20
TEST(HttpAuthHandlerSspiWinTest,SplitUserAndDomain)21 TEST(HttpAuthHandlerSspiWinTest, SplitUserAndDomain) {
22 MatchDomainUserAfterSplit(L"foobar", L"", L"foobar");
23 MatchDomainUserAfterSplit(L"FOO\\bar", L"FOO", L"bar");
24 }
25
26 } // namespace net
27