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

Side by Side 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 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 4583 matching lines...) Expand 10 before | Expand all | Expand 10 after
4594 init_options.bind_generates_resource_service = false; 4594 init_options.bind_generates_resource_service = false;
4595 EXPECT_FALSE(Initialize(init_options)); 4595 EXPECT_FALSE(Initialize(init_options));
4596 } 4596 }
4597 4597
4598 TEST_F(GLES2ImplementationManualInitTest, FailInitOnTransferBufferFail) { 4598 TEST_F(GLES2ImplementationManualInitTest, FailInitOnTransferBufferFail) {
4599 ContextInitOptions init_options; 4599 ContextInitOptions init_options;
4600 init_options.transfer_buffer_initialize_fail = true; 4600 init_options.transfer_buffer_initialize_fail = true;
4601 EXPECT_FALSE(Initialize(init_options)); 4601 EXPECT_FALSE(Initialize(init_options));
4602 } 4602 }
4603 4603
4604 TEST_F(GLES2ImplementationTest, DiscardableMemoryDelete) {
4605 const GLuint texture_id = 1;
4606 EXPECT_FALSE(share_group_->discardable_manager()->TextureIsValid(texture_id));
4607 gl_->InitializeDiscardableTextureCHROMIUM(texture_id);
4608 EXPECT_TRUE(share_group_->discardable_manager()->TextureIsValid(texture_id));
4609
4610 // Deleting a texture should clear its discardable entry.
4611 gl_->DeleteTextures(1, &texture_id);
4612 EXPECT_FALSE(share_group_->discardable_manager()->TextureIsValid(texture_id));
4613 }
4614
4615 TEST_F(GLES2ImplementationTest, DiscardableMemoryLockFail) {
4616 const GLuint texture_id = 1;
4617 gl_->InitializeDiscardableTextureCHROMIUM(texture_id);
4618 EXPECT_TRUE(share_group_->discardable_manager()->TextureIsValid(texture_id));
4619
4620 // Unlock and delete the handle.
4621 ClientDiscardableHandle client_handle =
4622 share_group_->discardable_manager()->GetHandleForTesting(texture_id);
4623 ServiceDiscardableHandle service_handle(client_handle.BufferForTesting(),
4624 client_handle.byte_offset(),
4625 client_handle.shm_id());
4626 service_handle.Unlock();
4627 EXPECT_TRUE(service_handle.Delete());
4628
4629 // Trying to re-lock the texture via GL should fail and delete the entry.
4630 EXPECT_FALSE(gl_->LockDiscardableTextureCHROMIUM(texture_id));
4631 EXPECT_FALSE(share_group_->discardable_manager()->TextureIsValid(texture_id));
4632 }
4633
4634 TEST_F(GLES2ImplementationTest, DiscardableMemoryDoubleInitError) {
4635 const GLuint texture_id = 1;
4636 gl_->InitializeDiscardableTextureCHROMIUM(texture_id);
4637 EXPECT_EQ(GL_NO_ERROR, CheckError());
4638 gl_->InitializeDiscardableTextureCHROMIUM(texture_id);
4639 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
4640 }
4641
4642 TEST_F(GLES2ImplementationTest, DiscardableMemoryLockError) {
4643 const GLuint texture_id = 1;
4644 EXPECT_FALSE(gl_->LockDiscardableTextureCHROMIUM(texture_id));
4645 EXPECT_EQ(GL_INVALID_VALUE, CheckError());
4646 }
4647
4604 #include "base/macros.h" 4648 #include "base/macros.h"
4605 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" 4649 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h"
4606 4650
4607 } // namespace gles2 4651 } // namespace gles2
4608 } // namespace gpu 4652 } // 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