OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/memory/scoped_ptr.h" | |
6 #include "gpu/config/gpu_blacklist.h" | 5 #include "gpu/config/gpu_blacklist.h" |
| 6 |
| 7 #include <memory> |
| 8 |
7 #include "gpu/config/gpu_control_list_jsons.h" | 9 #include "gpu/config/gpu_control_list_jsons.h" |
8 #include "gpu/config/gpu_feature_type.h" | 10 #include "gpu/config/gpu_feature_type.h" |
9 #include "gpu/config/gpu_info.h" | 11 #include "gpu/config/gpu_info.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
11 | 13 |
12 const char kOsVersion[] = "10.6.4"; | 14 const char kOsVersion[] = "10.6.4"; |
13 | 15 |
14 namespace gpu { | 16 namespace gpu { |
15 | 17 |
16 class GpuBlacklistTest : public testing::Test { | 18 class GpuBlacklistTest : public testing::Test { |
(...skipping 22 matching lines...) Expand all Loading... |
39 " \"device_id\": [\"0x0640\"],\n" | 41 " \"device_id\": [\"0x0640\"],\n" |
40 " \"features\": [\n" | 42 " \"features\": [\n" |
41 " \"" + | 43 " \"" + |
42 feature_name + | 44 feature_name + |
43 "\"\n" | 45 "\"\n" |
44 " ]\n" | 46 " ]\n" |
45 " }\n" | 47 " }\n" |
46 " ]\n" | 48 " ]\n" |
47 "}"; | 49 "}"; |
48 | 50 |
49 scoped_ptr<GpuBlacklist> blacklist(GpuBlacklist::Create()); | 51 std::unique_ptr<GpuBlacklist> blacklist(GpuBlacklist::Create()); |
50 EXPECT_TRUE(blacklist->LoadList(json, GpuBlacklist::kAllOs)); | 52 EXPECT_TRUE(blacklist->LoadList(json, GpuBlacklist::kAllOs)); |
51 std::set<int> type = blacklist->MakeDecision( | 53 std::set<int> type = blacklist->MakeDecision( |
52 GpuBlacklist::kOsMacosx, kOsVersion, gpu_info()); | 54 GpuBlacklist::kOsMacosx, kOsVersion, gpu_info()); |
53 EXPECT_EQ(1u, type.size()); | 55 EXPECT_EQ(1u, type.size()); |
54 EXPECT_EQ(1u, type.count(feature_type)); | 56 EXPECT_EQ(1u, type.count(feature_type)); |
55 } | 57 } |
56 | 58 |
57 protected: | 59 protected: |
58 void SetUp() override { | 60 void SetUp() override { |
59 gpu_info_.gpu.vendor_id = 0x10de; | 61 gpu_info_.gpu.vendor_id = 0x10de; |
60 gpu_info_.gpu.device_id = 0x0640; | 62 gpu_info_.gpu.device_id = 0x0640; |
61 gpu_info_.driver_vendor = "NVIDIA"; | 63 gpu_info_.driver_vendor = "NVIDIA"; |
62 gpu_info_.driver_version = "1.6.18"; | 64 gpu_info_.driver_version = "1.6.18"; |
63 gpu_info_.driver_date = "7-14-2009"; | 65 gpu_info_.driver_date = "7-14-2009"; |
64 gpu_info_.machine_model_name = "MacBookPro"; | 66 gpu_info_.machine_model_name = "MacBookPro"; |
65 gpu_info_.machine_model_version = "7.1"; | 67 gpu_info_.machine_model_version = "7.1"; |
66 gpu_info_.gl_vendor = "NVIDIA Corporation"; | 68 gpu_info_.gl_vendor = "NVIDIA Corporation"; |
67 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; | 69 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; |
68 } | 70 } |
69 | 71 |
70 void TearDown() override {} | 72 void TearDown() override {} |
71 | 73 |
72 private: | 74 private: |
73 GPUInfo gpu_info_; | 75 GPUInfo gpu_info_; |
74 }; | 76 }; |
75 | 77 |
76 TEST_F(GpuBlacklistTest, CurrentBlacklistValidation) { | 78 TEST_F(GpuBlacklistTest, CurrentBlacklistValidation) { |
77 scoped_ptr<GpuBlacklist> blacklist(GpuBlacklist::Create()); | 79 std::unique_ptr<GpuBlacklist> blacklist(GpuBlacklist::Create()); |
78 EXPECT_TRUE(blacklist->LoadList( | 80 EXPECT_TRUE(blacklist->LoadList( |
79 kSoftwareRenderingListJson, GpuBlacklist::kAllOs)); | 81 kSoftwareRenderingListJson, GpuBlacklist::kAllOs)); |
80 } | 82 } |
81 | 83 |
82 #define GPU_BLACKLIST_FEATURE_TEST(test_name, feature_name, feature_type) \ | 84 #define GPU_BLACKLIST_FEATURE_TEST(test_name, feature_name, feature_type) \ |
83 TEST_F(GpuBlacklistTest, test_name) { \ | 85 TEST_F(GpuBlacklistTest, test_name) { \ |
84 RunFeatureTest(feature_name, feature_type); \ | 86 RunFeatureTest(feature_name, feature_type); \ |
85 } | 87 } |
86 | 88 |
87 GPU_BLACKLIST_FEATURE_TEST(Accelerated2DCanvas, | 89 GPU_BLACKLIST_FEATURE_TEST(Accelerated2DCanvas, |
(...skipping 30 matching lines...) Expand all Loading... |
118 | 120 |
119 GPU_BLACKLIST_FEATURE_TEST(PanelFitting, | 121 GPU_BLACKLIST_FEATURE_TEST(PanelFitting, |
120 "panel_fitting", | 122 "panel_fitting", |
121 GPU_FEATURE_TYPE_PANEL_FITTING) | 123 GPU_FEATURE_TYPE_PANEL_FITTING) |
122 | 124 |
123 GPU_BLACKLIST_FEATURE_TEST(GpuRasterization, | 125 GPU_BLACKLIST_FEATURE_TEST(GpuRasterization, |
124 "gpu_rasterization", | 126 "gpu_rasterization", |
125 GPU_FEATURE_TYPE_GPU_RASTERIZATION) | 127 GPU_FEATURE_TYPE_GPU_RASTERIZATION) |
126 | 128 |
127 } // namespace gpu | 129 } // namespace gpu |
OLD | NEW |