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

Side by Side 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 unified diff | Download patch
OLDNEW
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 the Command Buffer Helper. 5 // Tests for the Command Buffer Helper.
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 702
703 helper_->Finish(); 703 helper_->Finish();
704 704
705 // Check that the commands did happen. 705 // Check that the commands did happen.
706 Mock::VerifyAndClearExpectations(api_mock_.get()); 706 Mock::VerifyAndClearExpectations(api_mock_.get());
707 707
708 // Check the error status. 708 // Check the error status.
709 EXPECT_EQ(error::kNoError, GetError()); 709 EXPECT_EQ(error::kNoError, GetError());
710 } 710 }
711 711
712 TEST_F(CommandBufferHelperTest, TestOrderingBarrierFlushGeneration) {
713 // Explicit flushing only.
714 helper_->SetAutomaticFlushes(false);
715
716 // Generation should change after OrderingBarrier() but not before.
717 uint32 gen1, gen2, gen3;
718
719 gen1 = GetHelperFlushGeneration();
720 AddUniqueCommandWithExpect(error::kNoError, 2);
721 gen2 = GetHelperFlushGeneration();
722 helper_->OrderingBarrier();
723 gen3 = GetHelperFlushGeneration();
724 EXPECT_EQ(gen2, gen1);
725 EXPECT_NE(gen3, gen2);
726
727 helper_->Finish();
728
729 // Check that the commands did happen.
730 Mock::VerifyAndClearExpectations(api_mock_.get());
731
732 // Check the error status.
733 EXPECT_EQ(error::kNoError, GetError());
734 }
735
736 // Expect Flush() to always call CommandBuffer::Flush().
737 TEST_F(CommandBufferHelperTest, TestFlushToCommandBuffer) {
738 // Explicit flushing only.
739 helper_->SetAutomaticFlushes(false);
740
741 int flush_count1, flush_count2, flush_count3;
742
743 flush_count1 = command_buffer_->FlushCount();
744 AddUniqueCommandWithExpect(error::kNoError, 2);
745 helper_->Flush();
746 flush_count2 = command_buffer_->FlushCount();
747 helper_->Flush();
748 flush_count3 = command_buffer_->FlushCount();
749
750 EXPECT_EQ(flush_count2, flush_count1 + 1);
751 EXPECT_EQ(flush_count3, flush_count2 + 1);
752 }
753
754 // Expect OrderingBarrier() to always call CommandBuffer::OrderingBarrier().
755 TEST_F(CommandBufferHelperTest, TestOrderingBarrierToCommandBuffer) {
756 // Explicit flushing only.
757 helper_->SetAutomaticFlushes(false);
758
759 int flush_count1, flush_count2, flush_count3;
760
761 flush_count1 = command_buffer_->FlushCount();
762 AddUniqueCommandWithExpect(error::kNoError, 2);
763 helper_->OrderingBarrier();
764 flush_count2 = command_buffer_->FlushCount();
765 helper_->OrderingBarrier();
766 flush_count3 = command_buffer_->FlushCount();
767
768 EXPECT_EQ(flush_count2, flush_count1 + 1);
769 EXPECT_EQ(flush_count3, flush_count2 + 1);
770 }
771
712 } // namespace gpu 772 } // namespace gpu
OLDNEW
« 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