chromium/chrome/browser/ssl/generated_https_first_mode_pref_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/ssl/generated_https_first_mode_pref.h"

#include <memory>

#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/settings_private/generated_pref_test_base.h"
#include "chrome/browser/extensions/api/settings_private/generated_prefs_factory.h"
#include "chrome/browser/safe_browsing/advanced_protection_status_manager.h"
#include "chrome/browser/safe_browsing/advanced_protection_status_manager_factory.h"
#include "chrome/browser/signin/identity_test_environment_profile_adaptor.h"
#include "chrome/browser/ssl/https_first_mode_settings_tracker.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
#include "components/signin/public/identity_manager/identity_test_environment.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"

settings_api;
settings_private;

constexpr char kEmail[] =;

// The test parameter controls whether the user is signed in.
class GeneratedHttpsFirstModePrefTest : public testing::Test {};

// Check that enabling/disabling Advanced Protection modifies the generated
// pref. The user is initially signed in (this affects how AP manager notifies
// its observers).
TEST_F(GeneratedHttpsFirstModePrefTest,
       AdvancedProtectionStatusChange_InitiallySignedIn) {}

// Similar to AdvancedProtectionStatusChange_InitiallySignedIn but the user is
// initially not signed in.
TEST_F(GeneratedHttpsFirstModePrefTest,
       AdvancedProtectionStatusChange_InitiallyNotSignedIn) {}

// Check the generated pref respects updates to the underlying preference.
TEST_F(GeneratedHttpsFirstModePrefTest, UpdatePreference) {}

// Variant of UpdatePreference, but with the Balanced Mode feature flag enabled.
// The full set of Settings are available (Full, Balanced, and Disabled) and
// they should fully control the underlying prefs and vice-versa.
TEST_F(GeneratedHttpsFirstModePrefTest, UpdatePref_HttpsFirstModeNewSettings) {}

// Check that the management state (e.g. enterprise controlled pref) of the
// underlying preference is applied to the generated preference.
TEST_F(GeneratedHttpsFirstModePrefTest, ManagementState) {}

// Variant of ManagementState, but with the Balanced Mode feature flag enabled.
// The full set of Settings are available (Full, Balanced, and Disabled) and
// both underlying prefs can be controlled by enetprise policy.
TEST_F(GeneratedHttpsFirstModePrefTest,
       ManagementState_HttpsFirstModeNewSettings) {}

// Tests the collection of settings changed metrics.
TEST_F(GeneratedHttpsFirstModePrefTest, SettingChangedMetricsLogged) {}

// Tests the collection of settings changed metrics, with the
// HttpsFirstBalancedMode feature flag enabled.
TEST_F(GeneratedHttpsFirstModePrefTest,
       SettingChangedMetricsLogged_BalancedMode) {}