chromium/components/flags_ui/flags_state_unittest.cc

// Copyright 2015 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/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "components/flags_ui/flags_state.h"

#include <stddef.h>

#include <map>
#include <memory>
#include <set>
#include <string>

#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/format_macros.h"
#include "base/functional/bind.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/field_trial_params.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "base/values.h"
#include "build/build_config.h"
#include "components/flags_ui/feature_entry.h"
#include "components/flags_ui/feature_entry_macros.h"
#include "components/flags_ui/flags_ui_pref_names.h"
#include "components/flags_ui/flags_ui_switches.h"
#include "components/flags_ui/pref_service_flags_storage.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/testing_pref_service.h"
#include "components/strings/grit/components_strings.h"
#include "components/variations/variations_associated_data.h"
#include "components/variations/variations_switches.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace flags_ui {

namespace {

const char kFlags1[] =;
const char kFlags2[] =;
const char kFlags3[] =;
const char kFlags4[] =;
const char kFlags5[] =;
const char kFlags6[] =;
const char kFlags7[] =;
const char kFlags8[] =;
const char kFlags9[] =;
const char kFlags10[] =;
const char kFlags11[] =;
const char kFlags12[] =;

const char kSwitch1[] =;
const char kSwitch2[] =;
const char kSwitch3[] =;
const char kSwitch6[] =;
const char kValueForSwitch2[] =;

const char kStringSwitch[] =;
const char kValueForStringSwitch[] =;

const char kMultiSwitch1[] =;
const char kMultiSwitch2[] =;
const char kValueForMultiSwitch2[] =;

const char kEnableDisableValue1[] =;
const char kEnableDisableValue2[] =;

const char kEnableFeatures[] =;
const char kDisableFeatures[] =;

const char kTestTrial[] =;
const char kTestParam1[] =;
const char kTestParam2[] =;
const char kTestParam3[] =;
const char kTestParamValue[] =;

BASE_FEATURE();
BASE_FEATURE();
BASE_FEATURE();

const FeatureEntry::FeatureParam kTestVariationOther1[] =;
const FeatureEntry::FeatureParam kTestVariationOther2[] =;
const FeatureEntry::FeatureParam kTestVariationOther3[] =;

const FeatureEntry::FeatureVariation kTestVariations1[] =;
const FeatureEntry::FeatureVariation kTestVariations2[] =;
const FeatureEntry::FeatureVariation kTestVariations3[] =;

const char kTestVariation3Cmdline[] =;

const char kDummyName[] =;
const char kDummyDescription[] =;

bool SkipFeatureEntry(const FeatureEntry& feature_entry) {}

}  // namespace

const FeatureEntry::Choice kMultiChoices[] =;

// The entries that are set for these tests. The 3rd entry is not supported on
// the current platform, all others are.
static FeatureEntry kEntries[] =;

class FlagsStateTest : public ::testing::Test,
                       public flags_ui::FlagsState::Delegate {};

TEST_F(FlagsStateTest, NoChangeNoRestart) {}

TEST_F(FlagsStateTest, ChangeNeedsRestart) {}

// Tests that disabling a default enabled entry requires a restart.
TEST_F(FlagsStateTest, DisableChangeNeedsRestart) {}

TEST_F(FlagsStateTest, MultiFlagChangeNeedsRestart) {}

TEST_F(FlagsStateTest, AddTwoFlagsRemoveOne) {}

TEST_F(FlagsStateTest, AddTwoFlagsRemoveBoth) {}

TEST_F(FlagsStateTest, CombineOriginListValues) {}

TEST_F(FlagsStateTest, ConvertFlagsToSwitches) {}

TEST_F(FlagsStateTest, RegisterAllFeatureVariationParameters) {}

TEST_F(FlagsStateTest, RegisterAllFeatureVariationParametersNonDefault) {}

TEST_F(FlagsStateTest, RegisterAllFeatureVariationParametersWithDefaultTrials) {}

base::CommandLine::StringType CreateSwitch(const std::string& value) {}

TEST_F(FlagsStateTest, RemoveFlagSwitches) {}

TEST_F(FlagsStateTest, RemoveFlagSwitches_Features) {}

// Tests enabling entries that aren't supported on the current platform.
TEST_F(FlagsStateTest, PersistAndPrune) {}

// Tests that switches which should have values get them in the command
// line.
TEST_F(FlagsStateTest, CheckValues) {}

// Tests multi-value type entries.
TEST_F(FlagsStateTest, MultiValues) {}

// Tests that disable flags are added when an entry is disabled.
TEST_F(FlagsStateTest, DisableFlagCommandLine) {}

TEST_F(FlagsStateTest, EnableDisableValues) {}

TEST_F(FlagsStateTest, FeatureValues) {}

TEST_F(FlagsStateTest, GetFlagFeatureEntries) {}

}  // namespace flags_ui