Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Side by Side Diff: gpu/command_buffer/service/gpu_service_test.cc

Issue 2129043003: Make dynamic mock bindings initialization consistent with other GL implementations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_with_extensions.h"
10 #include "ui/gl/gl_implementation.h" 10 #include "ui/gl/gl_implementation.h"
(...skipping 19 matching lines...) Expand all
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::GLContextStubWithExtensions;
36 context_->AddExtensionsString(gl_extensions); 36 context_->AddExtensionsString(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 gl::GLSurfaceTestSupport::InitializeDynamicMockBindings(context_.get());
41 ran_setup_ = true; 40 ran_setup_ = true;
42 } 41 }
43 42
44 void GpuServiceTest::SetUp() { 43 void GpuServiceTest::SetUp() {
45 SetUpWithGLVersion("2.0", "GL_EXT_framebuffer_object"); 44 SetUpWithGLVersion("2.0", "GL_EXT_framebuffer_object");
46 } 45 }
47 46
48 void GpuServiceTest::TearDown() { 47 void GpuServiceTest::TearDown() {
49 DCHECK(ran_setup_); 48 DCHECK(ran_setup_);
50 context_ = nullptr; 49 context_ = nullptr;
51 surface_ = nullptr; 50 surface_ = nullptr;
52 ::gl::MockGLInterface::SetGLInterface(NULL); 51 ::gl::MockGLInterface::SetGLInterface(NULL);
53 gl_.reset(); 52 gl_.reset();
54 gl::init::ClearGLBindings(); 53 gl::init::ClearGLBindings();
55 ran_teardown_ = true; 54 ran_teardown_ = true;
56 55
57 testing::Test::TearDown(); 56 testing::Test::TearDown();
58 } 57 }
59 58
60 gl::GLContext* GpuServiceTest::GetGLContext() { 59 gl::GLContext* GpuServiceTest::GetGLContext() {
61 return context_.get(); 60 return context_.get();
62 } 61 }
63 62
64 gl::GLSurface* GpuServiceTest::GetGLSurface() { 63 gl::GLSurface* GpuServiceTest::GetGLSurface() {
65 return surface_.get(); 64 return surface_.get();
66 } 65 }
67 66
68 } // namespace gles2 67 } // namespace gles2
69 } // namespace gpu 68 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc ('k') | gpu/ipc/service/gpu_channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698