OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_info.h" | 6 #include "gpu/config/gpu_info.h" |
7 #include "gpu/config/gpu_info_collector.h" | 7 #include "gpu/config/gpu_info_collector.h" |
8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/gl/gl_implementation.h" | 10 #include "ui/gl/gl_implementation.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 EXPECT_EQ(test_values_.pixel_shader_version, | 144 EXPECT_EQ(test_values_.pixel_shader_version, |
145 gpu_info.pixel_shader_version); | 145 gpu_info.pixel_shader_version); |
146 EXPECT_EQ(test_values_.vertex_shader_version, | 146 EXPECT_EQ(test_values_.vertex_shader_version, |
147 gpu_info.vertex_shader_version); | 147 gpu_info.vertex_shader_version); |
148 EXPECT_EQ(test_values_.gl_version, gpu_info.gl_version); | 148 EXPECT_EQ(test_values_.gl_version, gpu_info.gl_version); |
149 EXPECT_EQ(test_values_.gl_renderer, gpu_info.gl_renderer); | 149 EXPECT_EQ(test_values_.gl_renderer, gpu_info.gl_renderer); |
150 EXPECT_EQ(test_values_.gl_vendor, gpu_info.gl_vendor); | 150 EXPECT_EQ(test_values_.gl_vendor, gpu_info.gl_vendor); |
151 EXPECT_EQ(test_values_.gl_extensions, gpu_info.gl_extensions); | 151 EXPECT_EQ(test_values_.gl_extensions, gpu_info.gl_extensions); |
152 } | 152 } |
153 | 153 |
| 154 class CollectDriverInfoGLTest : public testing::Test { |
| 155 public: |
| 156 CollectDriverInfoGLTest() {} |
| 157 ~CollectDriverInfoGLTest() override {} |
| 158 |
| 159 void SetUp() override {} |
| 160 void TearDown() override {} |
| 161 }; |
| 162 |
| 163 TEST_F(CollectDriverInfoGLTest, CollectDriverInfoGL) { |
| 164 const struct { |
| 165 const char* gl_renderer; |
| 166 const char* gl_vendor; |
| 167 const char* gl_version; |
| 168 const char* expected_driver_version; |
| 169 } kTestStrings[] = { |
| 170 #if defined(OS_ANDROID) |
| 171 {"Adreno (TM) 320", |
| 172 "Qualcomm", |
| 173 "OpenGL ES 2.0 V@14.0 AU@04.02 (CL@3206)", |
| 174 "14.0"}, |
| 175 {"Adreno (TM) 420", "Qualcomm", "OpenGL ES 3.0 V@84.0 AU@ (CL@)", "84.0"}, |
| 176 {"PowerVR Rogue G6430", |
| 177 "Imagination Technologies", |
| 178 "OpenGL ES 3.1 build 1.4@3283119", |
| 179 "1.4"}, |
| 180 {"Mali-T604", "ARM", "OpenGL ES 3.1", "0"}, |
| 181 {"NVIDIA Tegra", |
| 182 "NVIDIA Corporation", |
| 183 "OpenGL ES 3.1 NVIDIA 343.00", |
| 184 "343.00"}, |
| 185 {"NVIDIA Tegra 3", |
| 186 "NVIDIA Corporation", |
| 187 "OpenGL ES 2.0 14.01003", |
| 188 "14.01003"}, |
| 189 {"random GPU", |
| 190 "random vendor", |
| 191 "OpenGL ES 2.0 with_long_version_string=1.2.3.4", |
| 192 "1.2"}, |
| 193 {"random GPU", |
| 194 "random vendor", |
| 195 "OpenGL ES 2.0 with_short_version_string=1", |
| 196 "0"}, |
| 197 {"random GPU", |
| 198 "random vendor", |
| 199 "OpenGL ES 2.0 with_no_version_string", |
| 200 "0"}, |
| 201 #elif defined(OS_MACOSX) |
| 202 {"Intel Iris Pro OpenGL Engine", |
| 203 "Intel Inc.", |
| 204 "2.1 INTEL-10.6.20", |
| 205 "10.6.20"}, |
| 206 #elif defined(OS_LINUX) |
| 207 {"Quadro K2000/PCIe/SSE2", |
| 208 "NVIDIA Corporation", |
| 209 "4.4.0 NVIDIA 331.79", |
| 210 "331.79"}, |
| 211 #endif |
| 212 {NULL, NULL, NULL, NULL} |
| 213 }; |
| 214 |
| 215 GPUInfo gpu_info; |
| 216 for (int i = 0; kTestStrings[i].gl_renderer != NULL; ++i) { |
| 217 gpu_info.gl_renderer = kTestStrings[i].gl_renderer; |
| 218 gpu_info.gl_vendor = kTestStrings[i].gl_vendor; |
| 219 gpu_info.gl_version = kTestStrings[i].gl_version; |
| 220 EXPECT_EQ(CollectDriverInfoGL(&gpu_info), kCollectInfoSuccess); |
| 221 EXPECT_EQ(gpu_info.driver_version, kTestStrings[i].expected_driver_version); |
| 222 } |
| 223 } |
| 224 |
154 } // namespace gpu | 225 } // namespace gpu |
155 | 226 |
OLD | NEW |