Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: gpu/config/gpu_driver_bug_list_unittest.cc

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: undo part of clang-format Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "gpu/config/gpu_driver_bug_list.h"
no sievers 2016/04/05 19:02:42 leave below
Mostyn Bramley-Moore 2016/04/05 21:35:32 Fixed.
6
5 #include <stdint.h> 7 #include <stdint.h>
6 8
9 #include <memory>
10
7 #include "base/command_line.h" 11 #include "base/command_line.h"
8 #include "base/logging.h" 12 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "gpu/config/gpu_control_list_jsons.h" 13 #include "gpu/config/gpu_control_list_jsons.h"
11 #include "gpu/config/gpu_driver_bug_list.h"
12 #include "gpu/config/gpu_driver_bug_workaround_type.h" 14 #include "gpu/config/gpu_driver_bug_workaround_type.h"
13 #include "gpu/config/gpu_info.h" 15 #include "gpu/config/gpu_info.h"
14 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
15 17
16 #define LONG_STRING_CONST(...) #__VA_ARGS__ 18 #define LONG_STRING_CONST(...) #__VA_ARGS__
17 19
18 namespace gpu { 20 namespace gpu {
19 21
20 class GpuDriverBugListTest : public testing::Test { 22 class GpuDriverBugListTest : public testing::Test {
21 public: 23 public:
(...skipping 18 matching lines...) Expand all
40 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; 42 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine";
41 } 43 }
42 44
43 void TearDown() override {} 45 void TearDown() override {}
44 46
45 private: 47 private:
46 GPUInfo gpu_info_; 48 GPUInfo gpu_info_;
47 }; 49 };
48 50
49 TEST_F(GpuDriverBugListTest, CurrentDriverBugListValidation) { 51 TEST_F(GpuDriverBugListTest, CurrentDriverBugListValidation) {
50 scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); 52 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create());
51 std::string json; 53 std::string json;
52 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs)); 54 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs));
53 } 55 }
54 56
55 TEST_F(GpuDriverBugListTest, CurrentListForARM) { 57 TEST_F(GpuDriverBugListTest, CurrentListForARM) {
56 scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); 58 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create());
57 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs)); 59 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs));
58 60
59 GPUInfo gpu_info; 61 GPUInfo gpu_info;
60 gpu_info.gl_vendor = "ARM"; 62 gpu_info.gl_vendor = "ARM";
61 gpu_info.gl_renderer = "MALi_T604"; 63 gpu_info.gl_renderer = "MALi_T604";
62 std::set<int> bugs = list->MakeDecision( 64 std::set<int> bugs = list->MakeDecision(
63 GpuControlList::kOsAndroid, "4.1", gpu_info); 65 GpuControlList::kOsAndroid, "4.1", gpu_info);
64 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); 66 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS));
65 } 67 }
66 68
67 TEST_F(GpuDriverBugListTest, CurrentListForImagination) { 69 TEST_F(GpuDriverBugListTest, CurrentListForImagination) {
68 scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); 70 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create());
69 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs)); 71 EXPECT_TRUE(list->LoadList(kGpuDriverBugListJson, GpuControlList::kAllOs));
70 72
71 GPUInfo gpu_info; 73 GPUInfo gpu_info;
72 gpu_info.gl_vendor = "Imagination Technologies"; 74 gpu_info.gl_vendor = "Imagination Technologies";
73 gpu_info.gl_renderer = "PowerVR SGX 540"; 75 gpu_info.gl_renderer = "PowerVR SGX 540";
74 std::set<int> bugs = list->MakeDecision( 76 std::set<int> bugs = list->MakeDecision(
75 GpuControlList::kOsAndroid, "4.1", gpu_info); 77 GpuControlList::kOsAndroid, "4.1", gpu_info);
76 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS)); 78 EXPECT_EQ(1u, bugs.count(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS));
77 } 79 }
78 80
(...skipping 17 matching lines...) Expand all
96 "os": { 98 "os": {
97 "type": "win" 99 "type": "win"
98 }, 100 },
99 "features": [ 101 "features": [
100 "force_integrated_gpu" 102 "force_integrated_gpu"
101 ] 103 ]
102 } 104 }
103 ] 105 ]
104 } 106 }
105 ); 107 );
106 scoped_ptr<GpuDriverBugList> driver_bug_list(GpuDriverBugList::Create()); 108 std::unique_ptr<GpuDriverBugList> driver_bug_list(GpuDriverBugList::Create());
107 EXPECT_TRUE(driver_bug_list->LoadList(json, GpuControlList::kAllOs)); 109 EXPECT_TRUE(driver_bug_list->LoadList(json, GpuControlList::kAllOs));
108 std::set<int> switching = driver_bug_list->MakeDecision( 110 std::set<int> switching = driver_bug_list->MakeDecision(
109 GpuControlList::kOsMacosx, "10.8", gpu_info()); 111 GpuControlList::kOsMacosx, "10.8", gpu_info());
110 EXPECT_EQ(1u, switching.size()); 112 EXPECT_EQ(1u, switching.size());
111 EXPECT_EQ(1u, switching.count(FORCE_DISCRETE_GPU)); 113 EXPECT_EQ(1u, switching.count(FORCE_DISCRETE_GPU));
112 std::vector<uint32_t> entries; 114 std::vector<uint32_t> entries;
113 driver_bug_list->GetDecisionEntries(&entries, false); 115 driver_bug_list->GetDecisionEntries(&entries, false);
114 ASSERT_EQ(1u, entries.size()); 116 ASSERT_EQ(1u, entries.size());
115 EXPECT_EQ(1u, entries[0]); 117 EXPECT_EQ(1u, entries[0]);
116 118
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 "value": "8.17.12.6973" 174 "value": "8.17.12.6973"
173 }, 175 },
174 "features": [ 176 "features": [
175 "disable_d3d11" 177 "disable_d3d11"
176 ] 178 ]
177 } 179 }
178 ] 180 ]
179 } 181 }
180 ); 182 );
181 183
182 scoped_ptr<GpuDriverBugList> list(GpuDriverBugList::Create()); 184 std::unique_ptr<GpuDriverBugList> list(GpuDriverBugList::Create());
183 EXPECT_TRUE(list->LoadList(json, GpuControlList::kAllOs)); 185 EXPECT_TRUE(list->LoadList(json, GpuControlList::kAllOs));
184 186
185 GPUInfo gpu_info; 187 GPUInfo gpu_info;
186 gpu_info.gl_vendor = "NVIDIA"; 188 gpu_info.gl_vendor = "NVIDIA";
187 gpu_info.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; 189 gpu_info.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine";
188 gpu_info.gpu.vendor_id = 0x10de; 190 gpu_info.gpu.vendor_id = 0x10de;
189 gpu_info.gpu.device_id = 0x0640; 191 gpu_info.gpu.device_id = 0x0640;
190 192
191 // test the same driver version number 193 // test the same driver version number
192 gpu_info.driver_version = "8.17.12.6973"; 194 gpu_info.driver_version = "8.17.12.6973";
193 std::set<int> bugs = list->MakeDecision( 195 std::set<int> bugs = list->MakeDecision(
194 GpuControlList::kOsWin, "7.0", gpu_info); 196 GpuControlList::kOsWin, "7.0", gpu_info);
195 EXPECT_EQ(1u, bugs.count(DISABLE_D3D11)); 197 EXPECT_EQ(1u, bugs.count(DISABLE_D3D11));
196 198
197 // test a lower driver version number 199 // test a lower driver version number
198 gpu_info.driver_version = "8.15.11.8647"; 200 gpu_info.driver_version = "8.15.11.8647";
199 201
200 bugs = list->MakeDecision(GpuControlList::kOsWin, "7.0", gpu_info); 202 bugs = list->MakeDecision(GpuControlList::kOsWin, "7.0", gpu_info);
201 EXPECT_EQ(1u, bugs.count(DISABLE_D3D11)); 203 EXPECT_EQ(1u, bugs.count(DISABLE_D3D11));
202 204
203 // test a higher driver version number 205 // test a higher driver version number
204 gpu_info.driver_version = "9.18.13.2723"; 206 gpu_info.driver_version = "9.18.13.2723";
205 bugs = list->MakeDecision(GpuControlList::kOsWin, "7.0", gpu_info); 207 bugs = list->MakeDecision(GpuControlList::kOsWin, "7.0", gpu_info);
206 EXPECT_EQ(0u, bugs.count(DISABLE_D3D11)); 208 EXPECT_EQ(0u, bugs.count(DISABLE_D3D11));
207 } 209 }
208 210
209 } // namespace gpu 211 } // namespace gpu
210 212
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698