Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/threading/thread.h" | |
| 5 #include "gpu/command_buffer/service/mocks.h" | 6 #include "gpu/command_buffer/service/mocks.h" |
| 6 | 7 |
| 7 namespace gpu { | 8 namespace gpu { |
| 8 | 9 |
| 9 AsyncAPIMock::AsyncAPIMock() { | 10 AsyncAPIMock::AsyncAPIMock() { |
| 10 testing::DefaultValue<error::Error>::Set( | 11 testing::DefaultValue<error::Error>::Set( |
| 11 error::kNoError); | 12 error::kNoError); |
| 12 } | 13 } |
| 13 | 14 |
| 14 AsyncAPIMock::~AsyncAPIMock() {} | 15 AsyncAPIMock::~AsyncAPIMock() {} |
| 15 | 16 |
| 16 void AsyncAPIMock::SetToken(unsigned int command, | 17 void AsyncAPIMock::SetToken(unsigned int command, |
| 17 unsigned int arg_count, | 18 unsigned int arg_count, |
| 18 const void* _args) { | 19 const void* _args) { |
| 19 DCHECK(engine_); | 20 DCHECK(engine_); |
| 20 DCHECK_EQ(1u, command); | 21 DCHECK_EQ(1u, command); |
| 21 DCHECK_EQ(1u, arg_count); | 22 DCHECK_EQ(1u, arg_count); |
| 22 const cmd::SetToken* args = | 23 const cmd::SetToken* args = |
| 23 static_cast<const cmd::SetToken*>(_args); | 24 static_cast<const cmd::SetToken*>(_args); |
| 24 engine_->set_token(args->token); | 25 engine_->set_token(args->token); |
| 25 } | 26 } |
| 26 | 27 |
| 28 SpecializedAsyncAPIMock::SpecializedAsyncAPIMock() {} | |
|
apatrick_chromium
2011/06/03 18:58:52
The name does not describe what the specialized mo
jbates
2011/06/03 21:27:32
Done. But not Slow, because it is still a generic
| |
| 29 | |
| 30 SpecializedAsyncAPIMock::~SpecializedAsyncAPIMock() {} | |
| 31 | |
| 32 error::Error SpecializedAsyncAPIMock::DoCommand(unsigned int command, | |
| 33 unsigned int arg_count, | |
| 34 const void* cmd_data) { | |
| 35 if (command == kTestPauseCommand) { | |
| 36 // 3 ms sleep, to surpass the 2ms cutoff in GpuScheduler | |
| 37 base::PlatformThread::Sleep(3); | |
|
apatrick_chromium
2011/06/03 18:58:52
I fear this is going to make the test flaky if the
jbates
2011/06/03 21:27:32
Done.
| |
| 38 } | |
| 39 return AsyncAPIMock::DoCommand(command, arg_count, cmd_data); | |
| 40 } | |
| 41 | |
| 27 namespace gles2 { | 42 namespace gles2 { |
| 28 | 43 |
| 29 MockShaderTranslator::MockShaderTranslator() {} | 44 MockShaderTranslator::MockShaderTranslator() {} |
| 30 | 45 |
| 31 MockShaderTranslator::~MockShaderTranslator() {} | 46 MockShaderTranslator::~MockShaderTranslator() {} |
| 32 | 47 |
| 33 } // namespace gles2 | 48 } // namespace gles2 |
| 34 } // namespace gpu | 49 } // namespace gpu |
| OLD | NEW |