chromium/components/embedder_support/origin_trials/component_updater_utils_unittest.cc

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

#include "components/embedder_support/origin_trials/component_updater_utils.h"

#include <string>
#include <utility>

#include "base/command_line.h"
#include "base/files/scoped_temp_dir.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/values.h"
#include "base/version.h"
#include "components/component_updater/installer_policies/origin_trials_component_installer.h"
#include "components/embedder_support/origin_trials/mock_origin_trials_settings_storage.h"
#include "components/embedder_support/origin_trials/origin_trial_prefs.h"
#include "components/embedder_support/origin_trials/origin_trials_settings_storage.h"
#include "components/embedder_support/origin_trials/pref_names.h"
#include "components/embedder_support/switches.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/prefs/testing_pref_service.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"

namespace {

// Mirror the constants used in the component installer. Do not share the
// constants, as want to catch inadvertent changes in the tests. The keys will
// will be generated server-side, so any changes need to be intentional and
// coordinated.
static const char kManifestOriginTrialsKey[] =;
static const char kManifestPublicKeyPath[] =;
static const char kManifestDisabledFeaturesPath[] =;
static const char kManifestDisabledTokensPath[] =;
static const char kManifestDisabledTokenSignaturesPath[] =;

static const char kExistingPublicKey[] =;
static const char kNewPublicKey[] =;
static const char kExistingDisabledFeature[] =;
static const std::vector<std::string> kExistingDisabledFeatures =;
static const char kNewDisabledFeature1[] =;
static const char kNewDisabledFeature2[] =;
static const std::vector<std::string> kNewDisabledFeatures =;
static const char kExistingDisabledToken1[] =;
static const char kExistingDisabledToken2[] =;
static const char kExistingDisabledToken3[] =;
static const std::vector<std::string> kExistingDisabledTokens =;
static const char kNewDisabledToken1[] =;
static const char kNewDisabledToken2[] =;
static const std::vector<std::string> kNewDisabledTokens =;

static const char kTokenSeparator[] =;

}  // namespace

namespace component_updater {
class OriginTrialsComponentInstallerTest : public PlatformTest {};

TEST_F(OriginTrialsComponentInstallerTest,
       PublicKeyResetToDefaultWhenOverrideMissing) {}

TEST_F(OriginTrialsComponentInstallerTest, PublicKeySetWhenOverrideExists) {}

TEST_F(OriginTrialsComponentInstallerTest,
       DisabledFeaturesResetToDefaultWhenListMissing) {}

TEST_F(OriginTrialsComponentInstallerTest,
       DisabledFeaturesResetToDefaultWhenListEmpty) {}

TEST_F(OriginTrialsComponentInstallerTest, DisabledFeaturesSetWhenListExists) {}

TEST_F(OriginTrialsComponentInstallerTest,
       DisabledFeaturesReplacedWhenListExists) {}

TEST_F(OriginTrialsComponentInstallerTest,
       DisabledTokensResetToDefaultWhenListMissing) {}

TEST_F(OriginTrialsComponentInstallerTest,
       DisabledTokensResetToDefaultWhenKeyExistsAndListMissing) {}

TEST_F(OriginTrialsComponentInstallerTest,
       DisabledTokensResetToDefaultWhenListEmpty) {}

TEST_F(OriginTrialsComponentInstallerTest, DisabledTokensSetWhenListExists) {}

TEST_F(OriginTrialsComponentInstallerTest,
       DisabledTokensReplacedWhenListExists) {}

TEST_F(OriginTrialsComponentInstallerTest, ParametersAddedToCommandLine) {}

TEST_F(OriginTrialsComponentInstallerTest, DoesNotOverwriteExistingValues) {}

}  // namespace component_updater