chromium/chrome/browser/component_updater/privacy_sandbox_attestations_component_installer_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/component_updater/privacy_sandbox_attestations_component_installer.h"

#include <string>
#include <tuple>
#include <utility>

#include "base/check.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/repeating_test_future.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/scoped_path_override.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "base/values.h"
#include "base/version.h"
#include "chrome/browser/component_updater/privacy_sandbox_attestations_component_installer_test_util.h"
#include "chrome/common/chrome_paths.h"
#include "components/component_updater/mock_component_updater_service.h"
#include "components/privacy_sandbox/privacy_sandbox_attestations/privacy_sandbox_attestations_histograms.h"
#include "components/privacy_sandbox/privacy_sandbox_features.h"
#include "components/startup_metric_utils/browser/startup_metric_utils.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace component_updater {

class PrivacySandboxAttestationsInstallerTest : public testing::Test {};

class PrivacySandboxAttestationsInstallerFeatureDisabledTest
    : public PrivacySandboxAttestationsInstallerTest {};

TEST_F(PrivacySandboxAttestationsInstallerFeatureDisabledTest,
       DoNotRegisterIfFeatureDisabled) {}

TEST_F(PrivacySandboxAttestationsInstallerFeatureDisabledTest,
       DeleteExistingFilesIfFeatureDisabled) {}

class PrivacySandboxAttestationsInstallerFeatureEnabledTest
    : public PrivacySandboxAttestationsInstallerTest {};

TEST_F(PrivacySandboxAttestationsInstallerFeatureEnabledTest,
       VerifyInstallation) {}

TEST_F(PrivacySandboxAttestationsInstallerFeatureEnabledTest, OnCustomInstall) {}

TEST_F(PrivacySandboxAttestationsInstallerFeatureEnabledTest,
       RegisterIfFeatureEnabled) {}

TEST_F(PrivacySandboxAttestationsInstallerFeatureEnabledTest,
       InvokeOnAttestationsReadyCallbackOnComponentReady) {}

TEST_F(PrivacySandboxAttestationsInstallerFeatureEnabledTest,
       DoNotInvokeOnAttestationsReadyCallbackIfInvalidVersion) {}

TEST_F(PrivacySandboxAttestationsInstallerFeatureEnabledTest,
       DoNotInvokeOnAttestationsReadyCallbackIfEmptyPath) {}

// Whenever there is an attestations file ready, `ComponentReady()` should
// invoke the stored callback `on_attestations_ready_`, even if this version
// is older than the existing one. The comparison of the passed and existing
// version should be done inside the callback. See
// `PrivacySandboxAttestations::LoadAttestationsInternal()`.
TEST_F(PrivacySandboxAttestationsInstallerFeatureEnabledTest,
       CallLoadNewAttestationsFile) {}

class PrivacySandboxAttestationsHistogramsTest
    : public PrivacySandboxAttestationsInstallerFeatureEnabledTest,
      public testing::WithParamInterface<std::tuple<bool, bool>> {};

TEST_P(PrivacySandboxAttestationsHistogramsTest,
       RecordHistogramWhenComponentReady) {}

TEST_P(PrivacySandboxAttestationsHistogramsTest,
       HistogramShouldOnlyRecordedOnce) {}

TEST_P(PrivacySandboxAttestationsHistogramsTest,
       HistogramNotRecordedIfInvalidInput) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace component_updater