chromium/components/update_client/utils_unittest.cc

// Copyright 2016 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/update_client/utils.h"

#include <string>
#include <utility>
#include <vector>

#include "base/base_paths.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/path_service.h"
#include "base/process/launch.h"
#include "base/process/process.h"
#include "base/strings/strcat.h"
#include "base/time/time.h"
#include "components/update_client/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

#if BUILDFLAG(IS_WIN)
#include <shlobj.h>
#endif  // BUILDFLAG(IS_WIN)

namespace update_client {

TEST(UpdateClientUtils, VerifyFileHash256) {}

// Tests that the brand matches ^[a-zA-Z]{4}?$
TEST(UpdateClientUtils, IsValidBrand) {}

TEST(UpdateClientUtils, GetCrxComponentId) {}

TEST(UpdateClientUtils, GetCrxIdFromPublicKeyHash) {}

// Tests that the name of an InstallerAttribute matches ^[-_=a-zA-Z0-9]{1,256}$
TEST(UpdateClientUtils, IsValidInstallerAttributeName) {}

// Tests that the value of an InstallerAttribute matches
// ^[-.,;+_=$a-zA-Z0-9]{0,256}$
TEST(UpdateClientUtils, IsValidInstallerAttributeValue) {}

TEST(UpdateClientUtils, RemoveUnsecureUrls) {}

TEST(UpdateClientUtils, GetArchitecture) {}

namespace {
#if BUILDFLAG(IS_WIN)
base::FilePath CopyCmdExe(const base::FilePath& under_dir) {
  constexpr wchar_t kCmdExe[] = L"cmd.exe";

  base::FilePath system_path;
  EXPECT_TRUE(base::PathService::Get(base::DIR_SYSTEM, &system_path));

  const base::FilePath cmd_exe_path = under_dir.Append(kCmdExe);
  EXPECT_TRUE(base::CopyFile(system_path.Append(kCmdExe), cmd_exe_path));
  return cmd_exe_path;
}
#endif  // BUILDFLAG(IS_WIN)
}  // namespace

TEST(UpdateClientUtils, RetryDeletePathRecursively) {}

}  // namespace update_client