chromium/net/ntlm/ntlm_client_unittest.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "net/ntlm/ntlm_client.h"

#include <string>

#include "base/containers/span.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "net/ntlm/ntlm.h"
#include "net/ntlm/ntlm_buffer_reader.h"
#include "net/ntlm/ntlm_buffer_writer.h"
#include "net/ntlm/ntlm_test_data.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace net::ntlm {

namespace {

std::vector<uint8_t> GenerateAuthMsg(const NtlmClient& client,
                                     base::span<const uint8_t> challenge_msg) {}

std::vector<uint8_t> GenerateAuthMsg(const NtlmClient& client,
                                     const NtlmBufferWriter& challenge_writer) {}

bool GetAuthMsgResult(const NtlmClient& client,
                      const NtlmBufferWriter& challenge_writer) {}

bool ReadBytesPayload(NtlmBufferReader* reader, base::span<uint8_t> buffer) {}

// Reads bytes from a payload and assigns them to a string. This makes
// no assumptions about the underlying encoding.
bool ReadStringPayload(NtlmBufferReader* reader, std::string* str) {}

// Reads bytes from a payload and assigns them to a string16. This makes
// no assumptions about the underlying encoding. This will fail if there
// are an odd number of bytes in the payload.
bool ReadString16Payload(NtlmBufferReader* reader, std::u16string* str) {}

void MakeV2ChallengeMessage(size_t target_info_len, std::vector<uint8_t>* out) {}

}  // namespace

TEST(NtlmClientTest, SimpleConstructionV1) {}

TEST(NtlmClientTest, VerifyNegotiateMessageV1) {}

TEST(NtlmClientTest, MinimalStructurallyValidChallenge) {}

TEST(NtlmClientTest, MinimalStructurallyValidChallengeZeroOffset) {}

TEST(NtlmClientTest, ChallengeMsgTooShort) {}

TEST(NtlmClientTest, ChallengeMsgNoSig) {}

TEST(NtlmClientTest, ChallengeMsgWrongMessageType) {}

TEST(NtlmClientTest, ChallengeWithNoTargetName) {}

TEST(NtlmClientTest, Type2MessageWithTargetName) {}

TEST(NtlmClientTest, NoTargetNameOverflowFromOffset) {}

TEST(NtlmClientTest, NoTargetNameOverflowFromLength) {}

TEST(NtlmClientTest, Type3UnicodeWithSessionSecuritySpecTest) {}

TEST(NtlmClientTest, Type3WithoutUnicode) {}

TEST(NtlmClientTest, ClientDoesNotDowngradeSessionSecurity) {}

// ------------------------------------------------
// NTLM V2 specific tests.
// ------------------------------------------------

TEST(NtlmClientTest, SimpleConstructionV2) {}

TEST(NtlmClientTest, VerifyNegotiateMessageV2) {}

TEST(NtlmClientTest, VerifyAuthenticateMessageV2) {}

TEST(NtlmClientTest,
     VerifyAuthenticateMessageInResponseToChallengeWithoutTargetInfoV2) {}

// When the challenge message's target info is maximum size, adding new AV_PAIRs
// to the response will overflow SecurityBuffer. Test that we handle this.
TEST(NtlmClientTest, AvPairsOverflow) {}

}  // namespace net::ntlm