OLD | NEW |
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 160 } |
161 | 161 |
162 TEST_F(HttpAuthHandlerNtlmPortableTest, VerifyType1Message) { | 162 TEST_F(HttpAuthHandlerNtlmPortableTest, VerifyType1Message) { |
163 ASSERT_EQ(OK, CreateHandler()); | 163 ASSERT_EQ(OK, CreateHandler()); |
164 | 164 |
165 std::string token; | 165 std::string token; |
166 ASSERT_EQ(OK, GenerateAuthToken(&token)); | 166 ASSERT_EQ(OK, GenerateAuthToken(&token)); |
167 // The type 1 message generated is always the same. The only variable | 167 // The type 1 message generated is always the same. The only variable |
168 // part of the message is the flags and this implementation always offers | 168 // part of the message is the flags and this implementation always offers |
169 // the same set of flags. | 169 // the same set of flags. |
170 ASSERT_EQ("NTLM TlRMTVNTUAABAAAAB4IIAAAAAAAAAAAAAAAAAAAAAAA=", token); | 170 ASSERT_EQ("NTLM TlRMTVNTUAABAAAAB4IIAAAAAAAgAAAAAAAAACAAAAA=", token); |
171 } | 171 } |
172 | 172 |
173 TEST_F(HttpAuthHandlerNtlmPortableTest, EmptyTokenFails) { | 173 TEST_F(HttpAuthHandlerNtlmPortableTest, EmptyTokenFails) { |
174 ASSERT_EQ(OK, CreateHandler()); | 174 ASSERT_EQ(OK, CreateHandler()); |
175 ASSERT_EQ(OK, GetGenerateAuthTokenResult()); | 175 ASSERT_EQ(OK, GetGenerateAuthTokenResult()); |
176 | 176 |
177 // The encoded token for a type 2 message can't be empty. | 177 // The encoded token for a type 2 message can't be empty. |
178 ASSERT_EQ(HttpAuth::AUTHORIZATION_RESULT_REJECT, | 178 ASSERT_EQ(HttpAuth::AUTHORIZATION_RESULT_REJECT, |
179 HandleAnotherChallenge("NTLM")); | 179 HandleAnotherChallenge("NTLM")); |
180 } | 180 } |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |