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