| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "gpu/command_buffer/service/gpu_service_test.h" | 5 #include "gpu/command_buffer/service/gpu_service_test.h" |
| 6 | 6 |
| 7 #include "gpu/command_buffer/service/test_helper.h" | 7 #include "gpu/command_buffer/service/test_helper.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/gl/gl_context_stub_with_extensions.h" | 9 #include "ui/gl/gl_context_stub.h" |
| 10 #include "ui/gl/gl_implementation.h" | 10 #include "ui/gl/gl_implementation.h" |
| 11 #include "ui/gl/gl_mock.h" | 11 #include "ui/gl/gl_mock.h" |
| 12 #include "ui/gl/gl_surface_stub.h" | 12 #include "ui/gl/gl_surface_stub.h" |
| 13 #include "ui/gl/init/gl_factory.h" | 13 #include "ui/gl/init/gl_factory.h" |
| 14 #include "ui/gl/test/gl_surface_test_support.h" | 14 #include "ui/gl/test/gl_surface_test_support.h" |
| 15 | 15 |
| 16 namespace gpu { | 16 namespace gpu { |
| 17 namespace gles2 { | 17 namespace gles2 { |
| 18 | 18 |
| 19 GpuServiceTest::GpuServiceTest() : ran_setup_(false), ran_teardown_(false) { | 19 GpuServiceTest::GpuServiceTest() : ran_setup_(false), ran_teardown_(false) { |
| 20 } | 20 } |
| 21 | 21 |
| 22 GpuServiceTest::~GpuServiceTest() { | 22 GpuServiceTest::~GpuServiceTest() { |
| 23 DCHECK(ran_teardown_); | 23 DCHECK(ran_teardown_); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void GpuServiceTest::SetUpWithGLVersion(const char* gl_version, | 26 void GpuServiceTest::SetUpWithGLVersion(const char* gl_version, |
| 27 const char* gl_extensions) { | 27 const char* gl_extensions) { |
| 28 testing::Test::SetUp(); | 28 testing::Test::SetUp(); |
| 29 | 29 |
| 30 gl::SetGLGetProcAddressProc(gl::MockGLInterface::GetGLProcAddress); | 30 gl::SetGLGetProcAddressProc(gl::MockGLInterface::GetGLProcAddress); |
| 31 gl::GLSurfaceTestSupport::InitializeOneOffWithMockBindings(); | 31 gl::GLSurfaceTestSupport::InitializeOneOffWithMockBindings(); |
| 32 gl_.reset(new ::testing::StrictMock<::gl::MockGLInterface>()); | 32 gl_.reset(new ::testing::StrictMock<::gl::MockGLInterface>()); |
| 33 ::gl::MockGLInterface::SetGLInterface(gl_.get()); | 33 ::gl::MockGLInterface::SetGLInterface(gl_.get()); |
| 34 | 34 |
| 35 context_ = new gl::GLContextStubWithExtensions; | 35 context_ = new gl::GLContextStub; |
| 36 context_->AddExtensionsString(gl_extensions); | 36 context_->SetExtensionsString(gl_extensions); |
| 37 context_->SetGLVersionString(gl_version); | 37 context_->SetGLVersionString(gl_version); |
| 38 surface_ = new gl::GLSurfaceStub; | 38 surface_ = new gl::GLSurfaceStub; |
| 39 context_->MakeCurrent(surface_.get()); | 39 context_->MakeCurrent(surface_.get()); |
| 40 ran_setup_ = true; | 40 ran_setup_ = true; |
| 41 } | 41 } |
| 42 | 42 |
| 43 void GpuServiceTest::SetUp() { | 43 void GpuServiceTest::SetUp() { |
| 44 SetUpWithGLVersion("2.0", "GL_EXT_framebuffer_object"); | 44 SetUpWithGLVersion("2.0", "GL_EXT_framebuffer_object"); |
| 45 } | 45 } |
| 46 | 46 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 59 gl::GLContext* GpuServiceTest::GetGLContext() { | 59 gl::GLContext* GpuServiceTest::GetGLContext() { |
| 60 return context_.get(); | 60 return context_.get(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 gl::GLSurface* GpuServiceTest::GetGLSurface() { | 63 gl::GLSurface* GpuServiceTest::GetGLSurface() { |
| 64 return surface_.get(); | 64 return surface_.get(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace gles2 | 67 } // namespace gles2 |
| 68 } // namespace gpu | 68 } // namespace gpu |
| OLD | NEW |