OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "app/gfx/gl/gl_implementation.h" | 5 #include "app/gfx/gl/gl_implementation.h" |
6 #include "base/scoped_ptr.h" | 6 #include "base/scoped_ptr.h" |
7 #include "chrome/common/gpu_info.h" | 7 #include "chrome/common/gpu_info.h" |
8 #include "chrome/gpu/gpu_info_collector.h" | 8 #include "chrome/gpu/gpu_info_collector.h" |
9 #include "gpu/command_buffer/common/gl_mock.h" | 9 #include "gpu/command_buffer/common/gl_mock.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 const uint32 vendor_id = 0x10de; | 26 const uint32 vendor_id = 0x10de; |
27 const uint32 device_id = 0x0658; | 27 const uint32 device_id = 0x0658; |
28 const char* driver_vendor = ""; // not implemented | 28 const char* driver_vendor = ""; // not implemented |
29 const char* driver_version = ""; | 29 const char* driver_version = ""; |
30 const uint32 shader_version = 0x00000128; | 30 const uint32 shader_version = 0x00000128; |
31 const uint32 gl_version = 0x00000301; | 31 const uint32 gl_version = 0x00000301; |
32 const char* gl_renderer = "Quadro FX 380/PCI/SSE2"; | 32 const char* gl_renderer = "Quadro FX 380/PCI/SSE2"; |
33 const char* gl_vendor = "NVIDIA Corporation"; | 33 const char* gl_vendor = "NVIDIA Corporation"; |
34 const char* gl_version_string = "3.1.0"; | 34 const char* gl_version_string = "3.1.0"; |
35 const char* gl_shading_language_version = "1.40 NVIDIA via Cg compiler"; | 35 const char* gl_shading_language_version = "1.40 NVIDIA via Cg compiler"; |
| 36 const char* gl_extensions = |
| 37 "GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 " |
| 38 "GL_EXT_read_format_bgra"; |
36 #elif defined(OS_MACOSX) | 39 #elif defined(OS_MACOSX) |
37 const uint32 vendor_id = 0x10de; | 40 const uint32 vendor_id = 0x10de; |
38 const uint32 device_id = 0x0640; | 41 const uint32 device_id = 0x0640; |
39 const char* driver_vendor = ""; // not implemented | 42 const char* driver_vendor = ""; // not implemented |
40 const char* driver_version = "1.6.18"; | 43 const char* driver_version = "1.6.18"; |
41 const uint32 shader_version = 0x00000114; | 44 const uint32 shader_version = 0x00000114; |
42 const uint32 gl_version = 0x00000201; | 45 const uint32 gl_version = 0x00000201; |
43 const char* gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; | 46 const char* gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine"; |
44 const char* gl_vendor = "NVIDIA Corporation"; | 47 const char* gl_vendor = "NVIDIA Corporation"; |
45 const char* gl_version_string = "2.1 NVIDIA-1.6.18"; | 48 const char* gl_version_string = "2.1 NVIDIA-1.6.18"; |
46 const char* gl_shading_language_version = "1.20 "; | 49 const char* gl_shading_language_version = "1.20 "; |
| 50 const char* gl_extensions = |
| 51 "GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 " |
| 52 "GL_EXT_read_format_bgra"; |
47 #else // defined (OS_LINUX) | 53 #else // defined (OS_LINUX) |
48 const uint32 vendor_id = 0x10de; | 54 const uint32 vendor_id = 0x10de; |
49 const uint32 device_id = 0x0658; | 55 const uint32 device_id = 0x0658; |
50 const char* driver_vendor = "NVIDIA"; | 56 const char* driver_vendor = "NVIDIA"; |
51 const char* driver_version = "195.36.24"; | 57 const char* driver_version = "195.36.24"; |
52 const uint32 shader_version = 0x00000132; | 58 const uint32 shader_version = 0x00000132; |
53 const uint32 gl_version = 0x00000302; | 59 const uint32 gl_version = 0x00000302; |
54 const char* gl_renderer = "Quadro FX 380/PCI/SSE2"; | 60 const char* gl_renderer = "Quadro FX 380/PCI/SSE2"; |
55 const char* gl_vendor = "NVIDIA Corporation"; | 61 const char* gl_vendor = "NVIDIA Corporation"; |
56 const char* gl_version_string = "3.2.0 NVIDIA 195.36.24"; | 62 const char* gl_version_string = "3.2.0 NVIDIA 195.36.24"; |
57 const char* gl_shading_language_version = "1.50 NVIDIA via Cg compiler"; | 63 const char* gl_shading_language_version = "1.50 NVIDIA via Cg compiler"; |
| 64 const char* gl_extensions = |
| 65 "GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 " |
| 66 "GL_EXT_read_format_bgra"; |
58 #endif | 67 #endif |
59 test_values_.SetVideoCardInfo(vendor_id, device_id); | 68 test_values_.SetVideoCardInfo(vendor_id, device_id); |
60 test_values_.SetDriverInfo(driver_vendor, driver_version); | 69 test_values_.SetDriverInfo(driver_vendor, driver_version); |
61 test_values_.SetShaderVersion(shader_version, shader_version); | 70 test_values_.SetShaderVersion(shader_version, shader_version); |
62 test_values_.SetGLVersion(gl_version); | 71 test_values_.SetGLVersion(gl_version); |
63 test_values_.SetGLRenderer(gl_renderer); | 72 test_values_.SetGLRenderer(gl_renderer); |
64 test_values_.SetGLVendor(gl_vendor); | 73 test_values_.SetGLVendor(gl_vendor); |
65 test_values_.SetGLVersionString(gl_version_string); | 74 test_values_.SetGLVersionString(gl_version_string); |
| 75 test_values_.SetGLExtensions(gl_extensions); |
66 test_values_.SetCanLoseContext(false); | 76 test_values_.SetCanLoseContext(false); |
67 | 77 |
68 EXPECT_CALL(*gl_, GetString(GL_EXTENSIONS)) | 78 EXPECT_CALL(*gl_, GetString(GL_EXTENSIONS)) |
69 .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( | 79 .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( |
70 "GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 " | 80 gl_extensions))); |
71 "GL_EXT_read_format_bgra"))); | |
72 EXPECT_CALL(*gl_, GetString(GL_SHADING_LANGUAGE_VERSION)) | 81 EXPECT_CALL(*gl_, GetString(GL_SHADING_LANGUAGE_VERSION)) |
73 .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( | 82 .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( |
74 gl_shading_language_version))); | 83 gl_shading_language_version))); |
75 EXPECT_CALL(*gl_, GetString(GL_VERSION)) | 84 EXPECT_CALL(*gl_, GetString(GL_VERSION)) |
76 .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( | 85 .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( |
77 gl_version_string))); | 86 gl_version_string))); |
78 EXPECT_CALL(*gl_, GetString(GL_VENDOR)) | 87 EXPECT_CALL(*gl_, GetString(GL_VENDOR)) |
79 .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( | 88 .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( |
80 gl_vendor))); | 89 gl_vendor))); |
81 EXPECT_CALL(*gl_, GetString(GL_RENDERER)) | 90 EXPECT_CALL(*gl_, GetString(GL_RENDERER)) |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 EXPECT_EQ(test_values_.gl_renderer(), gl_renderer); | 155 EXPECT_EQ(test_values_.gl_renderer(), gl_renderer); |
147 } | 156 } |
148 | 157 |
149 TEST_F(GPUInfoCollectorTest, GLVendorGL) { | 158 TEST_F(GPUInfoCollectorTest, GLVendorGL) { |
150 GPUInfo gpu_info; | 159 GPUInfo gpu_info; |
151 gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); | 160 gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); |
152 std::string gl_vendor = gpu_info.gl_vendor(); | 161 std::string gl_vendor = gpu_info.gl_vendor(); |
153 EXPECT_EQ(test_values_.gl_vendor(), gl_vendor); | 162 EXPECT_EQ(test_values_.gl_vendor(), gl_vendor); |
154 } | 163 } |
155 | 164 |
| 165 TEST_F(GPUInfoCollectorTest, GLExtensionsGL) { |
| 166 GPUInfo gpu_info; |
| 167 gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); |
| 168 std::string gl_extensions = gpu_info.gl_extensions(); |
| 169 EXPECT_EQ(test_values_.gl_extensions(), gl_extensions); |
| 170 } |
| 171 |
| 172 |
OLD | NEW |