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 const GLuint64 kTimeout = 0xABCDEF0123456789; |
| 3604 uint32_t v32_0 = 0, v32_1 = 0; |
| 3605 GLES2Util::MapUint64ToTwoUint32(kTimeout, &v32_0, &v32_1); |
| 3606 expected.cmd.Init(client_sync_id, GL_SYNC_FLUSH_COMMANDS_BIT, |
| 3607 v32_0, v32_1, result1.id, result1.offset); |
| 3608 |
| 3609 EXPECT_CALL(*command_buffer(), OnFlush()) |
| 3610 .WillOnce(SetMemory(result1.ptr, uint32_t(GL_CONDITION_SATISFIED))) |
| 3611 .RetiresOnSaturation(); |
| 3612 |
| 3613 GLenum result = gl_->ClientWaitSync( |
| 3614 reinterpret_cast<GLsync>(client_sync_id), GL_SYNC_FLUSH_COMMANDS_BIT, |
| 3615 kTimeout); |
| 3616 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
| 3617 EXPECT_EQ(static_cast<GLenum>(GL_CONDITION_SATISFIED), result); |
| 3618 } |
| 3619 |
3594 TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) { | 3620 TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) { |
3595 ContextInitOptions init_options; | 3621 ContextInitOptions init_options; |
3596 init_options.lose_context_when_out_of_memory = true; | 3622 init_options.lose_context_when_out_of_memory = true; |
3597 ASSERT_TRUE(Initialize(init_options)); | 3623 ASSERT_TRUE(Initialize(init_options)); |
3598 | 3624 |
3599 struct Cmds { | 3625 struct Cmds { |
3600 cmds::LoseContextCHROMIUM cmd; | 3626 cmds::LoseContextCHROMIUM cmd; |
3601 }; | 3627 }; |
3602 | 3628 |
3603 GLsizei max = std::numeric_limits<GLsizei>::max(); | 3629 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) { | 3669 TEST_F(GLES2ImplementationManualInitTest, FailInitOnTransferBufferFail) { |
3644 ContextInitOptions init_options; | 3670 ContextInitOptions init_options; |
3645 init_options.transfer_buffer_initialize_fail = true; | 3671 init_options.transfer_buffer_initialize_fail = true; |
3646 EXPECT_FALSE(Initialize(init_options)); | 3672 EXPECT_FALSE(Initialize(init_options)); |
3647 } | 3673 } |
3648 | 3674 |
3649 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" | 3675 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" |
3650 | 3676 |
3651 } // namespace gles2 | 3677 } // namespace gles2 |
3652 } // namespace gpu | 3678 } // namespace gpu |
OLD | NEW |