| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 170 } |
| 171 | 171 |
| 172 TEST_F(HttpAuthHandlerNtlmPortableTest, VerifyType1Message) { | 172 TEST_F(HttpAuthHandlerNtlmPortableTest, VerifyType1Message) { |
| 173 ASSERT_EQ(OK, CreateHandler()); | 173 ASSERT_EQ(OK, CreateHandler()); |
| 174 | 174 |
| 175 std::string token; | 175 std::string token; |
| 176 ASSERT_EQ(OK, GenerateAuthToken(&token)); | 176 ASSERT_EQ(OK, GenerateAuthToken(&token)); |
| 177 // The type 1 message generated is always the same. The only variable | 177 // The type 1 message generated is always the same. The only variable |
| 178 // part of the message is the flags and Chrome always offers the same | 178 // part of the message is the flags and Chrome always offers the same |
| 179 // set of flags. | 179 // set of flags. |
| 180 ASSERT_EQ("NTLM TlRMTVNTUAABAAAAB4IIAAAAAAAAAAAAAAAAAAAAAAA=", token); | 180 ASSERT_EQ("NTLM TlRMTVNTUAABAAAAB4IIAAAAAAAgAAAAAAAAACAAAAA=", token); |
| 181 } | 181 } |
| 182 | 182 |
| 183 TEST_F(HttpAuthHandlerNtlmPortableTest, EmptyTokenFails) { | 183 TEST_F(HttpAuthHandlerNtlmPortableTest, EmptyTokenFails) { |
| 184 ASSERT_EQ(OK, CreateHandler()); | 184 ASSERT_EQ(OK, CreateHandler()); |
| 185 | 185 |
| 186 // The encoded token for a type 2 message can't be empty. | 186 // The encoded token for a type 2 message can't be empty. |
| 187 ASSERT_EQ(HttpAuth::AUTHORIZATION_RESULT_REJECT, | 187 ASSERT_EQ(HttpAuth::AUTHORIZATION_RESULT_REJECT, |
| 188 HandleAnotherChallenge("NTLM")); | 188 HandleAnotherChallenge("NTLM")); |
| 189 } | 189 } |
| 190 | 190 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 ASSERT_TRUE(reader.SkipSecurityBufferWithValidation()); | 555 ASSERT_TRUE(reader.SkipSecurityBufferWithValidation()); |
| 556 | 556 |
| 557 // Verify the unicode flag is set. | 557 // Verify the unicode flag is set. |
| 558 ntlm::NegotiateFlags flags; | 558 ntlm::NegotiateFlags flags; |
| 559 ASSERT_TRUE(reader.ReadFlags(&flags)); | 559 ASSERT_TRUE(reader.ReadFlags(&flags)); |
| 560 ASSERT_EQ(ntlm::NegotiateFlags::UNICODE, | 560 ASSERT_EQ(ntlm::NegotiateFlags::UNICODE, |
| 561 flags & ntlm::NegotiateFlags::UNICODE); | 561 flags & ntlm::NegotiateFlags::UNICODE); |
| 562 } | 562 } |
| 563 | 563 |
| 564 } // namespace net | 564 } // namespace net |
| OLD | NEW |