chromium/chrome/updater/tag_unittest.cc

// Copyright 2020 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/updater/tag.h"

#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/types/cxx23_to_underlying.h"
#include "chrome/updater/test/unit_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

AppArgs;
ErrorCode;
NeedsAdmin;
RuntimeModeArgs;
TagArgs;

// Builder pattern helper to construct the TagArgs struct.
class TagArgsBuilder {};

// Builder pattern helper to construct the AppArgs struct.
class AppArgsBuilder {};

// Builder pattern helper to construct the RuntimeModeArgs struct.
class RuntimeModeArgsBuilder {};

void VerifyTagParseSuccess(
    std::string_view tag,
    std::optional<std::string_view> app_installer_data_args,
    const TagArgs& expected) {}

void VerifyTagParseFail(std::string_view tag,
                        std::optional<std::string_view> app_installer_data_args,
                        ErrorCode expected) {}

}  // namespace

namespace updater {

AppArgs;
ErrorCode;
Parse;
TagArgs;

TEST(TagParserTest, InvalidValueNameIsSupersetOfValidName) {}

TEST(TagParserTest, AppNameSpaceForValue) {}

TEST(TagParserTest, AppNameEncodedSpaceForValue) {}

TEST(TagParserTest, AppNameValid) {}

// This must work because the enterprise MSI code assumes spaces are allowed.
TEST(TagParserTest, AppNameWithSpace) {}

TEST(TagParserTest, AppNameWithSpaceAtEnd) {}

TEST(TagParserTest, AppNameWithEncodedSpacesAtEnd) {}

TEST(TagParserTest, AppNameWithMultipleSpaces) {}

TEST(TagParserTest, AppNameUnicode) {}

TEST(TagParserTest, AppNameUnicode2) {}

TEST(TagParserTest, AppIdValid) {}

TEST(TagParserTest, AppIdNotASCII) {}

// Most tests here do not reflect this, but appids can be non-GUID ASCII
// strings.
TEST(TagParserTest, AppIdNotAGuid) {}

TEST(TagParserTest, AppIdCaseInsensitive) {}

TEST(TagParserTest, NoRuntimeModeOrAppOnlyNeedsAdminValue) {}

TEST(TagParserTest, NeedsAdminInvalid) {}

TEST(TagParserTest, NeedsAdminSpaceForValue) {}

TEST(TagParserTest, NeedsAdminTrueUpperCaseT) {}

TEST(TagParserTest, NeedsAdminTrueLowerCaseT) {}

TEST(TagParserTest, NeedsFalseUpperCaseF) {}

TEST(TagParserTest, NeedsAdminFalseLowerCaseF) {}

//
// Test the handling of the contents of the extra arguments.
//

TEST(TagParserTest, AssignmentOnly) {}

TEST(TagParserTest, ExtraAssignment1) {}

TEST(TagParserTest, ExtraAssignment2) {}

TEST(TagParserTest, ExtraAssignment3) {}

TEST(TagParserTest, ExtraAssignment4) {}

TEST(TagParserTest, ValueWithoutName) {}

// Also tests ending extra arguments with '='.
TEST(TagParserTest, NameWithoutValue) {}

TEST(TagParserTest, NameWithoutValueBeforeNextArgument) {}

TEST(TagParserTest, NameWithoutArgumentSeparatorAfterIntValue) {}

TEST(TagParserTest, NameWithoutArgumentSeparatorAfterStringValue) {}

TEST(TagParserTest, TagHasDoubleAmpersand) {}

TEST(TagParserTest, TagAmpersandOnly) {}

TEST(TagParserTest, TagBeginsInAmpersand) {}

TEST(TagParserTest, TagEndsInAmpersand) {}

TEST(TagParserTest, WhitespaceOnly) {}

//
// Test the parsing of the extra command and its arguments into a string.
//

TEST(TagParserTest, OneValidAttribute) {}

TEST(TagParserTest, TwoValidAttributes) {}

TEST(TagParserTest, TagHasSwitchInTheMiddle) {}

TEST(TagParserTest, TagHasDoubleQuoteInTheMiddle) {}

TEST(TagParserTest, TagHasDoubleQuoteInTheMiddleAndNoForwardSlash) {}

TEST(TagParserTest, TagHasSpaceAndForwardSlashBeforeQuote) {}

TEST(TagParserTest, TagHasForwardSlashBeforeQuote) {}

TEST(TagParserTest, AttributeSpecifiedTwice) {}

TEST(TagParserTest, WhiteSpaceBeforeArgs1) {}

TEST(TagParserTest, WhiteSpaceBeforeArgs2) {}

TEST(TagParserTest, WhiteSpaceBeforeArgs3) {}

TEST(TagParserTest, WhiteSpaceBeforeArgs4) {}

TEST(TagParserTest, WhiteSpaceBeforeArgs5) {}

TEST(TagParserTest, ForwardSlash1) {}

TEST(TagParserTest, ForwardSlash2) {}

TEST(TagParserTest, BackwardSlash1) {}

TEST(TagParserTest, BackwardSlash2) {}

TEST(TagParserTest, BackwardSlash3) {}

TEST(TagParserTest, AppArgsMustHaveValue) {}

//
// Test specific extra commands.
//

TEST(TagParserTest, UsageStatsOutsideExtraCommand) {}

TEST(TagParserTest, UsageStatsOn) {}

TEST(TagParserTest, UsageStatsOff) {}

TEST(TagParserTest, UsageStatsNone) {}

TEST(TagParserTest, UsageStatsInvalidPositiveValue) {}

TEST(TagParserTest, UsageStatsInvalidNegativeValue) {}

TEST(TagParserTest, UsageStatsValueIsString) {}

TEST(TagParserTest, BundleNameValid) {}

TEST(TagParserTest, BundleNameSpaceForValue) {}

TEST(TagParserTest, BundleNameEncodedSpaceForValue) {}

TEST(TagParserTest, BundleNameNotPresentButAppNameIs) {}
TEST(TagParserTest, BundleNameNorAppNamePresent) {}

TEST(TagParserTest, BundleNameNotPresentAndNoApp) {}

TEST(TagParserTest, InstallationIdValid) {}

TEST(TagParserTest, InstallationIdContainsNonASCII) {}

TEST(TagParserTest, BrandCodeValid) {}

TEST(TagParserTest, ClientIdValid) {}

TEST(TagParserTest, UpdaterExperimentIdValid) {}

TEST(TagParserTest, UpdaterExperimentIdSpaceForValue) {}

TEST(TagParserTest, UpdaterExperimentIdEncodedSpaceForValue) {}

TEST(TagParserTest, AppExperimentIdValid) {}

TEST(TagParserTest, AppExperimentIdSpaceForValue) {}

TEST(TagParserTest, AppExperimentIdEncodedSpaceForValue) {}

TEST(TagParserTest, ReferralIdValid) {}

TEST(TagParserTest, ApValid) {}

TEST(TagParserTest, AppInstallerDataArgsValid) {}

TEST(TagParserTest, AppInstallerDataArgsInvalidAppId) {}

TEST(TagParserTest, AppInstallerDataArgsInvalidAttribute) {}

TEST(TagParserTest, InstallerDataNotAllowedInTag) {}

TEST(TagParserTest, InstallDataIndexValid) {}

TEST(TagParserTest, BrowserTypeValid) {}

TEST(TagParserTest, BrowserTypeInvalid) {}

TEST(TagParserTest, ValidLang) {}

// Language must be passed even if not supported. See http://b/1336966.
TEST(TagParserTest, UnsupportedLang) {}

TEST(TagParserTest, AppNameSpecifiedTwice) {}

TEST(TagParserTest, CaseInsensitiveAttributeNames) {}

TEST(TagParserTest, BracesEncoding) {}

//
// Test multiple applications in the extra arguments
//
TEST(TagParserTestMultipleEntries, TestNotStartingWithAppId) {}

// This also tests that the last occurrence of a global extra arg is the one
// that is saved.
TEST(TagParserTestMultipleEntries, ThreeApplications) {}

TEST(TagParserTest, RuntimeModeBeforeApp) {}

TEST(TagParserTest, RuntimeModeAfterApp) {}

TEST(TagParserTest, RuntimeModeIncorrectValue) {}

TEST(TagParserTest, RuntimeModeIncorrectNeedsAdminValue) {}

TEST(TagParserTest, RuntimeModeValid) {}

TEST(TagParserTest, RuntimeModeValidSystem) {}

TEST(TagParserTest, RuntimeModeValidUser) {}

TEST(TagParserTest, EnrollmentTokenBeforeApp) {}

TEST(TagParserTest, EnrollmentTokenAfterApp) {}

TEST(TagParserTest, EnrollmentTokenInvalidValue) {}

TEST(TagParserTest, EnrollmentTokenValid) {}

TEST(TagExtractorTest, AdvanceIt) {}

TEST(TagExtractorTest, CheckRange) {}

TEST(ExeTagTest, FileNotFound) {}

TEST(ExeTagTest, UntaggedExe) {}

TEST(ExeTagTest, TaggedExeEncodeUtf8) {}

struct ExeTagTestExeWriteTagTestCase {};

class ExeTagTestExeWriteTagTest
    : public ::testing::TestWithParam<ExeTagTestExeWriteTagTestCase> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(ExeTagTestExeWriteTagTest, TestCases) {}

struct MsiTagTestMsiReadTagTestCase {};

class MsiTagTestMsiReadTagTest
    : public ::testing::TestWithParam<MsiTagTestMsiReadTagTestCase> {};

INSTANTIATE_TEST_SUITE_P(
    MsiTagTestMsiReadTagTestCases,
    MsiTagTestMsiReadTagTest,
    ::testing::ValuesIn(std::vector<MsiTagTestMsiReadTagTestCase>{};

TEST_P(MsiTagTestMsiReadTagTest, TestCases) {}

struct MsiTagTestMsiWriteTagTestCase {};

class MsiTagTestMsiWriteTagTest
    : public ::testing::TestWithParam<MsiTagTestMsiWriteTagTestCase> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(MsiTagTestMsiWriteTagTest, TestCases) {}

}  // namespace updater