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

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

Issue 10388131: Allow GLES2CmdDecoder to change the GLSurface associated with the default FBO. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
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.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include "base/atomicops.h" 7 #include "base/atomicops.h"
8 #include "gpu/command_buffer/common/gl_mock.h" 8 #include "gpu/command_buffer/common/gl_mock.h"
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" 9 #include "gpu/command_buffer/common/gles2_cmd_format.h"
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
11 #include "gpu/command_buffer/common/id_allocator.h" 11 #include "gpu/command_buffer/common/id_allocator.h"
12 #include "gpu/command_buffer/service/cmd_buffer_engine.h" 12 #include "gpu/command_buffer/service/cmd_buffer_engine.h"
13 #include "gpu/command_buffer/service/context_group.h" 13 #include "gpu/command_buffer/service/context_group.h"
14 #include "gpu/command_buffer/service/gl_surface_mock.h"
14 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" 15 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h"
15 #include "gpu/command_buffer/service/mailbox_manager.h" 16 #include "gpu/command_buffer/service/mailbox_manager.h"
16 #include "gpu/command_buffer/service/program_manager.h" 17 #include "gpu/command_buffer/service/program_manager.h"
17 #include "gpu/command_buffer/service/stream_texture_manager_mock.h" 18 #include "gpu/command_buffer/service/stream_texture_manager_mock.h"
18 #include "gpu/command_buffer/service/stream_texture_mock.h" 19 #include "gpu/command_buffer/service/stream_texture_mock.h"
19 #include "gpu/command_buffer/service/test_helper.h" 20 #include "gpu/command_buffer/service/test_helper.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 #include "ui/gl/gl_implementation.h" 22 #include "ui/gl/gl_implementation.h"
22 #include "ui/gl/gl_surface_stub.h" 23 #include "ui/gl/gl_surface_stub.h"
23 24
25
24 #if !defined(GL_DEPTH24_STENCIL8) 26 #if !defined(GL_DEPTH24_STENCIL8)
25 #define GL_DEPTH24_STENCIL8 0x88F0 27 #define GL_DEPTH24_STENCIL8 0x88F0
26 #endif 28 #endif
27 29
28 using ::gfx::MockGLInterface; 30 using ::gfx::MockGLInterface;
29 using ::testing::_; 31 using ::testing::_;
30 using ::testing::DoAll; 32 using ::testing::DoAll;
31 using ::testing::InSequence; 33 using ::testing::InSequence;
32 using ::testing::Invoke; 34 using ::testing::Invoke;
33 using ::testing::MatcherCast; 35 using ::testing::MatcherCast;
(...skipping 6971 matching lines...) Expand 10 before | Expand all | Expand 10 after
7005 EXPECT_EQ(2, width); 7007 EXPECT_EQ(2, width);
7006 EXPECT_EQ(4, height); 7008 EXPECT_EQ(4, height);
7007 EXPECT_TRUE(info->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format)); 7009 EXPECT_TRUE(info->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format));
7008 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); 7010 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format);
7009 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); 7011 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type);
7010 7012
7011 // Service ID is restored. 7013 // Service ID is restored.
7012 EXPECT_EQ(kServiceTextureId, info->service_id()); 7014 EXPECT_EQ(kServiceTextureId, info->service_id());
7013 } 7015 }
7014 7016
7017
7018 TEST_F(GLES2DecoderTest, CanChangeSurface) {
7019 scoped_refptr<GLSurfaceMock> other_surface(new GLSurfaceMock);
7020 EXPECT_CALL(*other_surface.get(), GetBackingFrameBufferObject()).
7021 WillOnce(Return(7));
7022 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_FRAMEBUFFER_EXT, 7));
7023
7024 decoder_->SetSurface(other_surface);
7025 }
7026
7015 TEST_F(GLES2DecoderTest, IsEnabledReturnsCachedValue) { 7027 TEST_F(GLES2DecoderTest, IsEnabledReturnsCachedValue) {
7016 // NOTE: There are no expectations because no GL functions should be 7028 // NOTE: There are no expectations because no GL functions should be
7017 // called for DEPTH_TEST or STENCIL_TEST 7029 // called for DEPTH_TEST or STENCIL_TEST
7018 static const GLenum kStates[] = { 7030 static const GLenum kStates[] = {
7019 GL_DEPTH_TEST, 7031 GL_DEPTH_TEST,
7020 GL_STENCIL_TEST, 7032 GL_STENCIL_TEST,
7021 }; 7033 };
7022 for (size_t ii = 0; ii < arraysize(kStates); ++ii) { 7034 for (size_t ii = 0; ii < arraysize(kStates); ++ii) {
7023 Enable enable_cmd; 7035 Enable enable_cmd;
7024 GLenum state = kStates[ii]; 7036 GLenum state = kStates[ii];
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
7067 // TODO(gman): TexImage2DImmediate 7079 // TODO(gman): TexImage2DImmediate
7068 7080
7069 // TODO(gman): TexSubImage2DImmediate 7081 // TODO(gman): TexSubImage2DImmediate
7070 7082
7071 // TODO(gman): UseProgram 7083 // TODO(gman): UseProgram
7072 7084
7073 // TODO(gman): SwapBuffers 7085 // TODO(gman): SwapBuffers
7074 7086
7075 } // namespace gles2 7087 } // namespace gles2
7076 } // namespace gpu 7088 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_mock.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698