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

Unified Diff: gpu/command_buffer/client/gles2_implementation_unittest.cc

Issue 2818993002: GL Implementation for GPU Discardable
Patch Set: rebase Created 3 years, 8 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/client/gles2_implementation_unittest.cc
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc
index f193dc5544565130b0f5a934d5a47cb5db9a56cf..cecc593333bb4f7e9910605ec7b4294a0c09bf91 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -4630,6 +4630,50 @@ TEST_F(GLES2ImplementationManualInitTest, FailInitOnTransferBufferFail) {
EXPECT_FALSE(Initialize(init_options));
}
+TEST_F(GLES2ImplementationTest, DiscardableMemoryDelete) {
+ const GLuint texture_id = 1;
+ EXPECT_FALSE(share_group_->discardable_manager()->TextureIsValid(texture_id));
+ gl_->InitializeDiscardableTextureCHROMIUM(texture_id);
+ EXPECT_TRUE(share_group_->discardable_manager()->TextureIsValid(texture_id));
+
+ // Deleting a texture should clear its discardable entry.
+ gl_->DeleteTextures(1, &texture_id);
+ EXPECT_FALSE(share_group_->discardable_manager()->TextureIsValid(texture_id));
+}
+
+TEST_F(GLES2ImplementationTest, DiscardableMemoryLockFail) {
+ const GLuint texture_id = 1;
+ gl_->InitializeDiscardableTextureCHROMIUM(texture_id);
+ EXPECT_TRUE(share_group_->discardable_manager()->TextureIsValid(texture_id));
+
+ // Unlock and delete the handle.
+ ClientDiscardableHandle client_handle =
+ share_group_->discardable_manager()->GetHandleForTesting(texture_id);
+ ServiceDiscardableHandle service_handle(client_handle.BufferForTesting(),
+ client_handle.byte_offset(),
+ client_handle.shm_id());
+ service_handle.Unlock();
+ EXPECT_TRUE(service_handle.Delete());
+
+ // Trying to re-lock the texture via GL should fail and delete the entry.
+ EXPECT_FALSE(gl_->LockDiscardableTextureCHROMIUM(texture_id));
+ EXPECT_FALSE(share_group_->discardable_manager()->TextureIsValid(texture_id));
+}
+
+TEST_F(GLES2ImplementationTest, DiscardableMemoryDoubleInitError) {
+ const GLuint texture_id = 1;
+ gl_->InitializeDiscardableTextureCHROMIUM(texture_id);
+ EXPECT_EQ(GL_NO_ERROR, CheckError());
+ gl_->InitializeDiscardableTextureCHROMIUM(texture_id);
+ EXPECT_EQ(GL_INVALID_VALUE, CheckError());
+}
+
+TEST_F(GLES2ImplementationTest, DiscardableMemoryLockError) {
+ const GLuint texture_id = 1;
+ EXPECT_FALSE(gl_->LockDiscardableTextureCHROMIUM(texture_id));
+ EXPECT_EQ(GL_INVALID_VALUE, CheckError());
+}
+
#include "base/macros.h"
#include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h"
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation_autogen.h ('k') | gpu/command_buffer/client/gles2_interface_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698