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_mock.h" | 10 #include "ui/gl/gl_mock.h" |
11 | 11 |
12 using ::gfx::MockGLInterface; | 12 using ::gfx::MockGLInterface; |
13 using ::testing::Return; | 13 using ::testing::Return; |
14 | 14 |
15 namespace gpu { | 15 namespace gpu { |
16 | 16 |
17 class GPUInfoCollectorTest : public testing::Test { | 17 class GPUInfoCollectorTest : public testing::Test { |
18 public: | 18 public: |
19 GPUInfoCollectorTest() {} | 19 GPUInfoCollectorTest() {} |
20 virtual ~GPUInfoCollectorTest() { } | 20 ~GPUInfoCollectorTest() override {} |
21 | 21 |
22 virtual void SetUp() { | 22 void SetUp() override { |
23 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); | 23 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); |
24 ::gfx::MockGLInterface::SetGLInterface(gl_.get()); | 24 ::gfx::MockGLInterface::SetGLInterface(gl_.get()); |
25 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
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 char* shader_version = "1.40"; | 30 const char* shader_version = "1.40"; |
31 const char* gl_renderer = "Quadro FX 380/PCI/SSE2"; | 31 const char* gl_renderer = "Quadro FX 380/PCI/SSE2"; |
32 const char* gl_vendor = "NVIDIA Corporation"; | 32 const char* gl_vendor = "NVIDIA Corporation"; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( | 84 .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( |
85 gl_version))); | 85 gl_version))); |
86 EXPECT_CALL(*gl_, GetString(GL_VENDOR)) | 86 EXPECT_CALL(*gl_, GetString(GL_VENDOR)) |
87 .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( | 87 .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( |
88 gl_vendor))); | 88 gl_vendor))); |
89 EXPECT_CALL(*gl_, GetString(GL_RENDERER)) | 89 EXPECT_CALL(*gl_, GetString(GL_RENDERER)) |
90 .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( | 90 .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( |
91 gl_renderer))); | 91 gl_renderer))); |
92 } | 92 } |
93 | 93 |
94 virtual void TearDown() { | 94 void TearDown() override { |
95 ::gfx::MockGLInterface::SetGLInterface(NULL); | 95 ::gfx::MockGLInterface::SetGLInterface(NULL); |
96 gl_.reset(); | 96 gl_.reset(); |
97 } | 97 } |
98 | 98 |
99 public: | 99 public: |
100 // Use StrictMock to make 100% sure we know how GL will be called. | 100 // Use StrictMock to make 100% sure we know how GL will be called. |
101 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; | 101 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; |
102 GPUInfo test_values_; | 102 GPUInfo test_values_; |
103 }; | 103 }; |
104 | 104 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 157 } |
158 | 158 |
159 TEST_F(GPUInfoCollectorTest, DISABLED_GLExtensionsGL) { | 159 TEST_F(GPUInfoCollectorTest, DISABLED_GLExtensionsGL) { |
160 GPUInfo gpu_info; | 160 GPUInfo gpu_info; |
161 CollectGraphicsInfoGL(&gpu_info); | 161 CollectGraphicsInfoGL(&gpu_info); |
162 EXPECT_EQ(test_values_.gl_extensions, gpu_info.gl_extensions); | 162 EXPECT_EQ(test_values_.gl_extensions, gpu_info.gl_extensions); |
163 } | 163 } |
164 | 164 |
165 } // namespace gpu | 165 } // namespace gpu |
166 | 166 |
OLD | NEW |