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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
11 #include "gpu/config/gpu_info.h" | 11 #include "gpu/config/gpu_info.h" |
12 #include "gpu/config/gpu_info_collector.h" | 12 #include "gpu/config/gpu_info_collector.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "ui/gl/gl_implementation.h" | 15 #include "ui/gl/gl_implementation.h" |
16 #include "ui/gl/gl_mock.h" | 16 #include "ui/gl/gl_mock.h" |
17 #include "ui/gl/init/gl_factory.h" | |
18 #include "ui/gl/test/gl_surface_test_support.h" | 17 #include "ui/gl/test/gl_surface_test_support.h" |
19 | 18 |
20 using ::gl::MockGLInterface; | 19 using ::gl::MockGLInterface; |
21 using ::testing::Return; | 20 using ::testing::Return; |
22 using ::testing::SetArgPointee; | 21 using ::testing::SetArgPointee; |
23 using ::testing::_; | 22 using ::testing::_; |
24 | 23 |
25 namespace { | 24 namespace { |
26 | 25 |
27 // Allows testing of all configurations on all operating systems. | 26 // Allows testing of all configurations on all operating systems. |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( | 160 .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( |
162 test_values_.gl_renderer.c_str()))); | 161 test_values_.gl_renderer.c_str()))); |
163 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_SAMPLES, _)) | 162 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_SAMPLES, _)) |
164 .WillOnce(SetArgPointee<1>(8)) | 163 .WillOnce(SetArgPointee<1>(8)) |
165 .RetiresOnSaturation(); | 164 .RetiresOnSaturation(); |
166 } | 165 } |
167 | 166 |
168 void TearDown() override { | 167 void TearDown() override { |
169 ::gl::MockGLInterface::SetGLInterface(NULL); | 168 ::gl::MockGLInterface::SetGLInterface(NULL); |
170 gl_.reset(); | 169 gl_.reset(); |
171 gl::init::ClearGLBindings(); | 170 gl::ClearGLBindings(); |
172 | 171 |
173 testing::Test::TearDown(); | 172 testing::Test::TearDown(); |
174 } | 173 } |
175 | 174 |
176 public: | 175 public: |
177 // Use StrictMock to make 100% sure we know how GL will be called. | 176 // Use StrictMock to make 100% sure we know how GL will be called. |
178 std::unique_ptr<::testing::StrictMock<::gl::MockGLInterface>> gl_; | 177 std::unique_ptr<::testing::StrictMock<::gl::MockGLInterface>> gl_; |
179 GPUInfo test_values_; | 178 GPUInfo test_values_; |
180 const char* gl_shading_language_version_ = nullptr; | 179 const char* gl_shading_language_version_ = nullptr; |
181 | 180 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 353 |
355 gpu_info.gl_vendor = "Google Corporation"; | 354 gpu_info.gl_vendor = "Google Corporation"; |
356 gpu_info.gl_renderer = "Chrome GPU Team"; | 355 gpu_info.gl_renderer = "Chrome GPU Team"; |
357 IdentifyActiveGPU(&gpu_info); | 356 IdentifyActiveGPU(&gpu_info); |
358 EXPECT_FALSE(gpu_info.gpu.active); | 357 EXPECT_FALSE(gpu_info.gpu.active); |
359 EXPECT_FALSE(gpu_info.secondary_gpus[0].active); | 358 EXPECT_FALSE(gpu_info.secondary_gpus[0].active); |
360 } | 359 } |
361 | 360 |
362 } // namespace gpu | 361 } // namespace gpu |
363 | 362 |
OLD | NEW |