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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "gpu/config/gpu_control_list.h" | 8 #include "gpu/config/gpu_control_list.h" |
9 #include "gpu/config/gpu_info.h" | 9 #include "gpu/config/gpu_info.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 std::set<int> features = control_list->MakeDecision( | 282 std::set<int> features = control_list->MakeDecision( |
283 GpuControlList::kOsWin, kOsVersion, gpu_info()); | 283 GpuControlList::kOsWin, kOsVersion, gpu_info()); |
284 EXPECT_EMPTY_SET(features); | 284 EXPECT_EMPTY_SET(features); |
285 std::vector<uint32> flag_entries; | 285 std::vector<uint32> flag_entries; |
286 control_list->GetDecisionEntries(&flag_entries, false); | 286 control_list->GetDecisionEntries(&flag_entries, false); |
287 EXPECT_EQ(0u, flag_entries.size()); | 287 EXPECT_EQ(0u, flag_entries.size()); |
288 control_list->GetDecisionEntries(&flag_entries, true); | 288 control_list->GetDecisionEntries(&flag_entries, true); |
289 EXPECT_EQ(1u, flag_entries.size()); | 289 EXPECT_EQ(1u, flag_entries.size()); |
290 } | 290 } |
291 | 291 |
292 TEST_F(GpuControlListTest, NeedsMoreInfo) { | |
293 const std::string json = LONG_STRING_CONST( | |
294 { | |
295 "name": "gpu control list", | |
296 "version": "0.1", | |
297 "entries": [ | |
298 { | |
299 "id": 1, | |
300 "os": { | |
301 "type": "win" | |
302 }, | |
303 "vendor_id": "0x10de", | |
304 "driver_version": { | |
305 "op": "<", | |
306 "value": "12" | |
307 }, | |
308 "features": [ | |
309 "test_feature_0" | |
310 ] | |
311 } | |
312 ] | |
313 } | |
314 ); | |
315 GPUInfo gpu_info; | |
316 gpu_info.gpu.vendor_id = kNvidiaVendorId; | |
317 | |
318 scoped_ptr<GpuControlList> control_list(Create()); | |
319 EXPECT_TRUE(control_list->LoadList(json, GpuControlList::kAllOs)); | |
320 | |
321 std::set<int> features = control_list->MakeDecision( | |
322 GpuControlList::kOsWin, kOsVersion, gpu_info); | |
323 EXPECT_EMPTY_SET(features); | |
324 EXPECT_TRUE(control_list->needs_more_info()); | |
325 std::vector<uint32> decision_entries; | |
326 control_list->GetDecisionEntries(&decision_entries, false); | |
327 EXPECT_EQ(0u, decision_entries.size()); | |
Zhenyao Mo
2014/08/26 02:45:15
Before the change, this test fails (returns 1 inst
Ken Russell (switch to Gerrit)
2014/08/26 20:49:21
OK, sounds good. But should the test also verify t
Zhenyao Mo
2014/08/27 03:44:05
Done.
| |
328 } | |
329 | |
292 TEST_F(GpuControlListTest, NeedsMoreInfoForExceptions) { | 330 TEST_F(GpuControlListTest, NeedsMoreInfoForExceptions) { |
293 const std::string json = LONG_STRING_CONST( | 331 const std::string json = LONG_STRING_CONST( |
294 { | 332 { |
295 "name": "gpu control list", | 333 "name": "gpu control list", |
296 "version": "0.1", | 334 "version": "0.1", |
297 "entries": [ | 335 "entries": [ |
298 { | 336 { |
299 "id": 1, | 337 "id": 1, |
300 "os": { | 338 "os": { |
301 "type": "linux" | 339 "type": "linux" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
534 // For non AMD switchable | 572 // For non AMD switchable |
535 gpu_info.amd_switchable = false; | 573 gpu_info.amd_switchable = false; |
536 features = control_list->MakeDecision( | 574 features = control_list->MakeDecision( |
537 GpuControlList::kOsWin, kOsVersion, gpu_info); | 575 GpuControlList::kOsWin, kOsVersion, gpu_info); |
538 EXPECT_EMPTY_SET(features); | 576 EXPECT_EMPTY_SET(features); |
539 } | 577 } |
540 } | 578 } |
541 | 579 |
542 } // namespace gpu | 580 } // namespace gpu |
543 | 581 |
OLD | NEW |