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

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

Issue 896723008: Add OrderingBarrierCHROMIUM API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nits. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/client/cmd_buffer_helper.cc ('k') | gpu/command_buffer/client/gles2_c_lib_autogen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/cmd_buffer_helper_test.cc
diff --git a/gpu/command_buffer/client/cmd_buffer_helper_test.cc b/gpu/command_buffer/client/cmd_buffer_helper_test.cc
index 2e807e22a282e6ecda4cf9e60123471dafd196de..ac83da5788ae1ceb681e120551d54e24479225d5 100644
--- a/gpu/command_buffer/client/cmd_buffer_helper_test.cc
+++ b/gpu/command_buffer/client/cmd_buffer_helper_test.cc
@@ -709,4 +709,64 @@ TEST_F(CommandBufferHelperTest, TestFlushGeneration) {
EXPECT_EQ(error::kNoError, GetError());
}
+TEST_F(CommandBufferHelperTest, TestOrderingBarrierFlushGeneration) {
+ // Explicit flushing only.
+ helper_->SetAutomaticFlushes(false);
+
+ // Generation should change after OrderingBarrier() but not before.
+ uint32 gen1, gen2, gen3;
+
+ gen1 = GetHelperFlushGeneration();
+ AddUniqueCommandWithExpect(error::kNoError, 2);
+ gen2 = GetHelperFlushGeneration();
+ helper_->OrderingBarrier();
+ gen3 = GetHelperFlushGeneration();
+ EXPECT_EQ(gen2, gen1);
+ EXPECT_NE(gen3, gen2);
+
+ helper_->Finish();
+
+ // Check that the commands did happen.
+ Mock::VerifyAndClearExpectations(api_mock_.get());
+
+ // Check the error status.
+ EXPECT_EQ(error::kNoError, GetError());
+}
+
+// Expect Flush() to always call CommandBuffer::Flush().
+TEST_F(CommandBufferHelperTest, TestFlushToCommandBuffer) {
+ // Explicit flushing only.
+ helper_->SetAutomaticFlushes(false);
+
+ int flush_count1, flush_count2, flush_count3;
+
+ flush_count1 = command_buffer_->FlushCount();
+ AddUniqueCommandWithExpect(error::kNoError, 2);
+ helper_->Flush();
+ flush_count2 = command_buffer_->FlushCount();
+ helper_->Flush();
+ flush_count3 = command_buffer_->FlushCount();
+
+ EXPECT_EQ(flush_count2, flush_count1 + 1);
+ EXPECT_EQ(flush_count3, flush_count2 + 1);
+}
+
+// Expect OrderingBarrier() to always call CommandBuffer::OrderingBarrier().
+TEST_F(CommandBufferHelperTest, TestOrderingBarrierToCommandBuffer) {
+ // Explicit flushing only.
+ helper_->SetAutomaticFlushes(false);
+
+ int flush_count1, flush_count2, flush_count3;
+
+ flush_count1 = command_buffer_->FlushCount();
+ AddUniqueCommandWithExpect(error::kNoError, 2);
+ helper_->OrderingBarrier();
+ flush_count2 = command_buffer_->FlushCount();
+ helper_->OrderingBarrier();
+ flush_count3 = command_buffer_->FlushCount();
+
+ EXPECT_EQ(flush_count2, flush_count1 + 1);
+ EXPECT_EQ(flush_count3, flush_count2 + 1);
+}
+
} // namespace gpu
« no previous file with comments | « gpu/command_buffer/client/cmd_buffer_helper.cc ('k') | gpu/command_buffer/client/gles2_c_lib_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698