1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/memory/scoped_ptr.h"
6 #include "gpu/config/gpu_blacklist.h"
7 #include "gpu/config/gpu_control_list_jsons.h"
8 #include "gpu/config/gpu_feature_type.h"
9 #include "gpu/config/gpu_info.h"
10 #include "testing/gtest/include/gtest/gtest.h"
12 const char kOsVersion
[] = "10.6.4";
16 class GpuBlacklistTest
: public testing::Test
{
18 GpuBlacklistTest() { }
20 ~GpuBlacklistTest() override
{}
22 const GPUInfo
& gpu_info() const {
27 const std::string feature_name
, GpuFeatureType feature_type
) {
28 const std::string json
=
30 " \"name\": \"gpu blacklist\",\n"
31 " \"version\": \"0.1\",\n"
36 " \"type\": \"macosx\"\n"
38 " \"vendor_id\": \"0x10de\",\n"
39 " \"device_id\": [\"0x0640\"],\n"
49 scoped_ptr
<GpuBlacklist
> blacklist(GpuBlacklist::Create());
50 EXPECT_TRUE(blacklist
->LoadList(json
, GpuBlacklist::kAllOs
));
51 std::set
<int> type
= blacklist
->MakeDecision(
52 GpuBlacklist::kOsMacosx
, kOsVersion
, gpu_info());
53 EXPECT_EQ(1u, type
.size());
54 EXPECT_EQ(1u, type
.count(feature_type
));
58 void SetUp() override
{
59 gpu_info_
.gpu
.vendor_id
= 0x10de;
60 gpu_info_
.gpu
.device_id
= 0x0640;
61 gpu_info_
.driver_vendor
= "NVIDIA";
62 gpu_info_
.driver_version
= "1.6.18";
63 gpu_info_
.driver_date
= "7-14-2009";
64 gpu_info_
.machine_model_name
= "MacBookPro";
65 gpu_info_
.machine_model_version
= "7.1";
66 gpu_info_
.gl_vendor
= "NVIDIA Corporation";
67 gpu_info_
.gl_renderer
= "NVIDIA GeForce GT 120 OpenGL Engine";
70 void TearDown() override
{}
76 TEST_F(GpuBlacklistTest
, CurrentBlacklistValidation
) {
77 scoped_ptr
<GpuBlacklist
> blacklist(GpuBlacklist::Create());
78 EXPECT_TRUE(blacklist
->LoadList(
79 kSoftwareRenderingListJson
, GpuBlacklist::kAllOs
));
82 #define GPU_BLACKLIST_FEATURE_TEST(test_name, feature_name, feature_type) \
83 TEST_F(GpuBlacklistTest, test_name) { \
84 RunFeatureTest(feature_name, feature_type); \
87 GPU_BLACKLIST_FEATURE_TEST(Accelerated2DCanvas
,
88 "accelerated_2d_canvas",
89 GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS
)
91 GPU_BLACKLIST_FEATURE_TEST(GpuCompositing
,
93 GPU_FEATURE_TYPE_GPU_COMPOSITING
)
95 GPU_BLACKLIST_FEATURE_TEST(WebGL
,
97 GPU_FEATURE_TYPE_WEBGL
)
99 GPU_BLACKLIST_FEATURE_TEST(Flash3D
,
101 GPU_FEATURE_TYPE_FLASH3D
)
103 GPU_BLACKLIST_FEATURE_TEST(FlashStage3D
,
105 GPU_FEATURE_TYPE_FLASH_STAGE3D
)
107 GPU_BLACKLIST_FEATURE_TEST(FlashStage3DBaseline
,
108 "flash_stage3d_baseline",
109 GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE
)
111 GPU_BLACKLIST_FEATURE_TEST(AcceleratedVideoDecode
,
112 "accelerated_video_decode",
113 GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE
)
115 GPU_BLACKLIST_FEATURE_TEST(AcceleratedVideoEncode
,
116 "accelerated_video_encode",
117 GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE
)
119 GPU_BLACKLIST_FEATURE_TEST(PanelFitting
,
121 GPU_FEATURE_TYPE_PANEL_FITTING
)
123 GPU_BLACKLIST_FEATURE_TEST(GpuRasterization
,
125 GPU_FEATURE_TYPE_GPU_RASTERIZATION
)