chromium/chrome/browser/enterprise/connectors/device_trust/attestation/browser/browser_attestation_service_unittest.cc

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

#include "chrome/browser/enterprise/connectors/device_trust/attestation/browser/browser_attestation_service.h"

#include "base/base64.h"
#include "base/command_line.h"
#include "base/json/json_reader.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "base/values.h"
#include "chrome/browser/enterprise/connectors/device_trust/attestation/browser/attestation_switches.h"
#include "chrome/browser/enterprise/connectors/device_trust/attestation/common/attestation_utils.h"
#include "chrome/browser/enterprise/connectors/device_trust/attestation/common/proto/device_trust_attestation_ca.pb.h"
#include "components/device_signals/core/common/signals_constants.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

_;
Invoke;
StrictMock;

namespace enterprise_connectors {

namespace {

class MockAttester : public Attester {};

// A sample VerifiedAccess v2 challenge.
constexpr char kEncodedChallenge[] =;

constexpr char kEncodedChallengeNotFromVA[] =;

constexpr char kEncodedChallengeDev[] =;

constexpr char kDisplayName[] =;

constexpr char kFakeSignature[] =;

std::string GetSerializedSignedChallenge(bool use_dev = false) {}

std::optional<SignedData> ParseDataFromResponse(const std::string& response) {}

}  // namespace

class BrowserAttestationServiceTest : public testing::Test {};

// Test building the challenge response when the policy is enabled at both the
// user and browser-level using a Dev VA Challenge.
TEST_F(BrowserAttestationServiceTest, BuildChallengeResponseDev_Success) {}

// Test building the challenge response when the policy is enabled at both the
// user and browser-level using a Prod VA Challenge.
TEST_F(BrowserAttestationServiceTest, BuildChallengeResponseProd_Success) {}

// Test building the challenge response when the challenge is missing.
TEST_F(BrowserAttestationServiceTest, BuildChallengeResponse_EmptyChallenge) {}

// Test building the challenge response when the challenge is incorrect.
TEST_F(BrowserAttestationServiceTest,
       BuildChallengeResponse_BadChallengeSource) {}

// Test building the challenge response when the policy is enabled at the
// browser-level only.
TEST_F(BrowserAttestationServiceTest, BuildChallengeResponse_BrowserOnly) {}

// Test building the challenge response when the policy is enabled at the
// browser-level only and no signature is set by the device attester.
TEST_F(BrowserAttestationServiceTest,
       BuildChallengeResponse_BrowserOnly_MissingSignature) {}

// Test building the challenge response when the policy is enabled at the
// user-level only.
TEST_F(BrowserAttestationServiceTest, BuildChallengeResponse_ProfileOnly) {}

// Test building the challenge response when the policy is not enabled at all.
TEST_F(BrowserAttestationServiceTest,
       BuildChallengeResponse_EmptyPolicyLevels) {}

}  // namespace enterprise_connectors