Index: gpu/command_buffer/service/mocks.cc |
diff --git a/gpu/command_buffer/service/mocks.cc b/gpu/command_buffer/service/mocks.cc |
index 40b3d6d924fd06e78b4753640724ebdc244e5997..70898b327b52abdaf071db146fa9f16f74f1bcdd 100644 |
--- a/gpu/command_buffer/service/mocks.cc |
+++ b/gpu/command_buffer/service/mocks.cc |
@@ -2,6 +2,9 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "base/threading/thread.h" |
+#include "base/time.h" |
+#include "gpu/command_buffer/service/gpu_scheduler.h" |
#include "gpu/command_buffer/service/mocks.h" |
namespace gpu { |
@@ -24,6 +27,25 @@ void AsyncAPIMock::SetToken(unsigned int command, |
engine_->set_token(args->token); |
} |
+SpecializedDoCommandAsyncAPIMock::SpecializedDoCommandAsyncAPIMock() {} |
+ |
+SpecializedDoCommandAsyncAPIMock::~SpecializedDoCommandAsyncAPIMock() {} |
+ |
+error::Error SpecializedDoCommandAsyncAPIMock::DoCommand( |
+ unsigned int command, |
+ unsigned int arg_count, |
+ const void* cmd_data) { |
+ if (command == kTestQuantumCommand) { |
+ // Surpass the GpuScheduler scheduling quantum. |
+ base::TimeTicks start_time = base::TimeTicks::Now(); |
+ while ((base::TimeTicks::Now() - start_time).InMicroseconds() < |
+ GpuScheduler::kMinimumSchedulerQuantumMicros) { |
+ base::PlatformThread::Sleep(1); |
+ } |
+ } |
+ return AsyncAPIMock::DoCommand(command, arg_count, cmd_data); |
+} |
+ |
namespace gles2 { |
MockShaderTranslator::MockShaderTranslator() {} |