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

Side by Side 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 unified diff | Download patch
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 // Tests for GLES2Implementation. 5 // Tests for GLES2Implementation.
6 6
7 #include "gpu/command_buffer/client/gles2_implementation.h" 7 #include "gpu/command_buffer/client/gles2_implementation.h"
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 4612 matching lines...) Expand 10 before | Expand all | Expand 10 after
4623 init_options.bind_generates_resource_service = false; 4623 init_options.bind_generates_resource_service = false;
4624 EXPECT_FALSE(Initialize(init_options)); 4624 EXPECT_FALSE(Initialize(init_options));
4625 } 4625 }
4626 4626
4627 TEST_F(GLES2ImplementationManualInitTest, FailInitOnTransferBufferFail) { 4627 TEST_F(GLES2ImplementationManualInitTest, FailInitOnTransferBufferFail) {
4628 ContextInitOptions init_options; 4628 ContextInitOptions init_options;
4629 init_options.transfer_buffer_initialize_fail = true; 4629 init_options.transfer_buffer_initialize_fail = true;
4630 EXPECT_FALSE(Initialize(init_options)); 4630 EXPECT_FALSE(Initialize(init_options));
4631 } 4631 }
4632 4632
4633 TEST_F(GLES2ImplementationTest, DiscardableMemoryDelete) {
4634 const GLuint texture_id = 1;
4635 EXPECT_FALSE(share_group_->discardable_manager()->TextureIsValid(texture_id));
4636 gl_->InitializeDiscardableTextureCHROMIUM(texture_id);
4637 EXPECT_TRUE(share_group_->discardable_manager()->TextureIsValid(texture_id));
4638
4639 // Deleting a texture should clear its discardable entry.
4640 gl_->DeleteTextures(1, &texture_id);
4641 EXPECT_FALSE(share_group_->discardable_manager()->TextureIsValid(texture_id));
4642 }
4643
4644 TEST_F(GLES2ImplementationTest, DiscardableMemoryLockFail) {
4645 const GLuint texture_id = 1;
4646 gl_->InitializeDiscardableTextureCHROMIUM(texture_id);
4647 EXPECT_TRUE(share_group_->discardable_manager()->TextureIsValid(texture_id));
4648
4649 // Unlock and delete the handle.
4650 ClientDiscardableHandle client_handle =
4651 share_group_->discardable_manager()->GetHandleForTesting(texture_id);
4652 ServiceDiscardableHandle service_handle(client_handle.BufferForTesting(),
4653 client_handle.byte_offset(),
4654 client_handle.shm_id());
4655 service_handle.Unlock();
4656 EXPECT_TRUE(service_handle.Delete());
4657
4658 // Trying to re-lock the texture via GL should fail and delete the entry.
4659 EXPECT_FALSE(gl_->LockDiscardableTextureCHROMIUM(texture_id));
4660 EXPECT_FALSE(share_group_->discardable_manager()->TextureIsValid(texture_id));
4661 }
4662
4663 TEST_F(GLES2ImplementationTest, DiscardableMemoryDoubleInitError) {
4664 const GLuint texture_id = 1;
4665 gl_->InitializeDiscardableTextureCHROMIUM(texture_id);
4666 EXPECT_EQ(GL_NO_ERROR, CheckError());
4667 gl_->InitializeDiscardableTextureCHROMIUM(texture_id);
4668 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
4669 }
4670
4671 TEST_F(GLES2ImplementationTest, DiscardableMemoryLockError) {
4672 const GLuint texture_id = 1;
4673 EXPECT_FALSE(gl_->LockDiscardableTextureCHROMIUM(texture_id));
4674 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
4675 }
4676
4633 #include "base/macros.h" 4677 #include "base/macros.h"
4634 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" 4678 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h"
4635 4679
4636 } // namespace gles2 4680 } // namespace gles2
4637 } // namespace gpu 4681 } // namespace gpu
OLDNEW
« 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