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 "gpu/config/gpu_control_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> | |
7 #include <vector> | 10 #include <vector> |
8 | 11 |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "gpu/config/gpu_control_list.h" | |
11 #include "gpu/config/gpu_info.h" | 12 #include "gpu/config/gpu_info.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 | 14 |
14 const char kOsVersion[] = "10.6.4"; | 15 const char kOsVersion[] = "10.6.4"; |
15 const uint32_t kIntelVendorId = 0x8086; | 16 const uint32_t kIntelVendorId = 0x8086; |
16 const uint32_t kNvidiaVendorId = 0x10de; | 17 const uint32_t kNvidiaVendorId = 0x10de; |
17 const uint32_t kAmdVendorId = 0x10de; | 18 const uint32_t kAmdVendorId = 0x10de; |
18 | 19 |
19 #define LONG_STRING_CONST(...) #__VA_ARGS__ | 20 #define LONG_STRING_CONST(...) #__VA_ARGS__ |
20 | 21 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; | 62 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; |
62 } | 63 } |
63 | 64 |
64 void TearDown() override {} | 65 void TearDown() override {} |
65 | 66 |
66 private: | 67 private: |
67 GPUInfo gpu_info_; | 68 GPUInfo gpu_info_; |
68 }; | 69 }; |
69 | 70 |
70 TEST_F(GpuControlListTest, DefaultControlListSettings) { | 71 TEST_F(GpuControlListTest, DefaultControlListSettings) { |
71 scoped_ptr<GpuControlList> control_list(Create()); | 72 std::unique_ptr<GpuControlList> control_list(Create()); |
72 // Default control list settings: all feature are allowed. | 73 // Default control list settings: all feature are allowed. |
73 std::set<int> features = control_list->MakeDecision( | 74 std::set<int> features = control_list->MakeDecision( |
74 GpuControlList::kOsMacosx, kOsVersion, gpu_info()); | 75 GpuControlList::kOsMacosx, kOsVersion, gpu_info()); |
75 EXPECT_EMPTY_SET(features); | 76 EXPECT_EMPTY_SET(features); |
76 } | 77 } |
77 | 78 |
78 TEST_F(GpuControlListTest, EmptyControlList) { | 79 TEST_F(GpuControlListTest, EmptyControlList) { |
79 // Empty list: all features are allowed. | 80 // Empty list: all features are allowed. |
80 const std::string empty_list_json = LONG_STRING_CONST( | 81 const std::string empty_list_json = LONG_STRING_CONST( |
81 { | 82 { |
82 "name": "gpu control list", | 83 "name": "gpu control list", |
83 "version": "2.5", | 84 "version": "2.5", |
84 "entries": [ | 85 "entries": [ |
85 ] | 86 ] |
86 } | 87 } |
87 ); | 88 ); |
88 scoped_ptr<GpuControlList> control_list(Create()); | 89 std::unique_ptr<GpuControlList> control_list(Create()); |
89 | 90 |
90 EXPECT_TRUE(control_list->LoadList(empty_list_json, | 91 EXPECT_TRUE(control_list->LoadList(empty_list_json, |
91 GpuControlList::kAllOs)); | 92 GpuControlList::kAllOs)); |
92 EXPECT_EQ("2.5", control_list->version()); | 93 EXPECT_EQ("2.5", control_list->version()); |
93 std::set<int> features = control_list->MakeDecision( | 94 std::set<int> features = control_list->MakeDecision( |
94 GpuControlList::kOsMacosx, kOsVersion, gpu_info()); | 95 GpuControlList::kOsMacosx, kOsVersion, gpu_info()); |
95 EXPECT_EMPTY_SET(features); | 96 EXPECT_EMPTY_SET(features); |
96 } | 97 } |
97 | 98 |
98 TEST_F(GpuControlListTest, DetailedEntryAndInvalidJson) { | 99 TEST_F(GpuControlListTest, DetailedEntryAndInvalidJson) { |
(...skipping 18 matching lines...) Expand all Loading... | |
117 "op": "=", | 118 "op": "=", |
118 "value": "1.6.18" | 119 "value": "1.6.18" |
119 }, | 120 }, |
120 "features": [ | 121 "features": [ |
121 "test_feature_0" | 122 "test_feature_0" |
122 ] | 123 ] |
123 } | 124 } |
124 ] | 125 ] |
125 } | 126 } |
126 ); | 127 ); |
127 scoped_ptr<GpuControlList> control_list(Create()); | 128 std::unique_ptr<GpuControlList> control_list(Create()); |
128 | 129 |
129 EXPECT_TRUE(control_list->LoadList(exact_list_json, GpuControlList::kAllOs)); | 130 EXPECT_TRUE(control_list->LoadList(exact_list_json, GpuControlList::kAllOs)); |
130 std::set<int> features = control_list->MakeDecision( | 131 std::set<int> features = control_list->MakeDecision( |
131 GpuControlList::kOsMacosx, kOsVersion, gpu_info()); | 132 GpuControlList::kOsMacosx, kOsVersion, gpu_info()); |
132 EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); | 133 EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); |
133 | 134 |
134 // Invalid json input should not change the current control_list settings. | 135 // Invalid json input should not change the current control_list settings. |
135 const std::string invalid_json = "invalid"; | 136 const std::string invalid_json = "invalid"; |
136 | 137 |
137 EXPECT_FALSE(control_list->LoadList(invalid_json, GpuControlList::kAllOs)); | 138 EXPECT_FALSE(control_list->LoadList(invalid_json, GpuControlList::kAllOs)); |
(...skipping 17 matching lines...) Expand all Loading... | |
155 { | 156 { |
156 "id": 1, | 157 "id": 1, |
157 "vendor_id": "0x10de", | 158 "vendor_id": "0x10de", |
158 "features": [ | 159 "features": [ |
159 "test_feature_0" | 160 "test_feature_0" |
160 ] | 161 ] |
161 } | 162 } |
162 ] | 163 ] |
163 } | 164 } |
164 ); | 165 ); |
165 scoped_ptr<GpuControlList> control_list(Create()); | 166 std::unique_ptr<GpuControlList> control_list(Create()); |
166 | 167 |
167 // ControlList entries won't be filtered to the current OS only upon loading. | 168 // ControlList entries won't be filtered to the current OS only upon loading. |
168 EXPECT_TRUE(control_list->LoadList(vendor_json, GpuControlList::kAllOs)); | 169 EXPECT_TRUE(control_list->LoadList(vendor_json, GpuControlList::kAllOs)); |
169 std::set<int> features = control_list->MakeDecision( | 170 std::set<int> features = control_list->MakeDecision( |
170 GpuControlList::kOsMacosx, kOsVersion, gpu_info()); | 171 GpuControlList::kOsMacosx, kOsVersion, gpu_info()); |
171 EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); | 172 EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); |
172 features = control_list->MakeDecision( | 173 features = control_list->MakeDecision( |
173 GpuControlList::kOsWin, kOsVersion, gpu_info()); | 174 GpuControlList::kOsWin, kOsVersion, gpu_info()); |
174 EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); | 175 EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); |
175 features = control_list->MakeDecision( | 176 features = control_list->MakeDecision( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 }, | 208 }, |
208 { | 209 { |
209 "id": 2, | 210 "id": 2, |
210 "features": [ | 211 "features": [ |
211 "test_feature_0" | 212 "test_feature_0" |
212 ] | 213 ] |
213 } | 214 } |
214 ] | 215 ] |
215 } | 216 } |
216 ); | 217 ); |
217 scoped_ptr<GpuControlList> control_list(Create()); | 218 std::unique_ptr<GpuControlList> control_list(Create()); |
218 | 219 |
219 EXPECT_FALSE(control_list->LoadList( | 220 EXPECT_FALSE(control_list->LoadList( |
220 unknown_field_json, GpuControlList::kAllOs)); | 221 unknown_field_json, GpuControlList::kAllOs)); |
221 } | 222 } |
222 | 223 |
223 TEST_F(GpuControlListTest, UnknownExceptionField) { | 224 TEST_F(GpuControlListTest, UnknownExceptionField) { |
224 const std::string unknown_exception_field_json = LONG_STRING_CONST( | 225 const std::string unknown_exception_field_json = LONG_STRING_CONST( |
225 { | 226 { |
226 "name": "gpu control list", | 227 "name": "gpu control list", |
227 "version": "0.1", | 228 "version": "0.1", |
(...skipping 18 matching lines...) Expand all Loading... | |
246 }, | 247 }, |
247 { | 248 { |
248 "id": 3, | 249 "id": 3, |
249 "features": [ | 250 "features": [ |
250 "test_feature_0" | 251 "test_feature_0" |
251 ] | 252 ] |
252 } | 253 } |
253 ] | 254 ] |
254 } | 255 } |
255 ); | 256 ); |
256 scoped_ptr<GpuControlList> control_list(Create()); | 257 std::unique_ptr<GpuControlList> control_list(Create()); |
257 | 258 |
258 EXPECT_FALSE(control_list->LoadList( | 259 EXPECT_FALSE(control_list->LoadList( |
259 unknown_exception_field_json, GpuControlList::kAllOs)); | 260 unknown_exception_field_json, GpuControlList::kAllOs)); |
260 } | 261 } |
261 | 262 |
262 TEST_F(GpuControlListTest, DisabledEntry) { | 263 TEST_F(GpuControlListTest, DisabledEntry) { |
263 const std::string disabled_json = LONG_STRING_CONST( | 264 const std::string disabled_json = LONG_STRING_CONST( |
264 { | 265 { |
265 "name": "gpu control list", | 266 "name": "gpu control list", |
266 "version": "0.1", | 267 "version": "0.1", |
267 "entries": [ | 268 "entries": [ |
268 { | 269 { |
269 "id": 1, | 270 "id": 1, |
270 "disabled": true, | 271 "disabled": true, |
271 "features": [ | 272 "features": [ |
272 "test_feature_0" | 273 "test_feature_0" |
273 ] | 274 ] |
274 } | 275 } |
275 ] | 276 ] |
276 } | 277 } |
277 ); | 278 ); |
278 scoped_ptr<GpuControlList> control_list(Create()); | 279 std::unique_ptr<GpuControlList> control_list(Create()); |
279 EXPECT_TRUE(control_list->LoadList(disabled_json, GpuControlList::kAllOs)); | 280 EXPECT_TRUE(control_list->LoadList(disabled_json, GpuControlList::kAllOs)); |
280 std::set<int> features = control_list->MakeDecision( | 281 std::set<int> features = control_list->MakeDecision( |
281 GpuControlList::kOsWin, kOsVersion, gpu_info()); | 282 GpuControlList::kOsWin, kOsVersion, gpu_info()); |
282 EXPECT_EMPTY_SET(features); | 283 EXPECT_EMPTY_SET(features); |
283 std::vector<uint32_t> flag_entries; | 284 std::vector<uint32_t> flag_entries; |
284 control_list->GetDecisionEntries(&flag_entries, false); | 285 control_list->GetDecisionEntries(&flag_entries, false); |
285 EXPECT_EQ(0u, flag_entries.size()); | 286 EXPECT_EQ(0u, flag_entries.size()); |
286 control_list->GetDecisionEntries(&flag_entries, true); | 287 control_list->GetDecisionEntries(&flag_entries, true); |
287 EXPECT_EQ(1u, flag_entries.size()); | 288 EXPECT_EQ(1u, flag_entries.size()); |
288 } | 289 } |
(...skipping 17 matching lines...) Expand all Loading... | |
306 "features": [ | 307 "features": [ |
307 "test_feature_0" | 308 "test_feature_0" |
308 ] | 309 ] |
309 } | 310 } |
310 ] | 311 ] |
311 } | 312 } |
312 ); | 313 ); |
313 GPUInfo gpu_info; | 314 GPUInfo gpu_info; |
314 gpu_info.gpu.vendor_id = kNvidiaVendorId; | 315 gpu_info.gpu.vendor_id = kNvidiaVendorId; |
315 | 316 |
316 scoped_ptr<GpuControlList> control_list(Create()); | 317 std::unique_ptr<GpuControlList> control_list(Create()); |
317 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); | 318 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); |
318 | 319 |
319 std::set<int> features = control_list->MakeDecision( | 320 std::set<int> features = control_list->MakeDecision( |
320 GpuControlList::kOsWin, kOsVersion, gpu_info); | 321 GpuControlList::kOsWin, kOsVersion, gpu_info); |
321 EXPECT_EMPTY_SET(features); | 322 EXPECT_EMPTY_SET(features); |
322 EXPECT_TRUE(control_list->needs_more_info()); | 323 EXPECT_TRUE(control_list->needs_more_info()); |
323 std::vector<uint32_t> decision_entries; | 324 std::vector<uint32_t> decision_entries; |
324 control_list->GetDecisionEntries(&decision_entries, false); | 325 control_list->GetDecisionEntries(&decision_entries, false); |
325 EXPECT_EQ(0u, decision_entries.size()); | 326 EXPECT_EQ(0u, decision_entries.size()); |
326 | 327 |
(...skipping 26 matching lines...) Expand all Loading... | |
353 "features": [ | 354 "features": [ |
354 "test_feature_0" | 355 "test_feature_0" |
355 ] | 356 ] |
356 } | 357 } |
357 ] | 358 ] |
358 } | 359 } |
359 ); | 360 ); |
360 GPUInfo gpu_info; | 361 GPUInfo gpu_info; |
361 gpu_info.gpu.vendor_id = kIntelVendorId; | 362 gpu_info.gpu.vendor_id = kIntelVendorId; |
362 | 363 |
363 scoped_ptr<GpuControlList> control_list(Create()); | 364 std::unique_ptr<GpuControlList> control_list(Create()); |
364 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); | 365 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); |
365 | 366 |
366 // The case this entry does not apply. | 367 // The case this entry does not apply. |
367 std::set<int> features = control_list->MakeDecision( | 368 std::set<int> features = control_list->MakeDecision( |
368 GpuControlList::kOsMacosx, kOsVersion, gpu_info); | 369 GpuControlList::kOsMacosx, kOsVersion, gpu_info); |
369 EXPECT_EMPTY_SET(features); | 370 EXPECT_EMPTY_SET(features); |
370 EXPECT_FALSE(control_list->needs_more_info()); | 371 EXPECT_FALSE(control_list->needs_more_info()); |
371 | 372 |
372 // The case this entry might apply, but need more info. | 373 // The case this entry might apply, but need more info. |
373 features = control_list->MakeDecision( | 374 features = control_list->MakeDecision( |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 "features": [ | 424 "features": [ |
424 "test_feature_0" | 425 "test_feature_0" |
425 ] | 426 ] |
426 } | 427 } |
427 ] | 428 ] |
428 } | 429 } |
429 ); | 430 ); |
430 GPUInfo gpu_info; | 431 GPUInfo gpu_info; |
431 gpu_info.gpu.vendor_id = kIntelVendorId; | 432 gpu_info.gpu.vendor_id = kIntelVendorId; |
432 | 433 |
433 scoped_ptr<GpuControlList> control_list(Create()); | 434 std::unique_ptr<GpuControlList> control_list(Create()); |
434 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); | 435 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); |
435 std::set<int> features = control_list->MakeDecision( | 436 std::set<int> features = control_list->MakeDecision( |
436 GpuControlList::kOsLinux, kOsVersion, gpu_info); | 437 GpuControlList::kOsLinux, kOsVersion, gpu_info); |
437 EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); | 438 EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); |
438 EXPECT_FALSE(control_list->needs_more_info()); | 439 EXPECT_FALSE(control_list->needs_more_info()); |
439 } | 440 } |
440 | 441 |
441 TEST_F(GpuControlListTest, ExceptionWithoutVendorId) { | 442 TEST_F(GpuControlListTest, ExceptionWithoutVendorId) { |
442 const std::string json = LONG_STRING_CONST( | 443 const std::string json = LONG_STRING_CONST( |
443 { | 444 { |
(...skipping 27 matching lines...) Expand all Loading... | |
471 ] | 472 ] |
472 } | 473 } |
473 ] | 474 ] |
474 } | 475 } |
475 ); | 476 ); |
476 GPUInfo gpu_info; | 477 GPUInfo gpu_info; |
477 gpu_info.gpu.vendor_id = kIntelVendorId; | 478 gpu_info.gpu.vendor_id = kIntelVendorId; |
478 gpu_info.gpu.device_id = 0x2a02; | 479 gpu_info.gpu.device_id = 0x2a02; |
479 gpu_info.driver_version = "9.1"; | 480 gpu_info.driver_version = "9.1"; |
480 | 481 |
481 scoped_ptr<GpuControlList> control_list(Create()); | 482 std::unique_ptr<GpuControlList> control_list(Create()); |
482 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); | 483 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); |
483 | 484 |
484 std::set<int> features = control_list->MakeDecision( | 485 std::set<int> features = control_list->MakeDecision( |
485 GpuControlList::kOsLinux, kOsVersion, gpu_info); | 486 GpuControlList::kOsLinux, kOsVersion, gpu_info); |
486 EXPECT_EMPTY_SET(features); | 487 EXPECT_EMPTY_SET(features); |
487 | 488 |
488 gpu_info.driver_version = "9.0"; | 489 gpu_info.driver_version = "9.0"; |
489 features = control_list->MakeDecision( | 490 features = control_list->MakeDecision( |
490 GpuControlList::kOsLinux, kOsVersion, gpu_info); | 491 GpuControlList::kOsLinux, kOsVersion, gpu_info); |
491 EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); | 492 EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); |
(...skipping 22 matching lines...) Expand all Loading... | |
514 }, | 515 }, |
515 "multi_gpu_style": "amd_switchable_discrete", | 516 "multi_gpu_style": "amd_switchable_discrete", |
516 "features": [ | 517 "features": [ |
517 "test_feature_0" | 518 "test_feature_0" |
518 ] | 519 ] |
519 } | 520 } |
520 ] | 521 ] |
521 } | 522 } |
522 ); | 523 ); |
523 | 524 |
524 scoped_ptr<GpuControlList> control_list(Create()); | 525 std::unique_ptr<GpuControlList> control_list(Create()); |
525 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); | 526 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); |
526 | 527 |
527 // Integrated GPU is active | 528 // Integrated GPU is active |
528 gpu_info.gpu.active = false; | 529 gpu_info.gpu.active = false; |
529 gpu_info.secondary_gpus[0].active = true; | 530 gpu_info.secondary_gpus[0].active = true; |
530 std::set<int> features = control_list->MakeDecision( | 531 std::set<int> features = control_list->MakeDecision( |
531 GpuControlList::kOsWin, kOsVersion, gpu_info); | 532 GpuControlList::kOsWin, kOsVersion, gpu_info); |
532 EXPECT_EMPTY_SET(features); | 533 EXPECT_EMPTY_SET(features); |
533 | 534 |
534 // Discrete GPU is active | 535 // Discrete GPU is active |
(...skipping 17 matching lines...) Expand all Loading... | |
552 }, | 553 }, |
553 "multi_gpu_style": "amd_switchable_integrated", | 554 "multi_gpu_style": "amd_switchable_integrated", |
554 "features": [ | 555 "features": [ |
555 "test_feature_0" | 556 "test_feature_0" |
556 ] | 557 ] |
557 } | 558 } |
558 ] | 559 ] |
559 } | 560 } |
560 ); | 561 ); |
561 | 562 |
562 scoped_ptr<GpuControlList> control_list(Create()); | 563 std::unique_ptr<GpuControlList> control_list(Create()); |
563 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); | 564 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); |
564 | 565 |
565 // Discrete GPU is active | 566 // Discrete GPU is active |
566 gpu_info.gpu.active = true; | 567 gpu_info.gpu.active = true; |
567 gpu_info.secondary_gpus[0].active = false; | 568 gpu_info.secondary_gpus[0].active = false; |
568 std::set<int> features = control_list->MakeDecision( | 569 std::set<int> features = control_list->MakeDecision( |
569 GpuControlList::kOsWin, kOsVersion, gpu_info); | 570 GpuControlList::kOsWin, kOsVersion, gpu_info); |
570 EXPECT_EMPTY_SET(features); | 571 EXPECT_EMPTY_SET(features); |
571 | 572 |
572 // Integrated GPU is active | 573 // Integrated GPU is active |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
607 "type": "win" | 608 "type": "win" |
608 }, | 609 }, |
609 "disabled_extensions": [ | 610 "disabled_extensions": [ |
610 "test_extension3", | 611 "test_extension3", |
611 "test_extension2" | 612 "test_extension2" |
612 ] | 613 ] |
613 } | 614 } |
614 ] | 615 ] |
615 } | 616 } |
616 ); | 617 ); |
617 scoped_ptr<GpuControlList> control_list(Create()); | 618 std::unique_ptr<GpuControlList> control_list(Create()); |
618 | 619 |
619 EXPECT_TRUE(control_list->LoadList(exact_list_json, GpuControlList::kAllOs)); | 620 EXPECT_TRUE(control_list->LoadList(exact_list_json, GpuControlList::kAllOs)); |
620 GPUInfo gpu_info; | 621 GPUInfo gpu_info; |
621 control_list->MakeDecision(GpuControlList::kOsWin, kOsVersion, gpu_info); | 622 control_list->MakeDecision(GpuControlList::kOsWin, kOsVersion, gpu_info); |
622 | 623 |
623 std::vector<std::string> disabled_extensions = | 624 std::vector<std::string> disabled_extensions = |
624 control_list->GetDisabledExtensions(); | 625 control_list->GetDisabledExtensions(); |
625 | 626 |
626 ASSERT_EQ(3u, disabled_extensions.size()); | 627 ASSERT_EQ(3u, disabled_extensions.size()); |
627 ASSERT_STREQ("test_extension1", disabled_extensions[0].c_str()); | 628 ASSERT_STREQ("test_extension1", disabled_extensions[0].c_str()); |
(...skipping 13 matching lines...) Expand all Loading... | |
641 "type": "win" | 642 "type": "win" |
642 }, | 643 }, |
643 "in_process_gpu": true, | 644 "in_process_gpu": true, |
644 "features": [ | 645 "features": [ |
645 "test_feature_0" | 646 "test_feature_0" |
646 ] | 647 ] |
647 } | 648 } |
648 ] | 649 ] |
649 } | 650 } |
650 ); | 651 ); |
651 scoped_ptr<GpuControlList> control_list(Create()); | 652 std::unique_ptr<GpuControlList> control_list(Create()); |
652 | 653 |
653 EXPECT_TRUE(control_list->LoadList(exact_list_json, GpuControlList::kAllOs)); | 654 EXPECT_TRUE(control_list->LoadList(exact_list_json, GpuControlList::kAllOs)); |
654 GPUInfo gpu_info; | 655 GPUInfo gpu_info; |
655 | 656 |
656 gpu_info.in_process_gpu = true; | 657 gpu_info.in_process_gpu = true; |
657 std::set<int> features = control_list->MakeDecision( | 658 std::set<int> features = control_list->MakeDecision( |
658 GpuControlList::kOsWin, kOsVersion, gpu_info); | 659 GpuControlList::kOsWin, kOsVersion, gpu_info); |
659 EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); | 660 EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); |
660 | 661 |
661 gpu_info.in_process_gpu = false; | 662 gpu_info.in_process_gpu = false; |
(...skipping 19 matching lines...) Expand all Loading... | |
681 ] | 682 ] |
682 } | 683 } |
683 ] | 684 ] |
684 } | 685 } |
685 ); | 686 ); |
686 GPUInfo gpu_info; | 687 GPUInfo gpu_info; |
687 gpu_info.gpu.vendor_id = kIntelVendorId; | 688 gpu_info.gpu.vendor_id = kIntelVendorId; |
688 // Real case on Intel GMA* on Windows | 689 // Real case on Intel GMA* on Windows |
689 gpu_info.secondary_gpus.push_back(gpu_info.gpu); | 690 gpu_info.secondary_gpus.push_back(gpu_info.gpu); |
690 | 691 |
691 scoped_ptr<GpuControlList> control_list(Create()); | 692 std::unique_ptr<GpuControlList> control_list(Create()); |
692 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); | 693 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); |
693 std::set<int> features = control_list->MakeDecision( | 694 std::set<int> features = control_list->MakeDecision( |
694 GpuControlList::kOsWin, kOsVersion, gpu_info); | 695 GpuControlList::kOsWin, kOsVersion, gpu_info); |
695 EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); | 696 EXPECT_SINGLE_FEATURE(features, TEST_FEATURE_0); |
696 EXPECT_FALSE(control_list->needs_more_info()); | 697 EXPECT_FALSE(control_list->needs_more_info()); |
697 } | 698 } |
698 | 699 |
699 } // namespace gpu | 700 } // namespace gpu |
OLD | NEW |