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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.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/service/gles2_cmd_decoder_unittest_textures.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
index f406797044929a09994165ae752da389cf5ae936..4bc8db68ddd1fa8fed2216893e86c6e6432e618a 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
@@ -21,6 +21,7 @@
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/mocks.h"
#include "gpu/command_buffer/service/program_manager.h"
+#include "gpu/command_buffer/service/service_discardable_manager.h"
#include "gpu/command_buffer/service/test_helper.h"
#include "gpu/config/gpu_switches.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -4859,6 +4860,38 @@ TEST_P(WebGL2DecoderTest, TexSwizzleDisabled) {
}
}
+TEST_P(GLES2DecoderTest, TestInitDiscardableTexture) {
+ EXPECT_EQ(0u, group().discardable_manager()->NumCacheEntriesForTesting());
+ DoInitializeDiscardableTextureCHROMIUM(client_texture_id_);
+ EXPECT_EQ(1u, group().discardable_manager()->NumCacheEntriesForTesting());
+}
+
+TEST_P(GLES2DecoderTest, TestInitInvalidDiscardableTexture) {
+ EXPECT_EQ(0u, group().discardable_manager()->NumCacheEntriesForTesting());
+ DoInitializeDiscardableTextureCHROMIUM(0);
+ EXPECT_EQ(0u, group().discardable_manager()->NumCacheEntriesForTesting());
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+}
+
+TEST_P(GLES2DecoderTest, TestUnlockDiscardableTexture) {
+ const ContextGroup& context_group = group();
+ EXPECT_EQ(0u, group().discardable_manager()->NumCacheEntriesForTesting());
+ DoInitializeDiscardableTextureCHROMIUM(client_texture_id_);
+ EXPECT_TRUE(context_group.discardable_manager()->IsEntryLockedForTesting(
+ client_texture_id_, &context_group));
+ DoUnlockDiscardableTextureCHROMIUM(client_texture_id_);
+ EXPECT_FALSE(context_group.discardable_manager()->IsEntryLockedForTesting(
+ client_texture_id_, &context_group));
+}
+
+TEST_P(GLES2DecoderTest, TestDeleteDiscardableTexture) {
+ EXPECT_EQ(0u, group().discardable_manager()->NumCacheEntriesForTesting());
+ DoInitializeDiscardableTextureCHROMIUM(client_texture_id_);
+ EXPECT_EQ(1u, group().discardable_manager()->NumCacheEntriesForTesting());
+ DoDeleteTexture(client_texture_id_, kServiceTextureId);
+ EXPECT_EQ(0u, group().discardable_manager()->NumCacheEntriesForTesting());
+}
+
// TODO(gman): Complete this test.
// TEST_P(GLES2DecoderTest, CompressedTexImage2DGLError) {
// }

Powered by Google App Engine
This is Rietveld 408576698