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

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

Issue 2904633002: Replace NTLMv1 implementation with a functionally equivalent one.
Patch Set: Cleanup Created 3 years, 5 months 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 <string> 5 #include <string>
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 168
169 TEST_F(HttpAuthHandlerNtlmPortableTest, VerifyType1Message) { 169 TEST_F(HttpAuthHandlerNtlmPortableTest, VerifyType1Message) {
170 ASSERT_EQ(OK, CreateHandler()); 170 ASSERT_EQ(OK, CreateHandler());
171 171
172 std::string token; 172 std::string token;
173 ASSERT_EQ(OK, GenerateAuthToken(&token)); 173 ASSERT_EQ(OK, GenerateAuthToken(&token));
174 // The type 1 message generated is always the same. The only variable 174 // The type 1 message generated is always the same. The only variable
175 // part of the message is the flags and this implementation always offers 175 // part of the message is the flags and this implementation always offers
176 // the same set of flags. 176 // the same set of flags.
177 ASSERT_EQ("NTLM TlRMTVNTUAABAAAAB4IIAAAAAAAAAAAAAAAAAAAAAAA=", token); 177 ASSERT_EQ("NTLM TlRMTVNTUAABAAAAB4IIAAAAAAAgAAAAAAAAACAAAAA=", token);
178 } 178 }
179 179
180 TEST_F(HttpAuthHandlerNtlmPortableTest, EmptyTokenFails) { 180 TEST_F(HttpAuthHandlerNtlmPortableTest, EmptyTokenFails) {
181 ASSERT_EQ(OK, CreateHandler()); 181 ASSERT_EQ(OK, CreateHandler());
182 ASSERT_EQ(OK, GetGenerateAuthTokenResult()); 182 ASSERT_EQ(OK, GetGenerateAuthTokenResult());
183 183
184 // The encoded token for a type 2 message can't be empty. 184 // The encoded token for a type 2 message can't be empty.
185 ASSERT_EQ(HttpAuth::AUTHORIZATION_RESULT_REJECT, 185 ASSERT_EQ(HttpAuth::AUTHORIZATION_RESULT_REJECT,
186 HandleAnotherChallenge("NTLM")); 186 HandleAnotherChallenge("NTLM"));
187 } 187 }
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 ASSERT_TRUE(reader.SkipSecurityBufferWithValidation()); 568 ASSERT_TRUE(reader.SkipSecurityBufferWithValidation());
569 569
570 // Verify the unicode flag is set. 570 // Verify the unicode flag is set.
571 ntlm::NegotiateFlags flags; 571 ntlm::NegotiateFlags flags;
572 ASSERT_TRUE(reader.ReadFlags(&flags)); 572 ASSERT_TRUE(reader.ReadFlags(&flags));
573 ASSERT_EQ(ntlm::NegotiateFlags::kUnicode, 573 ASSERT_EQ(ntlm::NegotiateFlags::kUnicode,
574 flags & ntlm::NegotiateFlags::kUnicode); 574 flags & ntlm::NegotiateFlags::kUnicode);
575 } 575 }
576 576
577 } // namespace net 577 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698