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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc

Issue 1325433003: command_buffer: Add support for creating non-WebGL ES 3 contexts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
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())

Powered by Google App Engine
This is Rietveld 408576698