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

Unified Diff: gpu/command_buffer/service/gpu_scheduler_unittest.cc

Issue 7458010: Revert 93066 - Execute all GL commands up to the put offset reported by a each flush.This means g... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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/service/gpu_scheduler.cc ('k') | gpu/command_buffer/service/mocks.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gpu_scheduler_unittest.cc
===================================================================
--- gpu/command_buffer/service/gpu_scheduler_unittest.cc (revision 93137)
+++ gpu/command_buffer/service/gpu_scheduler_unittest.cc (working copy)
@@ -44,7 +44,7 @@
ON_CALL(*command_buffer_.get(), GetState())
.WillByDefault(Return(default_state));
- async_api_.reset(new StrictMock<AsyncAPIMock>);
+ async_api_.reset(new StrictMock<SpecializedDoCommandAsyncAPIMock>);
decoder_ = new gles2::MockGLES2Decoder();
@@ -55,9 +55,10 @@
0,
async_api_.get());
- scheduler_.reset(gpu::GpuScheduler::CreateForTests(command_buffer_.get(),
- decoder_,
- parser_));
+ scheduler_.reset(new GpuScheduler(command_buffer_.get(),
+ decoder_,
+ parser_,
+ 2));
EXPECT_CALL(*decoder_, Destroy())
.Times(1)
@@ -96,7 +97,7 @@
EXPECT_CALL(*command_buffer_, SetParseError(_))
.Times(0);
- scheduler_->PutChanged();
+ scheduler_->PutChanged(true);
}
TEST_F(GpuSchedulerTest, ProcessesOneCommand) {
@@ -118,7 +119,7 @@
EXPECT_CALL(*command_buffer_, SetParseError(_))
.Times(0);
- scheduler_->PutChanged();
+ scheduler_->PutChanged(true);
}
TEST_F(GpuSchedulerTest, ProcessesTwoCommands) {
@@ -143,7 +144,7 @@
.WillOnce(Return(error::kNoError));
EXPECT_CALL(*command_buffer_, SetGetOffset(3));
- scheduler_->PutChanged();
+ scheduler_->PutChanged(true);
}
TEST_F(GpuSchedulerTest, SchedulerSetsTheGLContext) {
@@ -156,9 +157,50 @@
EXPECT_CALL(*command_buffer_, GetState())
.WillRepeatedly(Return(state));
- scheduler_->PutChanged();
+ scheduler_->PutChanged(true);
}
+TEST_F(GpuSchedulerTest, PostsTaskToFinishRemainingCommands) {
+ unsigned int pauseCmd = SpecializedDoCommandAsyncAPIMock::kTestQuantumCommand;
+ CommandHeader* header = reinterpret_cast<CommandHeader*>(&buffer_[0]);
+ header[0].command = 7;
+ header[0].size = 2;
+ buffer_[1] = 123;
+ header[2].command = pauseCmd;
+ header[2].size = 1;
+ header[3].command = 9;
+ header[3].size = 1;
+
+ CommandBuffer::State state;
+
+ state.put_offset = 4;
+ EXPECT_CALL(*command_buffer_, GetState())
+ .WillRepeatedly(Return(state));
+
+ EXPECT_CALL(*async_api_, DoCommand(7, 1, &buffer_[0]))
+ .WillOnce(Return(error::kNoError));
+ EXPECT_CALL(*command_buffer_, SetGetOffset(2));
+
+ EXPECT_CALL(*async_api_, DoCommand(pauseCmd, 0, &buffer_[2]))
+ .WillOnce(Return(error::kNoError));
+ EXPECT_CALL(*command_buffer_, SetGetOffset(3));
+
+ scheduler_->PutChanged(true);
+
+ // ProcessCommands is called a second time when the pending task is run.
+
+ state.put_offset = 4;
+ EXPECT_CALL(*command_buffer_, GetState())
+ .WillRepeatedly(Return(state));
+
+ EXPECT_CALL(*async_api_, DoCommand(9, 0, &buffer_[3]))
+ .WillOnce(Return(error::kNoError));
+
+ EXPECT_CALL(*command_buffer_, SetGetOffset(4));
+
+ MessageLoop::current()->RunAllPending();
+}
+
TEST_F(GpuSchedulerTest, SetsErrorCodeOnCommandBuffer) {
CommandHeader* header = reinterpret_cast<CommandHeader*>(&buffer_[0]);
header[0].command = 7;
@@ -180,7 +222,7 @@
EXPECT_CALL(*command_buffer_,
SetParseError(error::kUnknownCommand));
- scheduler_->PutChanged();
+ scheduler_->PutChanged(true);
}
TEST_F(GpuSchedulerTest, ProcessCommandsDoesNothingAfterError) {
@@ -190,7 +232,7 @@
EXPECT_CALL(*command_buffer_, GetState())
.WillRepeatedly(Return(state));
- scheduler_->PutChanged();
+ scheduler_->PutChanged(true);
}
TEST_F(GpuSchedulerTest, CanGetAddressOfSharedMemory) {
« no previous file with comments | « gpu/command_buffer/service/gpu_scheduler.cc ('k') | gpu/command_buffer/service/mocks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698