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

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

Issue 6990002: Fix ringbuffer test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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 | « no previous file | gpu/command_buffer/service/mocks.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/ring_buffer_test.cc
diff --git a/gpu/command_buffer/client/ring_buffer_test.cc b/gpu/command_buffer/client/ring_buffer_test.cc
index 1ccd97972516800a110d474fa7af508aee80dc95..01bc3e0a331ea80d1c49fa20f55762da37eed96a 100644
--- a/gpu/command_buffer/client/ring_buffer_test.cc
+++ b/gpu/command_buffer/client/ring_buffer_test.cc
@@ -30,6 +30,25 @@ class BaseRingBufferTest : public testing::Test {
static const unsigned int kBaseOffset = 128;
static const unsigned int kBufferSize = 1024;
+ class DoJumpCommand {
+ public:
+ explicit DoJumpCommand(CommandParser* parser)
+ : parser_(parser) {
+ }
+
+ error::Error DoCommand(
+ unsigned int command,
+ unsigned int arg_count,
+ const void* cmd_data) {
+ const cmd::Jump* jump_cmd = static_cast<const cmd::Jump*>(cmd_data);
+ parser_->set_get(jump_cmd->offset);
+ return error::kNoError;
+ };
+
+ private:
+ CommandParser* parser_;
+ };
+
virtual void SetUp() {
api_mock_.reset(new AsyncAPIMock);
// ignore noops in the mock - we don't want to inspect the internals of the
@@ -58,6 +77,10 @@ class BaseRingBufferTest : public testing::Test {
gpu_scheduler_.get(), &GpuScheduler::PutChanged));
api_mock_->set_engine(gpu_scheduler_.get());
+ do_jump_command_.reset(new DoJumpCommand(parser_));
+ EXPECT_CALL(*api_mock_, DoCommand(cmd::kJump, _, _))
+ .WillRepeatedly(
+ Invoke(do_jump_command_.get(), &DoJumpCommand::DoCommand));
helper_.reset(new CommandBufferHelper(command_buffer_.get()));
helper_->Initialize(kBufferSize);
@@ -74,6 +97,7 @@ class BaseRingBufferTest : public testing::Test {
scoped_ptr<GpuScheduler> gpu_scheduler_;
CommandParser* parser_;
scoped_ptr<CommandBufferHelper> helper_;
+ scoped_ptr<DoJumpCommand> do_jump_command_;
};
#ifndef _MSC_VER
@@ -256,6 +280,7 @@ TEST_F(RingBufferWrapperTest, TestFreePendingToken) {
EXPECT_LE(tokens[0], GetToken());
allocator_->FreePendingToken(pointer1, helper_->InsertToken());
+ EXPECT_LE(command_buffer_->GetState().token, helper_->InsertToken());
}
} // namespace gpu
« no previous file with comments | « no previous file | gpu/command_buffer/service/mocks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698