| 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 "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 bool use_default_textures = normalized_init.bind_generates_resource; | 193 bool use_default_textures = normalized_init.bind_generates_resource; |
| 194 | 194 |
| 195 InSequence sequence; | 195 InSequence sequence; |
| 196 | 196 |
| 197 surface_ = new gfx::GLSurfaceStub; | 197 surface_ = new gfx::GLSurfaceStub; |
| 198 surface_->SetSize(gfx::Size(kBackBufferWidth, kBackBufferHeight)); | 198 surface_->SetSize(gfx::Size(kBackBufferWidth, kBackBufferHeight)); |
| 199 | 199 |
| 200 // Context needs to be created before initializing ContextGroup, which will | 200 // Context needs to be created before initializing ContextGroup, which will |
| 201 // in turn initialize FeatureInfo, which needs a context to determine | 201 // in turn initialize FeatureInfo, which needs a context to determine |
| 202 // extension support. | 202 // extension support. |
| 203 context_ = new gfx::GLContextStubWithExtensions; | 203 context_ = new StrictMock<GLContextMock>(); |
| 204 context_->AddExtensionsString(normalized_init.extensions.c_str()); | 204 context_->AddExtensionsString(normalized_init.extensions.c_str()); |
| 205 context_->SetGLVersionString(normalized_init.gl_version.c_str()); | 205 context_->SetGLVersionString(normalized_init.gl_version.c_str()); |
| 206 | 206 |
| 207 context_->MakeCurrent(surface_.get()); | 207 context_->GLContextStubWithExtensions::MakeCurrent(surface_.get()); |
| 208 gfx::GLSurface::InitializeDynamicMockBindingsForTests(context_.get()); | 208 gfx::GLSurface::InitializeDynamicMockBindingsForTests(context_.get()); |
| 209 | 209 |
| 210 TestHelper::SetupContextGroupInitExpectations( | 210 TestHelper::SetupContextGroupInitExpectations( |
| 211 gl_.get(), | 211 gl_.get(), |
| 212 DisallowedFeatures(), | 212 DisallowedFeatures(), |
| 213 normalized_init.extensions.c_str(), | 213 normalized_init.extensions.c_str(), |
| 214 normalized_init.gl_version.c_str(), | 214 normalized_init.gl_version.c_str(), |
| 215 normalized_init.bind_generates_resource); | 215 normalized_init.bind_generates_resource); |
| 216 | 216 |
| 217 // We initialize the ContextGroup with a MockGLES2Decoder so that | 217 // We initialize the ContextGroup with a MockGLES2Decoder so that |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 394 |
| 395 decoder_.reset(GLES2Decoder::Create(group_.get())); | 395 decoder_.reset(GLES2Decoder::Create(group_.get())); |
| 396 decoder_->SetIgnoreCachedStateForTest(ignore_cached_state_for_test_); | 396 decoder_->SetIgnoreCachedStateForTest(ignore_cached_state_for_test_); |
| 397 decoder_->GetLogger()->set_log_synthesized_gl_errors(false); | 397 decoder_->GetLogger()->set_log_synthesized_gl_errors(false); |
| 398 decoder_->Initialize(surface_, | 398 decoder_->Initialize(surface_, |
| 399 context_, | 399 context_, |
| 400 false, | 400 false, |
| 401 surface_->GetSize(), | 401 surface_->GetSize(), |
| 402 DisallowedFeatures(), | 402 DisallowedFeatures(), |
| 403 attribs); | 403 attribs); |
| 404 EXPECT_CALL(*context_, MakeCurrent(surface_.get())).WillOnce(Return(true)); |
| 405 if (context_->WasAllocatedUsingRobustnessExtension()) { |
| 406 EXPECT_CALL(*gl_, GetGraphicsResetStatusARB()) |
| 407 .WillOnce(Return(GL_NO_ERROR)); |
| 408 } |
| 404 decoder_->MakeCurrent(); | 409 decoder_->MakeCurrent(); |
| 405 decoder_->set_engine(engine_.get()); | 410 decoder_->set_engine(engine_.get()); |
| 406 decoder_->BeginDecoding(); | 411 decoder_->BeginDecoding(); |
| 407 | 412 |
| 408 EXPECT_CALL(*gl_, GenBuffersARB(_, _)) | 413 EXPECT_CALL(*gl_, GenBuffersARB(_, _)) |
| 409 .WillOnce(SetArgumentPointee<1>(kServiceBufferId)) | 414 .WillOnce(SetArgumentPointee<1>(kServiceBufferId)) |
| 410 .RetiresOnSaturation(); | 415 .RetiresOnSaturation(); |
| 411 GenHelper<cmds::GenBuffersImmediate>(client_buffer_id_); | 416 GenHelper<cmds::GenBuffersImmediate>(client_buffer_id_); |
| 412 EXPECT_CALL(*gl_, GenFramebuffersEXT(_, _)) | 417 EXPECT_CALL(*gl_, GenFramebuffersEXT(_, _)) |
| 413 .WillOnce(SetArgumentPointee<1>(kServiceFramebufferId)) | 418 .WillOnce(SetArgumentPointee<1>(kServiceFramebufferId)) |
| (...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1784 SetupDefaultProgram(); | 1789 SetupDefaultProgram(); |
| 1785 } | 1790 } |
| 1786 | 1791 |
| 1787 // Include the auto-generated part of this file. We split this because it means | 1792 // Include the auto-generated part of this file. We split this because it means |
| 1788 // we can easily edit the non-auto generated parts right here in this file | 1793 // we can easily edit the non-auto generated parts right here in this file |
| 1789 // instead of having to edit some template or the code generator. | 1794 // instead of having to edit some template or the code generator. |
| 1790 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" | 1795 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" |
| 1791 | 1796 |
| 1792 } // namespace gles2 | 1797 } // namespace gles2 |
| 1793 } // namespace gpu | 1798 } // namespace gpu |
| OLD | NEW |