#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <stddef.h>
#include "build/build_config.h"
#include "gpu/config/gpu_control_list.h"
#include "gpu/config/gpu_control_list_testing_data.h"
#include "gpu/config/gpu_info.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace gpu {
namespace {
constexpr auto kOsLinux = …;
constexpr auto kOsMacosx = …;
constexpr auto kOsWin = …;
constexpr auto kOsChromeOS = …;
constexpr auto kOsAndroid = …;
constexpr auto kOsFuchsia = …;
constexpr auto kOsAny = …;
constexpr GpuControlList::OsType kAllOsType[] = …;
}
class GpuControlListEntryTest : public testing::Test { … };
TEST_F(GpuControlListEntryTest, DetailedEntry) { … }
TEST_F(GpuControlListEntryTest, VendorOnAllOsEntry) { … }
TEST_F(GpuControlListEntryTest, VendorOnLinuxEntry) { … }
TEST_F(GpuControlListEntryTest, AllExceptNVidiaOnLinuxEntry) { … }
TEST_F(GpuControlListEntryTest, AllExceptIntelOnLinuxEntry) { … }
TEST_F(GpuControlListEntryTest, MultipleDevicesEntry) { … }
TEST_F(GpuControlListEntryTest, ChromeOSEntry) { … }
TEST_F(GpuControlListEntryTest, GlVersionGLESEntry) { … }
TEST_F(GpuControlListEntryTest, GlVersionANGLEEntry) { … }
TEST_F(GpuControlListEntryTest, GlVersionGLEntry) { … }
TEST_F(GpuControlListEntryTest, GlVendorEqual) { … }
TEST_F(GpuControlListEntryTest, GlVendorWithDot) { … }
TEST_F(GpuControlListEntryTest, GlRendererContains) { … }
TEST_F(GpuControlListEntryTest, GlRendererCaseInsensitive) { … }
TEST_F(GpuControlListEntryTest, GlExtensionsEndWith) { … }
TEST_F(GpuControlListEntryTest, OptimusEntry) { … }
TEST_F(GpuControlListEntryTest, AMDSwitchableEntry) { … }
TEST_F(GpuControlListEntryTest, DriverVendorBeginWith) { … }
TEST_F(GpuControlListEntryTest, LexicalDriverVersionEntry) { … }
TEST_F(GpuControlListEntryTest, NeedsMoreInfoEntry) { … }
TEST_F(GpuControlListEntryTest, NeedsMoreInfoForExceptionsEntry) { … }
TEST_F(GpuControlListEntryTest, NeedsMoreInfoForGlVersionEntry) { … }
TEST_F(GpuControlListEntryTest, FeatureTypeAllEntry) { … }
TEST_F(GpuControlListEntryTest, FeatureTypeAllEntryWithExceptions) { … }
TEST_F(GpuControlListEntryTest, SingleActiveGPU) { … }
TEST_F(GpuControlListEntryTest, MachineModelName) { … }
TEST_F(GpuControlListEntryTest, MachineModelNameException) { … }
TEST_F(GpuControlListEntryTest, MachineModelVersion) { … }
TEST_F(GpuControlListEntryTest, MachineModelVersionException) { … }
class GpuControlListEntryDualGPUTest : public GpuControlListEntryTest { … };
TEST_F(GpuControlListEntryDualGPUTest, CategoryAny) { … }
TEST_F(GpuControlListEntryDualGPUTest, CategoryPrimarySecondary) { … }
TEST_F(GpuControlListEntryDualGPUTest, ActiveSecondaryGPU) { … }
TEST_F(GpuControlListEntryDualGPUTest, VendorOnlyActiveSecondaryGPU) { … }
TEST_F(GpuControlListEntryDualGPUTest, ActivePrimaryGPU) { … }
TEST_F(GpuControlListEntryDualGPUTest, VendorOnlyActivePrimaryGPU) { … }
TEST_F(GpuControlListEntryDualGPUTest, AnyDriverVersion) { … }
TEST_F(GpuControlListEntryDualGPUTest, ActiveDriverVersion) { … }
TEST_F(GpuControlListEntryTest, PixelShaderVersion) { … }
TEST_F(GpuControlListEntryTest, OsVersionZero) { … }
TEST_F(GpuControlListEntryTest, OsComparison) { … }
TEST_F(GpuControlListEntryTest, ExceptionWithoutVendorId) { … }
TEST_F(GpuControlListEntryTest, MultiGpuStyleAMDSwitchable) { … }
TEST_F(GpuControlListEntryTest, InProcessGPU) { … }
TEST_F(GpuControlListEntryTest, SameGPUTwiceTest) { … }
TEST_F(GpuControlListEntryTest, NVidiaNumberingScheme) { … }
TEST_F(GpuControlListEntryTest, DirectRendering) { … }
TEST_F(GpuControlListEntryTest, GpuSeries) { … }
TEST_F(GpuControlListEntryTest, GpuSeriesActive) { … }
TEST_F(GpuControlListEntryTest, GpuSeriesAny) { … }
TEST_F(GpuControlListEntryTest, GpuSeriesPrimary) { … }
TEST_F(GpuControlListEntryTest, GpuSeriesSecondary) { … }
TEST_F(GpuControlListEntryTest, GpuSeriesInException) { … }
TEST_F(GpuControlListEntryTest, MultipleDrivers) { … }
TEST_F(GpuControlListEntryTest, GpuGeneration) { … }
TEST_F(GpuControlListEntryTest, GpuGenerationActive) { … }
TEST_F(GpuControlListEntryTest, GpuGenerationAny) { … }
TEST_F(GpuControlListEntryTest, GpuGenerationPrimary) { … }
TEST_F(GpuControlListEntryTest, GpuGenerationSecondary) { … }
#if BUILDFLAG(IS_WIN)
TEST_F(GpuControlListEntryTest, HardwareOverlay) {
const Entry& entry = GetEntry(kGpuControlListEntryTest_HardwareOverlay);
GPUInfo gpu_info;
gpu_info.gpu.vendor_id = 0x8086;
gpu_info.overlay_info.supports_overlays = true;
EXPECT_FALSE(entry.Contains(kOsWin, "10.0", gpu_info));
gpu_info.overlay_info.supports_overlays = false;
EXPECT_TRUE(entry.Contains(kOsWin, "10.0", gpu_info));
}
#endif
TEST_F(GpuControlListEntryTest, TestSubpixelFontRendering) { … }
TEST_F(GpuControlListEntryTest, TestSubpixelFontRenderingDontCare) { … }
TEST_F(GpuControlListEntryTest, IntelDriverVendorEntry) { … }
TEST_F(GpuControlListEntryTest, IntelDriverVersionEntry) { … }
TEST_F(GpuControlListEntryTest, NativeAngleRenderer) { … }
#if BUILDFLAG(IS_WIN)
TEST_F(GpuControlListEntryTest, DeviceRevisionEntry) {
const Entry& entry = GetEntry(kGpuControlListEntryTest_DeviceRevisionEntry);
GPUInfo gpu_info;
gpu_info.gpu.vendor_id = 0x1002;
gpu_info.gpu.device_id = 0x15DD;
gpu_info.gpu.revision = 0x86;
gpu_info.gpu.driver_version = "26.20.12055.1000";
EXPECT_TRUE(entry.Contains(kOsWin, "", gpu_info));
gpu_info.gpu.driver_version = "26.20.15023.6032";
EXPECT_FALSE(entry.Contains(kOsWin, "", gpu_info));
gpu_info.gpu.device_id = 0x15D8;
gpu_info.gpu.revision = 0xE1;
gpu_info.gpu.driver_version = "26.20.12055.1000";
EXPECT_FALSE(entry.Contains(kOsWin, "", gpu_info));
gpu_info.gpu.revision = 0xE3;
EXPECT_TRUE(entry.Contains(kOsWin, "", gpu_info));
}
TEST_F(GpuControlListEntryTest, DeviceRevisionUnspecifiedEntry) {
const Entry& entry =
GetEntry(kGpuControlListEntryTest_DeviceRevisionUnspecifiedEntry);
GPUInfo gpu_info;
gpu_info.gpu.vendor_id = 0x1002;
gpu_info.gpu.device_id = 0x15DD;
gpu_info.gpu.revision = 0x86;
EXPECT_TRUE(entry.Contains(kOsWin, "", gpu_info));
gpu_info.gpu.revision = 0x91;
EXPECT_TRUE(entry.Contains(kOsWin, "", gpu_info));
gpu_info.gpu.revision = 0x0;
EXPECT_TRUE(entry.Contains(kOsWin, "", gpu_info));
}
#endif
}