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

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

Issue 2814583002: Service/ClientDiscardableManager (Closed)
Patch Set: rebase Created 3 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 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 62953e57dd82c5c1beb37b1ccd817e5a8290ea58..fdfcd501bbbe5a3460197db37f63be6872b1a714 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -4601,6 +4601,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