OLD | NEW |
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 <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 3565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3576 struct Cmds { | 3576 struct Cmds { |
3577 cmds::IsEnabled cmd; | 3577 cmds::IsEnabled cmd; |
3578 }; | 3578 }; |
3579 | 3579 |
3580 Cmds expected; | 3580 Cmds expected; |
3581 ExpectedMemoryInfo result1 = | 3581 ExpectedMemoryInfo result1 = |
3582 GetExpectedResultMemory(sizeof(cmds::IsEnabled::Result)); | 3582 GetExpectedResultMemory(sizeof(cmds::IsEnabled::Result)); |
3583 expected.cmd.Init(kCap, result1.id, result1.offset); | 3583 expected.cmd.Init(kCap, result1.id, result1.offset); |
3584 | 3584 |
3585 EXPECT_CALL(*command_buffer(), OnFlush()) | 3585 EXPECT_CALL(*command_buffer(), OnFlush()) |
3586 .WillOnce(SetMemory(result1.ptr, uint32_t(kCap))) | 3586 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_TRUE))) |
3587 .RetiresOnSaturation(); | 3587 .RetiresOnSaturation(); |
3588 | 3588 |
3589 GLboolean result = gl_->IsEnabled(kCap); | 3589 GLboolean result = gl_->IsEnabled(kCap); |
3590 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 3590 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
3591 EXPECT_TRUE(result); | 3591 EXPECT_TRUE(result); |
3592 } | 3592 } |
3593 | 3593 |
| 3594 TEST_F(GLES2ImplementationTest, ClientWaitSync) { |
| 3595 const GLuint client_sync_id = 36; |
| 3596 struct Cmds { |
| 3597 cmds::ClientWaitSync cmd; |
| 3598 }; |
| 3599 |
| 3600 Cmds expected; |
| 3601 ExpectedMemoryInfo result1 = |
| 3602 GetExpectedResultMemory(sizeof(cmds::ClientWaitSync::Result)); |
| 3603 GLuint64Union mapping; |
| 3604 mapping.param64 = 0xABCDEF0123456789; |
| 3605 expected.cmd.Init(client_sync_id, mapping.param32[0], mapping.param32[1], |
| 3606 result1.id, result1.offset); |
| 3607 |
| 3608 EXPECT_CALL(*command_buffer(), OnFlush()) |
| 3609 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_CONDITION_SATISFIED))) |
| 3610 .RetiresOnSaturation(); |
| 3611 |
| 3612 GLenum result = gl_->ClientWaitSync( |
| 3613 reinterpret_cast<GLsync>(client_sync_id), GL_SYNC_FLUSH_COMMANDS_BIT, |
| 3614 mapping.param64); |
| 3615 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 3616 EXPECT_EQ(static_cast<GLenum>(GL_CONDITION_SATISFIED), result); |
| 3617 } |
| 3618 |
3594 TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) { | 3619 TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) { |
3595 ContextInitOptions init_options; | 3620 ContextInitOptions init_options; |
3596 init_options.lose_context_when_out_of_memory = true; | 3621 init_options.lose_context_when_out_of_memory = true; |
3597 ASSERT_TRUE(Initialize(init_options)); | 3622 ASSERT_TRUE(Initialize(init_options)); |
3598 | 3623 |
3599 struct Cmds { | 3624 struct Cmds { |
3600 cmds::LoseContextCHROMIUM cmd; | 3625 cmds::LoseContextCHROMIUM cmd; |
3601 }; | 3626 }; |
3602 | 3627 |
3603 GLsizei max = std::numeric_limits<GLsizei>::max(); | 3628 GLsizei max = std::numeric_limits<GLsizei>::max(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3643 TEST_F(GLES2ImplementationManualInitTest, FailInitOnTransferBufferFail) { | 3668 TEST_F(GLES2ImplementationManualInitTest, FailInitOnTransferBufferFail) { |
3644 ContextInitOptions init_options; | 3669 ContextInitOptions init_options; |
3645 init_options.transfer_buffer_initialize_fail = true; | 3670 init_options.transfer_buffer_initialize_fail = true; |
3646 EXPECT_FALSE(Initialize(init_options)); | 3671 EXPECT_FALSE(Initialize(init_options)); |
3647 } | 3672 } |
3648 | 3673 |
3649 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" | 3674 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" |
3650 | 3675 |
3651 } // namespace gles2 | 3676 } // namespace gles2 |
3652 } // namespace gpu | 3677 } // namespace gpu |
OLD | NEW |