Chromium Code Reviews| Index: gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc |
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc |
| index 484f3a0264b821a8bd397b45205955f344a6c0bd..abf12a0ef1be33d4752bf836b42f247ae3ef8b43 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc |
| @@ -159,8 +159,7 @@ GLES2DecoderTestBase::InitState::InitState() |
| bind_generates_resource(false), |
| lose_context_when_out_of_memory(false), |
| use_native_vao(true), |
| - webgl_version(0) { |
| -} |
| + context_type(ContextCreationAttribHelper::CONTEXT_TYPE_OPENGLES2) {} |
| void GLES2DecoderTestBase::InitDecoder(const InitState& init) { |
| InitDecoderWithCommandLine(init, NULL); |
| @@ -224,13 +223,29 @@ void GLES2DecoderTestBase::InitDecoderWithCommandLine( |
| EXPECT_CALL(*mock_decoder_, DoCommands(_, _, _, _)).WillRepeatedly( |
| Invoke(mock_decoder_.get(), &MockGLES2Decoder::FakeDoCommands)); |
| + ContextGroup::ContextType context_type; |
| + switch (init.context_type) { |
| + case ContextCreationAttribHelper::CONTEXT_TYPE_WEBGL1: |
| + context_type = ContextGroup::CONTEXT_TYPE_WEBGL1; |
| + break; |
| + case ContextCreationAttribHelper::CONTEXT_TYPE_WEBGL2: |
| + context_type = ContextGroup::CONTEXT_TYPE_WEBGL2; |
| + break; |
| + default: |
|
Zhenyao Mo
2015/08/28 17:16:25
nit: move default to the last.
|
| + NOTREACHED(); |
| + case ContextCreationAttribHelper::CONTEXT_TYPE_OPENGLES2: |
| + context_type = ContextGroup::CONTEXT_TYPE_OPENGLES2; |
| + break; |
| + case ContextCreationAttribHelper::CONTEXT_TYPE_OPENGLES3: |
| + context_type = ContextGroup::CONTEXT_TYPE_OPENGLES3; |
| + break; |
| + } |
| - EXPECT_TRUE(group_->Initialize( |
| - mock_decoder_.get(), |
| - ContextGroup::GetContextType(init.webgl_version), |
| - DisallowedFeatures())); |
| + EXPECT_TRUE(group_->Initialize(mock_decoder_.get(), context_type, |
| + DisallowedFeatures())); |
| - if (init.webgl_version == 2) { |
| + if (context_type == ContextGroup::CONTEXT_TYPE_WEBGL2 || |
| + context_type == ContextGroup::CONTEXT_TYPE_OPENGLES3) { |
| EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_COLOR_ATTACHMENTS, _)) |
| .WillOnce(SetArgumentPointee<1>(kMaxColorAttachments)) |
| .RetiresOnSaturation(); |
| @@ -402,29 +417,25 @@ void GLES2DecoderTestBase::InitDecoderWithCommandLine( |
| static const int32 kLoseContextWhenOutOfMemory = 0x10002; |
| static const int32 kWebGLVersion = 0x10003; |
| - int32 attributes[] = { |
| - EGL_ALPHA_SIZE, |
| - normalized_init.request_alpha ? 8 : 0, |
| - EGL_DEPTH_SIZE, |
| - normalized_init.request_depth ? 24 : 0, |
| - EGL_STENCIL_SIZE, |
| - normalized_init.request_stencil ? 8 : 0, |
| - kLoseContextWhenOutOfMemory, |
| - normalized_init.lose_context_when_out_of_memory ? 1 : 0, |
| - kWebGLVersion, |
| - init.webgl_version |
| - }; |
| + int32 attributes[] = {EGL_ALPHA_SIZE, |
| + normalized_init.request_alpha ? 8 : 0, |
| + EGL_DEPTH_SIZE, |
| + normalized_init.request_depth ? 24 : 0, |
| + EGL_STENCIL_SIZE, |
| + normalized_init.request_stencil ? 8 : 0, |
| + kLoseContextWhenOutOfMemory, |
| + normalized_init.lose_context_when_out_of_memory ? 1 : 0, |
| + kWebGLVersion, |
| + init.context_type}; |
| std::vector<int32> attribs(attributes, attributes + arraysize(attributes)); |
| decoder_.reset(GLES2Decoder::Create(group_.get())); |
| decoder_->SetIgnoreCachedStateForTest(ignore_cached_state_for_test_); |
| decoder_->GetLogger()->set_log_synthesized_gl_errors(false); |
| - decoder_->Initialize(surface_, |
| - context_, |
| - false, |
| - surface_->GetSize(), |
| - DisallowedFeatures(), |
| - attribs); |
| + ASSERT_TRUE(decoder_->Initialize(surface_, context_, false, |
| + surface_->GetSize(), DisallowedFeatures(), |
| + attribs)); |
| + |
| EXPECT_CALL(*context_, MakeCurrent(surface_.get())).WillOnce(Return(true)); |
| if (context_->WasAllocatedUsingRobustnessExtension()) { |
| EXPECT_CALL(*gl_, GetGraphicsResetStatusARB()) |