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

Unified Diff: gpu/command_buffer/client/gles2_implementation_unittest.cc

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/client/gles2_implementation_unittest.cc
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc
index 62f108b06d24eb5461b3cd1544140f65b03432d3..ef2efeba0f2d77c10897288996f3d8c2f7315c56 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -3884,6 +3884,36 @@ TEST_F(GLES2ImplementationTest, WaitSyncTokenCHROMIUM) {
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
+TEST_F(GLES2ImplementationTest, WaitSyncTokenCHROMIUMErrors) {
+ ExpectedMemoryInfo result =
+ GetExpectedResultMemory(sizeof(cmds::GetError::Result));
+ EXPECT_CALL(*command_buffer(), OnFlush())
+ .WillRepeatedly(SetMemory(result.ptr, GLuint(GL_NO_ERROR)))
+ .RetiresOnSaturation();
+
+ // Empty sync tokens should be produce no error and be a nop.
+ ClearCommands();
+ gl_->WaitSyncTokenCHROMIUM(nullptr);
+ EXPECT_TRUE(NoCommandsWritten());
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), gl_->GetError());
+
+ // Invalid sync tokens should produce no error and be a nop.
+ ClearCommands();
+ gpu::SyncToken invalid_sync_token(CommandBufferNamespace::INVALID, 0, 0);
+ gl_->WaitSyncTokenCHROMIUM(invalid_sync_token.GetConstData());
+ EXPECT_TRUE(NoCommandsWritten());
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), gl_->GetError());
+
+ // Unverified sync token should produce INVALID_OPERATION.
+ ClearCommands();
+ gpu::SyncToken unverified_sync_token(CommandBufferNamespace::GPU_IO, 0, 0);
+ EXPECT_CALL(*gpu_control_, CanWaitUnverifiedSyncToken(_))
+ .WillOnce(testing::Return(false));
+ gl_->WaitSyncTokenCHROMIUM(unverified_sync_token.GetConstData());
+ EXPECT_TRUE(NoCommandsWritten());
+ EXPECT_EQ(static_cast<GLenum>(GL_INVALID_VALUE), gl_->GetError());
+}
+
TEST_F(GLES2ImplementationTest, IsEnabled) {
// If we use a valid enum, its state is cached on client side, so no command
// is actually generated, and this test will fail.

Powered by Google App Engine
This is Rietveld 408576698