Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: net/http/http_auth_sspi_win_unittest.cc

Issue 1513043002: clang/win: Let remaining chromium_code targets build with -Wextra. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/base/network_interfaces_unittest.cc ('k') | net/udp/udp_socket_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "net/base/net_errors.h" 6 #include "net/base/net_errors.h"
7 #include "net/http/http_auth_challenge_tokenizer.h" 7 #include "net/http/http_auth_challenge_tokenizer.h"
8 #include "net/http/http_auth_sspi_win.h" 8 #include "net/http/http_auth_sspi_win.h"
9 #include "net/http/mock_sspi_library_win.h" 9 #include "net/http/mock_sspi_library_win.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 30 matching lines...) Expand all
41 TEST(HttpAuthSSPITest, DetermineMaxTokenLength_Normal) { 41 TEST(HttpAuthSSPITest, DetermineMaxTokenLength_Normal) {
42 SecPkgInfoW package_info; 42 SecPkgInfoW package_info;
43 memset(&package_info, 0x0, sizeof(package_info)); 43 memset(&package_info, 0x0, sizeof(package_info));
44 package_info.cbMaxToken = 1337; 44 package_info.cbMaxToken = 1337;
45 45
46 MockSSPILibrary mock_library; 46 MockSSPILibrary mock_library;
47 mock_library.ExpectQuerySecurityPackageInfo(L"NTLM", SEC_E_OK, &package_info); 47 mock_library.ExpectQuerySecurityPackageInfo(L"NTLM", SEC_E_OK, &package_info);
48 ULONG max_token_length = kMaxTokenLength; 48 ULONG max_token_length = kMaxTokenLength;
49 int rv = DetermineMaxTokenLength(&mock_library, L"NTLM", &max_token_length); 49 int rv = DetermineMaxTokenLength(&mock_library, L"NTLM", &max_token_length);
50 EXPECT_EQ(OK, rv); 50 EXPECT_EQ(OK, rv);
51 EXPECT_EQ(1337, max_token_length); 51 EXPECT_EQ(1337u, max_token_length);
52 } 52 }
53 53
54 TEST(HttpAuthSSPITest, DetermineMaxTokenLength_InvalidPackage) { 54 TEST(HttpAuthSSPITest, DetermineMaxTokenLength_InvalidPackage) {
55 MockSSPILibrary mock_library; 55 MockSSPILibrary mock_library;
56 mock_library.ExpectQuerySecurityPackageInfo(L"Foo", SEC_E_SECPKG_NOT_FOUND, 56 mock_library.ExpectQuerySecurityPackageInfo(L"Foo", SEC_E_SECPKG_NOT_FOUND,
57 NULL); 57 NULL);
58 ULONG max_token_length = kMaxTokenLength; 58 ULONG max_token_length = kMaxTokenLength;
59 int rv = DetermineMaxTokenLength(&mock_library, L"Foo", &max_token_length); 59 int rv = DetermineMaxTokenLength(&mock_library, L"Foo", &max_token_length);
60 EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, rv); 60 EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, rv);
61 // |DetermineMaxTokenLength()| interface states that |max_token_length| should 61 // |DetermineMaxTokenLength()| interface states that |max_token_length| should
62 // not change on failure. 62 // not change on failure.
63 EXPECT_EQ(100, max_token_length); 63 EXPECT_EQ(100u, max_token_length);
64 } 64 }
65 65
66 TEST(HttpAuthSSPITest, ParseChallenge_FirstRound) { 66 TEST(HttpAuthSSPITest, ParseChallenge_FirstRound) {
67 // The first round should just consist of an unadorned "Negotiate" header. 67 // The first round should just consist of an unadorned "Negotiate" header.
68 MockSSPILibrary mock_library; 68 MockSSPILibrary mock_library;
69 HttpAuthSSPI auth_sspi(&mock_library, "Negotiate", 69 HttpAuthSSPI auth_sspi(&mock_library, "Negotiate",
70 NEGOSSP_NAME, kMaxTokenLength); 70 NEGOSSP_NAME, kMaxTokenLength);
71 std::string challenge_text = "Negotiate"; 71 std::string challenge_text = "Negotiate";
72 HttpAuthChallengeTokenizer challenge(challenge_text.begin(), 72 HttpAuthChallengeTokenizer challenge(challenge_text.begin(),
73 challenge_text.end()); 73 challenge_text.end());
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 &auth_token, 153 &auth_token,
154 base::Bind(&UnexpectedCallback))); 154 base::Bind(&UnexpectedCallback)));
155 std::string second_challenge_text = "Negotiate =happyjoy="; 155 std::string second_challenge_text = "Negotiate =happyjoy=";
156 HttpAuthChallengeTokenizer second_challenge(second_challenge_text.begin(), 156 HttpAuthChallengeTokenizer second_challenge(second_challenge_text.begin(),
157 second_challenge_text.end()); 157 second_challenge_text.end());
158 EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_INVALID, 158 EXPECT_EQ(HttpAuth::AUTHORIZATION_RESULT_INVALID,
159 auth_sspi.ParseChallenge(&second_challenge)); 159 auth_sspi.ParseChallenge(&second_challenge));
160 } 160 }
161 161
162 } // namespace net 162 } // namespace net
OLDNEW
« no previous file with comments | « net/base/network_interfaces_unittest.cc ('k') | net/udp/udp_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698