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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "gpu/config/gpu_blacklist.h" | 6 #include "gpu/config/gpu_blacklist.h" |
7 #include "gpu/config/gpu_control_list_jsons.h" | 7 #include "gpu/config/gpu_control_list_jsons.h" |
8 #include "gpu/config/gpu_feature_type.h" | 8 #include "gpu/config/gpu_feature_type.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" |
11 | 11 |
12 const char kOsVersion[] = "10.6.4"; | 12 const char kOsVersion[] = "10.6.4"; |
13 | 13 |
14 namespace gpu { | 14 namespace gpu { |
15 | 15 |
16 class GpuBlacklistTest : public testing::Test { | 16 class GpuBlacklistTest : public testing::Test { |
17 public: | 17 public: |
18 GpuBlacklistTest() { } | 18 GpuBlacklistTest() { } |
19 | 19 |
20 virtual ~GpuBlacklistTest() { } | 20 ~GpuBlacklistTest() override {} |
21 | 21 |
22 const GPUInfo& gpu_info() const { | 22 const GPUInfo& gpu_info() const { |
23 return gpu_info_; | 23 return gpu_info_; |
24 } | 24 } |
25 | 25 |
26 void RunFeatureTest( | 26 void RunFeatureTest( |
27 const std::string feature_name, GpuFeatureType feature_type) { | 27 const std::string feature_name, GpuFeatureType feature_type) { |
28 const std::string json = | 28 const std::string json = |
29 "{\n" | 29 "{\n" |
30 " \"name\": \"gpu blacklist\",\n" | 30 " \"name\": \"gpu blacklist\",\n" |
(...skipping 17 matching lines...) Expand all Loading... |
48 | 48 |
49 scoped_ptr<GpuBlacklist> blacklist(GpuBlacklist::Create()); | 49 scoped_ptr<GpuBlacklist> blacklist(GpuBlacklist::Create()); |
50 EXPECT_TRUE(blacklist->LoadList(json, GpuBlacklist::kAllOs)); | 50 EXPECT_TRUE(blacklist->LoadList(json, GpuBlacklist::kAllOs)); |
51 std::set<int> type = blacklist->MakeDecision( | 51 std::set<int> type = blacklist->MakeDecision( |
52 GpuBlacklist::kOsMacosx, kOsVersion, gpu_info()); | 52 GpuBlacklist::kOsMacosx, kOsVersion, gpu_info()); |
53 EXPECT_EQ(1u, type.size()); | 53 EXPECT_EQ(1u, type.size()); |
54 EXPECT_EQ(1u, type.count(feature_type)); | 54 EXPECT_EQ(1u, type.count(feature_type)); |
55 } | 55 } |
56 | 56 |
57 protected: | 57 protected: |
58 virtual void SetUp() { | 58 void SetUp() override { |
59 gpu_info_.gpu.vendor_id = 0x10de; | 59 gpu_info_.gpu.vendor_id = 0x10de; |
60 gpu_info_.gpu.device_id = 0x0640; | 60 gpu_info_.gpu.device_id = 0x0640; |
61 gpu_info_.driver_vendor = "NVIDIA"; | 61 gpu_info_.driver_vendor = "NVIDIA"; |
62 gpu_info_.driver_version = "1.6.18"; | 62 gpu_info_.driver_version = "1.6.18"; |
63 gpu_info_.driver_date = "7-14-2009"; | 63 gpu_info_.driver_date = "7-14-2009"; |
64 gpu_info_.machine_model_name = "MacBookPro"; | 64 gpu_info_.machine_model_name = "MacBookPro"; |
65 gpu_info_.machine_model_version = "7.1"; | 65 gpu_info_.machine_model_version = "7.1"; |
66 gpu_info_.gl_vendor = "NVIDIA Corporation"; | 66 gpu_info_.gl_vendor = "NVIDIA Corporation"; |
67 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; | 67 gpu_info_.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; |
68 gpu_info_.performance_stats.graphics = 5.0; | 68 gpu_info_.performance_stats.graphics = 5.0; |
69 gpu_info_.performance_stats.gaming = 5.0; | 69 gpu_info_.performance_stats.gaming = 5.0; |
70 gpu_info_.performance_stats.overall = 5.0; | 70 gpu_info_.performance_stats.overall = 5.0; |
71 } | 71 } |
72 | 72 |
73 virtual void TearDown() { | 73 void TearDown() override {} |
74 } | |
75 | 74 |
76 private: | 75 private: |
77 GPUInfo gpu_info_; | 76 GPUInfo gpu_info_; |
78 }; | 77 }; |
79 | 78 |
80 TEST_F(GpuBlacklistTest, CurrentBlacklistValidation) { | 79 TEST_F(GpuBlacklistTest, CurrentBlacklistValidation) { |
81 scoped_ptr<GpuBlacklist> blacklist(GpuBlacklist::Create()); | 80 scoped_ptr<GpuBlacklist> blacklist(GpuBlacklist::Create()); |
82 EXPECT_TRUE(blacklist->LoadList( | 81 EXPECT_TRUE(blacklist->LoadList( |
83 kSoftwareRenderingListJson, GpuBlacklist::kAllOs)); | 82 kSoftwareRenderingListJson, GpuBlacklist::kAllOs)); |
84 } | 83 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 121 |
123 GPU_BLACKLIST_FEATURE_TEST(PanelFitting, | 122 GPU_BLACKLIST_FEATURE_TEST(PanelFitting, |
124 "panel_fitting", | 123 "panel_fitting", |
125 GPU_FEATURE_TYPE_PANEL_FITTING) | 124 GPU_FEATURE_TYPE_PANEL_FITTING) |
126 | 125 |
127 GPU_BLACKLIST_FEATURE_TEST(GpuRasterization, | 126 GPU_BLACKLIST_FEATURE_TEST(GpuRasterization, |
128 "gpu_rasterization", | 127 "gpu_rasterization", |
129 GPU_FEATURE_TYPE_GPU_RASTERIZATION) | 128 GPU_FEATURE_TYPE_GPU_RASTERIZATION) |
130 | 129 |
131 } // namespace gpu | 130 } // namespace gpu |
OLD | NEW |