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 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1711 GetDecoder()->SetDescheduleUntilFinishedCallback( | 1711 GetDecoder()->SetDescheduleUntilFinishedCallback( |
1712 base::Bind(&GLES2DecoderDescheduleUntilFinishedTest:: | 1712 base::Bind(&GLES2DecoderDescheduleUntilFinishedTest:: |
1713 DescheduleUntilFinishedCallback, | 1713 DescheduleUntilFinishedCallback, |
1714 base::Unretained(this))); | 1714 base::Unretained(this))); |
1715 GetDecoder()->SetRescheduleAfterFinishedCallback( | 1715 GetDecoder()->SetRescheduleAfterFinishedCallback( |
1716 base::Bind(&GLES2DecoderDescheduleUntilFinishedTest:: | 1716 base::Bind(&GLES2DecoderDescheduleUntilFinishedTest:: |
1717 RescheduleAfterFinishedCallback, | 1717 RescheduleAfterFinishedCallback, |
1718 base::Unretained(this))); | 1718 base::Unretained(this))); |
1719 | 1719 |
1720 EXPECT_CALL(*gl_, FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0)) | 1720 EXPECT_CALL(*gl_, FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0)) |
1721 .Times(1) | 1721 .Times(2) |
1722 .WillOnce(Return(sync_service_id_)) | 1722 .WillOnce(Return(sync_service_id_)) |
| 1723 .WillOnce(Return(sync_service_id2_)) |
1723 .RetiresOnSaturation(); | 1724 .RetiresOnSaturation(); |
1724 EXPECT_CALL(*gl_, IsSync(sync_service_id_)).WillRepeatedly(Return(GL_TRUE)); | 1725 EXPECT_CALL(*gl_, IsSync(sync_service_id_)).WillRepeatedly(Return(GL_TRUE)); |
1725 EXPECT_CALL(*gl_, Flush()).RetiresOnSaturation(); | 1726 EXPECT_CALL(*gl_, Flush()).Times(2).RetiresOnSaturation(); |
1726 EXPECT_CALL(*gl_, DeleteSync(sync_service_id_)) | 1727 EXPECT_CALL(*gl_, DeleteSync(sync_service_id_)) |
1727 .Times(1) | 1728 .Times(1) |
1728 .RetiresOnSaturation(); | 1729 .RetiresOnSaturation(); |
| 1730 EXPECT_CALL(*gl_, DeleteSync(sync_service_id2_)) |
| 1731 .Times(1) |
| 1732 .RetiresOnSaturation(); |
1729 } | 1733 } |
1730 | 1734 |
1731 void DescheduleUntilFinishedCallback() { | 1735 void DescheduleUntilFinishedCallback() { |
1732 deschedule_until_finished_callback_count_++; | 1736 deschedule_until_finished_callback_count_++; |
1733 } | 1737 } |
1734 void RescheduleAfterFinishedCallback() { | 1738 void RescheduleAfterFinishedCallback() { |
1735 reschedule_after_finished_callback_count_++; | 1739 reschedule_after_finished_callback_count_++; |
1736 } | 1740 } |
1737 | 1741 |
1738 protected: | 1742 protected: |
1739 int deschedule_until_finished_callback_count_ = 0; | 1743 int deschedule_until_finished_callback_count_ = 0; |
1740 int reschedule_after_finished_callback_count_ = 0; | 1744 int reschedule_after_finished_callback_count_ = 0; |
1741 GLsync sync_service_id_ = reinterpret_cast<GLsync>(0x15); | 1745 GLsync sync_service_id_ = reinterpret_cast<GLsync>(0x15); |
| 1746 GLsync sync_service_id2_ = reinterpret_cast<GLsync>(0x15); |
1742 }; | 1747 }; |
1743 | 1748 |
1744 TEST_P(GLES2DecoderDescheduleUntilFinishedTest, AlreadySignalled) { | 1749 TEST_P(GLES2DecoderDescheduleUntilFinishedTest, AlreadySignalled) { |
1745 EXPECT_CALL(*gl_, ClientWaitSync(sync_service_id_, 0, 0)) | 1750 EXPECT_CALL(*gl_, ClientWaitSync(sync_service_id_, 0, 0)) |
1746 .Times(1) | 1751 .Times(1) |
1747 .WillOnce(Return(GL_ALREADY_SIGNALED)) | 1752 .WillOnce(Return(GL_ALREADY_SIGNALED)) |
1748 .RetiresOnSaturation(); | 1753 .RetiresOnSaturation(); |
1749 | 1754 |
1750 cmds::DescheduleUntilFinishedCHROMIUM cmd; | 1755 cmds::DescheduleUntilFinishedCHROMIUM cmd; |
1751 cmd.Init(); | 1756 cmd.Init(); |
1752 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1757 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1753 EXPECT_EQ(0, deschedule_until_finished_callback_count_); | 1758 EXPECT_EQ(0, deschedule_until_finished_callback_count_); |
1754 EXPECT_EQ(0, reschedule_after_finished_callback_count_); | 1759 EXPECT_EQ(0, reschedule_after_finished_callback_count_); |
| 1760 |
| 1761 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1762 EXPECT_EQ(0, deschedule_until_finished_callback_count_); |
| 1763 EXPECT_EQ(0, reschedule_after_finished_callback_count_); |
1755 } | 1764 } |
1756 | 1765 |
1757 TEST_P(GLES2DecoderDescheduleUntilFinishedTest, NotYetSignalled) { | 1766 TEST_P(GLES2DecoderDescheduleUntilFinishedTest, NotYetSignalled) { |
1758 EXPECT_CALL(*gl_, ClientWaitSync(sync_service_id_, 0, 0)) | 1767 EXPECT_CALL(*gl_, ClientWaitSync(sync_service_id_, 0, 0)) |
1759 .Times(1) | 1768 .Times(1) |
1760 .WillOnce(Return(GL_TIMEOUT_EXPIRED)) | 1769 .WillOnce(Return(GL_TIMEOUT_EXPIRED)) |
1761 .RetiresOnSaturation(); | 1770 .RetiresOnSaturation(); |
1762 | 1771 |
1763 cmds::DescheduleUntilFinishedCHROMIUM cmd; | 1772 cmds::DescheduleUntilFinishedCHROMIUM cmd; |
1764 cmd.Init(); | 1773 cmd.Init(); |
| 1774 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1775 EXPECT_EQ(0, deschedule_until_finished_callback_count_); |
| 1776 EXPECT_EQ(0, reschedule_after_finished_callback_count_); |
| 1777 |
1765 EXPECT_EQ(error::kDeferLaterCommands, ExecuteCmd(cmd)); | 1778 EXPECT_EQ(error::kDeferLaterCommands, ExecuteCmd(cmd)); |
1766 EXPECT_EQ(1, deschedule_until_finished_callback_count_); | 1779 EXPECT_EQ(1, deschedule_until_finished_callback_count_); |
1767 EXPECT_EQ(0, reschedule_after_finished_callback_count_); | 1780 EXPECT_EQ(0, reschedule_after_finished_callback_count_); |
1768 } | 1781 } |
1769 | 1782 |
1770 void GLES3DecoderWithESSL3ShaderTest::SetUp() { | 1783 void GLES3DecoderWithESSL3ShaderTest::SetUp() { |
1771 base::CommandLine command_line(0, nullptr); | 1784 base::CommandLine command_line(0, nullptr); |
1772 command_line.AppendSwitch(switches::kEnableUnsafeES3APIs); | 1785 command_line.AppendSwitch(switches::kEnableUnsafeES3APIs); |
1773 InitState init; | 1786 InitState init; |
1774 init.gl_version = "OpenGL ES 3.0"; | 1787 init.gl_version = "OpenGL ES 3.0"; |
(...skipping 20 matching lines...) Expand all Loading... |
1795 ::testing::Bool()); | 1808 ::testing::Bool()); |
1796 | 1809 |
1797 INSTANTIATE_TEST_CASE_P(Service, GLES3DecoderTest, ::testing::Bool()); | 1810 INSTANTIATE_TEST_CASE_P(Service, GLES3DecoderTest, ::testing::Bool()); |
1798 | 1811 |
1799 INSTANTIATE_TEST_CASE_P(Service, | 1812 INSTANTIATE_TEST_CASE_P(Service, |
1800 GLES3DecoderWithESSL3ShaderTest, | 1813 GLES3DecoderWithESSL3ShaderTest, |
1801 ::testing::Bool()); | 1814 ::testing::Bool()); |
1802 | 1815 |
1803 } // namespace gles2 | 1816 } // namespace gles2 |
1804 } // namespace gpu | 1817 } // namespace gpu |
OLD | NEW |