chromium/chrome/browser/tpcd/experiment/experiment_manager_impl_browsertest.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/tpcd/experiment/experiment_manager_impl.h"

#include <optional>
#include <string>
#include <vector>

#include "base/location.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/task_runner.h"
#include "base/test/scoped_feature_list.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "build/buildflag.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tpcd/experiment/tpcd_experiment_features.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "components/metrics/metrics_pref_names.h"
#include "components/metrics/metrics_service.h"
#include "components/prefs/pref_service.h"
#include "components/privacy_sandbox/privacy_sandbox_prefs.h"
#include "components/privacy_sandbox/tpcd_pref_names.h"
#include "components/privacy_sandbox/tpcd_utils.h"
#include "components/variations/active_field_trials.h"
#include "components/variations/hashing.h"
#include "components/variations/synthetic_trial_registry.h"
#include "components/variations/synthetic_trials.h"
#include "content/public/common/content_features.h"
#include "content/public/test/browser_test.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace tpcd::experiment {

HashName;

struct SyntheticTrialTestCase {};

constexpr char kEligibleGroupName[] =;
constexpr char kOverrideGroupName[] =;

class ExperimentManagerImplBrowserTest : public InProcessBrowserTest {};

// Android does not support PRE_ tests.
#if !BUILDFLAG(IS_ANDROID)
class ExperimentManagerImplSyntheticTrialTest
    : public ExperimentManagerImplBrowserTest,
      public testing::WithParamInterface<SyntheticTrialTestCase> {};

IN_PROC_BROWSER_TEST_P(ExperimentManagerImplSyntheticTrialTest,
                       PRE_RegistersSyntheticTrial) {}

IN_PROC_BROWSER_TEST_P(ExperimentManagerImplSyntheticTrialTest,
                       RegistersSyntheticTrial) {}

// Test every combination of (initial_state, new_state). If the prev_state is
// set, use that eligibility and ignore the new one. If the prev_state is
// unknown, use the new eligibility value.
const SyntheticTrialTestCase kTestCases[] =;

INSTANTIATE_TEST_SUITE_P();

class ExperimentManagerImplDisable3PCsSyntheticTrialTest
    : public ExperimentManagerImplBrowserTest {};

IN_PROC_BROWSER_TEST_F(ExperimentManagerImplDisable3PCsSyntheticTrialTest,
                       PRE_ExistingProfilesRegistersSyntheticTrial) {}

IN_PROC_BROWSER_TEST_F(ExperimentManagerImplDisable3PCsSyntheticTrialTest,
                       ExistingProfilesRegistersSyntheticTrial) {}

class ExperimentManagerImplSilentOnboardingSyntheticTrialTest
    : public ExperimentManagerImplBrowserTest {};

IN_PROC_BROWSER_TEST_F(ExperimentManagerImplSilentOnboardingSyntheticTrialTest,
                       PRE_ExistingProfilesRegistersSyntheticTrial) {}

IN_PROC_BROWSER_TEST_F(ExperimentManagerImplSilentOnboardingSyntheticTrialTest,
                       ExistingProfilesRegistersSyntheticTrial) {}

#endif  // !BUILDFLAG(IS_ANDROID)

}  // namespace tpcd::experiment