OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "gpu/command_buffer/service/gpu_service_test.h" |
| 6 |
| 7 #include "gpu/command_buffer/service/test_helper.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/gl/gl_context_stub_with_extensions.h" |
| 10 #include "ui/gl/gl_implementation.h" |
| 11 #include "ui/gl/gl_mock.h" |
| 12 #include "ui/gl/gl_surface.h" |
| 13 |
| 14 namespace gpu { |
| 15 namespace gles2 { |
| 16 |
| 17 GpuServiceTest::GpuServiceTest() : ran_setup_(false), ran_teardown_(false) { |
| 18 } |
| 19 |
| 20 GpuServiceTest::~GpuServiceTest() { |
| 21 DCHECK(ran_teardown_); |
| 22 } |
| 23 |
| 24 void GpuServiceTest::SetUp() { |
| 25 testing::Test::SetUp(); |
| 26 |
| 27 gfx::SetGLGetProcAddressProc(gfx::MockGLInterface::GetGLProcAddress); |
| 28 gfx::GLSurface::InitializeOneOffWithMockBindingsForTests(); |
| 29 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); |
| 30 ::gfx::MockGLInterface::SetGLInterface(gl_.get()); |
| 31 |
| 32 context_ = new gfx::GLContextStubWithExtensions; |
| 33 context_->AddExtensionsString(NULL); |
| 34 context_->SetGLVersionString("3.0"); |
| 35 gfx::GLSurface::InitializeDynamicMockBindingsForTests(context_); |
| 36 ran_setup_ = true; |
| 37 } |
| 38 |
| 39 void GpuServiceTest::TearDown() { |
| 40 DCHECK(ran_setup_); |
| 41 ::gfx::MockGLInterface::SetGLInterface(NULL); |
| 42 gl_.reset(); |
| 43 gfx::ClearGLBindings(); |
| 44 ran_teardown_ = true; |
| 45 |
| 46 testing::Test::TearDown(); |
| 47 } |
| 48 |
| 49 } // namespace gles2 |
| 50 } // namespace gpu |
OLD | NEW |