summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/client/gles2_implementation_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gpu/command_buffer/client/gles2_implementation_unittest.cc')
-rw-r--r--gpu/command_buffer/client/gles2_implementation_unittest.cc29
1 files changed, 27 insertions, 2 deletions
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc
index 9320cee..dc2f419 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -73,7 +73,7 @@ class GLES2MockCommandBufferHelper : public CommandBuffer {
return kTransferBufferId;
}
- virtual void DestroyTransferBuffer(int32) { // NOLINT
+ virtual void DestroyTransferBuffer(int32 /* id */) {
GPU_NOTREACHED();
}
@@ -121,6 +121,7 @@ class MockGLES2CommandBuffer : public GLES2MockCommandBufferHelper {
// This is so we can use all the gmock functions when Flush is called.
MOCK_METHOD1(OnFlush, void(void* result));
+ MOCK_METHOD1(DestroyTransferBuffer, void(int32 id));
};
// GCC requires these declarations, but MSVC requires they not be present
@@ -383,7 +384,6 @@ class GLES2ImplementationStrictSharedTest : public GLES2ImplementationTest {
const int32 GLES2ImplementationTest::kTransferBufferId;
#endif
-
TEST_F(GLES2ImplementationTest, ShaderSource) {
const uint32 kBucketId = 1; // This id is hardcoded into GLES2Implemenation
const GLuint kShaderId = 456;
@@ -931,6 +931,31 @@ TEST_F(GLES2ImplementationTest, ReadPixelsBadFormatType) {
gl_->ReadPixels(0, 0, kWidth, kHeight, kFormat, kType, buffer.get());
}
+TEST_F(GLES2ImplementationTest, FreeUnusedSharedMemory) {
+ struct Cmds {
+ BufferSubData buf;
+ cmd::SetToken set_token;
+ };
+ const GLenum kTarget = GL_ELEMENT_ARRAY_BUFFER;
+ const GLintptr kOffset = 15;
+ const GLsizeiptr kSize = 16;
+
+ uint32 offset = 0;
+ Cmds expected;
+ expected.buf.Init(
+ kTarget, kOffset, kSize, kTransferBufferId, offset);
+ expected.set_token.Init(GetNextToken());
+
+ void* mem = gl_->MapBufferSubDataCHROMIUM(
+ kTarget, kOffset, kSize, GL_WRITE_ONLY);
+ ASSERT_TRUE(mem != NULL);
+ gl_->UnmapBufferSubDataCHROMIUM(mem);
+ EXPECT_CALL(*command_buffer_, DestroyTransferBuffer(_))\
+ .Times(1)
+ .RetiresOnSaturation();
+ gl_->FreeUnusedSharedMemory();
+}
+
TEST_F(GLES2ImplementationTest, MapUnmapBufferSubDataCHROMIUM) {
struct Cmds {
BufferSubData buf;