#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/browser/themes/browser_theme_pack.h"
#include <stddef.h>
#include <memory>
#include <string_view>
#include "base/containers/flat_map.h"
#include "base/files/scoped_temp_dir.h"
#include "base/json/json_file_value_serializer.h"
#include "base/json/json_reader.h"
#include "base/path_service.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/frame/window_frame_util.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/themes/autogenerated_theme_util.h"
#include "chrome/grit/theme_resources.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/color/color_mixer.h"
#include "ui/color/color_provider.h"
#include "ui/color/color_provider_key.h"
#include "ui/color/color_recipe.h"
#include "ui/color/color_test_ids.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_rep.h"
Extension;
TP;
ThemeType;
TestScaleFactorToFileMap;
TestFilePathMap;
class BrowserThemePackTest : public ::testing::Test { … };
BrowserThemePackTest::BrowserThemePackTest()
: … { … }
std::map<int, SkColor> BrowserThemePackTest::GetDefaultColorMap() { … }
void BrowserThemePackTest::VerifyColorMap(
const std::map<int, SkColor>& color_map) { … }
void BrowserThemePackTest::LoadColorJSON(const std::string& json) { … }
void BrowserThemePackTest::LoadColorDictionary(const base::Value::Dict* value) { … }
void BrowserThemePackTest::LoadTintJSON(const std::string& json) { … }
void BrowserThemePackTest::LoadTintDictionary(const base::Value::Dict* value) { … }
void BrowserThemePackTest::LoadDisplayPropertiesJSON(const std::string& json) { … }
void BrowserThemePackTest::LoadDisplayPropertiesDictionary(
const base::Value::Dict* value) { … }
void BrowserThemePackTest::ParseImageNamesJSON(
const std::string& json,
TestFilePathMap* out_file_paths) { … }
void BrowserThemePackTest::ParseImageNamesDictionary(
const base::Value::Dict* value,
TestFilePathMap* out_file_paths) { … }
bool BrowserThemePackTest::LoadRawBitmapsTo(
const TestFilePathMap& out_file_paths) { … }
void BrowserThemePackTest::BuildFromUnpackedExtension(
const base::FilePath& extension_path,
BrowserThemePack* pack) { … }
void BrowserThemePackTest::BuildFromUnpackedExtensionCheckValid(
const base::FilePath& extension_path,
BrowserThemePack* pack) { … }
void BrowserThemePackTest::BuildTestExtensionThemeCheckValid(
std::string_view theme_folder,
BrowserThemePack* pack) { … }
base::FilePath BrowserThemePackTest::GetTestExtensionThemePath(
std::string_view theme_folder) { … }
base::FilePath BrowserThemePackTest::GetStarGazingPath() { … }
base::FilePath BrowserThemePackTest::GetHiDpiThemePath() { … }
void BrowserThemePackTest::VerifyStarGazing(BrowserThemePack* pack) { … }
void BrowserThemePackTest::VerifyHiDpiTheme(BrowserThemePack* pack) { … }
void BrowserThemePackTest::VerifyColorsMatch(BrowserThemePack* pack,
int color_id_a,
int color_id_b) { … }
void BrowserThemePackTest::VerifyCalculatedColorContrast(const SkColor colors[],
int colors_num,
float contrast_ratio) { … }
SkColor BrowserThemePackTest::BuildThirdOpacity(SkColor color_link) { … }
SkColor BrowserThemePackTest::GetDefaultColor(int id) { … }
void BrowserThemePackTest::GenerateDefaultFrameColor(
std::map<int, SkColor>* colors,
int color,
int tint,
bool otr) { … }
TEST_F(BrowserThemePackTest, UseSectionColorAsNTPHeader) { … }
TEST_F(BrowserThemePackTest, ProvideNtpHeaderColor) { … }
TEST_F(BrowserThemePackTest, SupportsAlpha) { … }
TEST_F(BrowserThemePackTest, OutOfRangeColors) { … }
TEST_F(BrowserThemePackTest, CanReadTints) { … }
TEST_F(BrowserThemePackTest, CanReadDisplayProperties) { … }
TEST_F(BrowserThemePackTest, CanParsePaths) { … }
TEST_F(BrowserThemePackTest, InvalidPathNames) { … }
TEST_F(BrowserThemePackTest, InvalidColors) { … }
TEST_F(BrowserThemePackTest, InvalidTints) { … }
TEST_F(BrowserThemePackTest, InvalidDisplayProperties) { … }
TEST_F(BrowserThemePackTest, NullPaths) { … }
TEST_F(BrowserThemePackTest, NullTints) { … }
TEST_F(BrowserThemePackTest, NullColors) { … }
TEST_F(BrowserThemePackTest, NullDisplayProperties) { … }
TEST_F(BrowserThemePackTest, TestHasCustomImage) { … }
TEST_F(BrowserThemePackTest, TestNonExistantImages) { … }
TEST_F(BrowserThemePackTest, TestCreateColorMixersOmniboxAllValues) { … }
TEST_F(BrowserThemePackTest, CanBuildAndReadPack) { … }
TEST_F(BrowserThemePackTest, HiDpiThemeTest) { … }
TEST_F(BrowserThemePackTest, TestWindowControlButtonBGColor_FrameColor) { … }
TEST_F(BrowserThemePackTest, TestWindowControlButtonBGColor_ButtonBGColor) { … }
TEST_F(BrowserThemePackTest, TestWindowControlButtonBGColor_ButtonBGImage) { … }
TEST_F(BrowserThemePackTest, TestFrameAndToolbarColorPropagation) { … }
TEST_F(BrowserThemePackTest,
TestToolbarColorComputedFromImageOverridesInputColor) { … }
TEST_F(BrowserThemePackTest,
TestFrameColorComputedFromImageOverridesInputColor) { … }
TEST_F(BrowserThemePackTest, TestBuildFromColor) { … }
TEST_F(BrowserThemePackTest, BuildFromColor_BasicTestColors) { … }
TEST_F(BrowserThemePackTest, BuildFromColor_TestAdjustedFrameColor) { … }
TEST_F(BrowserThemePackTest, BuildFromColor_TestPreferredActiveTabContrast) { … }
TEST_F(BrowserThemePackTest, TestToolbarButtonColor) { … }
TEST_F(BrowserThemePackTest, TestNtpTextCaclulation) { … }
TEST_F(BrowserThemePackTest, TestLogoColors) { … }
TEST_F(BrowserThemePackTest, JpegNtpBackground) { … }
TEST_F(BrowserThemePackTest, JpegThemeFrame) { … }