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 14 matching lines...) Expand all Loading... |
25 enum TestFeatureType { | 25 enum TestFeatureType { |
26 TEST_FEATURE_0 = 1, | 26 TEST_FEATURE_0 = 1, |
27 TEST_FEATURE_1 = 1 << 2, | 27 TEST_FEATURE_1 = 1 << 2, |
28 TEST_FEATURE_2 = 1 << 3, | 28 TEST_FEATURE_2 = 1 << 3, |
29 }; | 29 }; |
30 | 30 |
31 class GpuControlListTest : public testing::Test { | 31 class GpuControlListTest : public testing::Test { |
32 public: | 32 public: |
33 GpuControlListTest() { } | 33 GpuControlListTest() { } |
34 | 34 |
35 virtual ~GpuControlListTest() { } | 35 ~GpuControlListTest() override {} |
36 | 36 |
37 const GPUInfo& gpu_info() const { | 37 const GPUInfo& gpu_info() const { |
38 return gpu_info_; | 38 return gpu_info_; |
39 } | 39 } |
40 | 40 |
41 GpuControlList* Create() { | 41 GpuControlList* Create() { |
42 GpuControlList* rt = new GpuControlList(); | 42 GpuControlList* rt = new GpuControlList(); |
43 rt->AddSupportedFeature("test_feature_0", TEST_FEATURE_0); | 43 rt->AddSupportedFeature("test_feature_0", TEST_FEATURE_0); |
44 rt->AddSupportedFeature("test_feature_1", TEST_FEATURE_1); | 44 rt->AddSupportedFeature("test_feature_1", TEST_FEATURE_1); |
45 rt->AddSupportedFeature("test_feature_2", TEST_FEATURE_2); | 45 rt->AddSupportedFeature("test_feature_2", TEST_FEATURE_2); |
46 return rt; | 46 return rt; |
47 } | 47 } |
48 | 48 |
49 protected: | 49 protected: |
50 virtual void SetUp() { | 50 void SetUp() override { |
51 gpu_info_.gpu.vendor_id = kNvidiaVendorId; | 51 gpu_info_.gpu.vendor_id = kNvidiaVendorId; |
52 gpu_info_.gpu.device_id = 0x0640; | 52 gpu_info_.gpu.device_id = 0x0640; |
53 gpu_info_.driver_vendor = "NVIDIA"; | 53 gpu_info_.driver_vendor = "NVIDIA"; |
54 gpu_info_.driver_version = "1.6.18"; | 54 gpu_info_.driver_version = "1.6.18"; |
55 gpu_info_.driver_date = "7-14-2009"; | 55 gpu_info_.driver_date = "7-14-2009"; |
56 gpu_info_.machine_model_name = "MacBookPro"; | 56 gpu_info_.machine_model_name = "MacBookPro"; |
57 gpu_info_.machine_model_version = "7.1"; | 57 gpu_info_.machine_model_version = "7.1"; |
58 gpu_info_.gl_vendor = "NVIDIA Corporation"; | 58 gpu_info_.gl_vendor = "NVIDIA Corporation"; |
59 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; | 59 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; |
60 gpu_info_.performance_stats.graphics = 5.0; | 60 gpu_info_.performance_stats.graphics = 5.0; |
61 gpu_info_.performance_stats.gaming = 5.0; | 61 gpu_info_.performance_stats.gaming = 5.0; |
62 gpu_info_.performance_stats.overall = 5.0; | 62 gpu_info_.performance_stats.overall = 5.0; |
63 } | 63 } |
64 | 64 |
65 virtual void TearDown() { | 65 void TearDown() override {} |
66 } | |
67 | 66 |
68 private: | 67 private: |
69 GPUInfo gpu_info_; | 68 GPUInfo gpu_info_; |
70 }; | 69 }; |
71 | 70 |
72 TEST_F(GpuControlListTest, DefaultControlListSettings) { | 71 TEST_F(GpuControlListTest, DefaultControlListSettings) { |
73 scoped_ptr<GpuControlList> control_list(Create()); | 72 scoped_ptr<GpuControlList> control_list(Create()); |
74 // Default control list settings: all feature are allowed. | 73 // Default control list settings: all feature are allowed. |
75 std::set<int> features = control_list->MakeDecision( | 74 std::set<int> features = control_list->MakeDecision( |
76 GpuControlList::kOsMacosx, kOsVersion, gpu_info()); | 75 GpuControlList::kOsMacosx, kOsVersion, gpu_info()); |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 // For non AMD switchable | 579 // For non AMD switchable |
581 gpu_info.amd_switchable = false; | 580 gpu_info.amd_switchable = false; |
582 features = control_list->MakeDecision( | 581 features = control_list->MakeDecision( |
583 GpuControlList::kOsWin, kOsVersion, gpu_info); | 582 GpuControlList::kOsWin, kOsVersion, gpu_info); |
584 EXPECT_EMPTY_SET(features); | 583 EXPECT_EMPTY_SET(features); |
585 } | 584 } |
586 } | 585 } |
587 | 586 |
588 } // namespace gpu | 587 } // namespace gpu |
589 | 588 |
OLD | NEW |