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