James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "base/threading/thread.h" |
| 6 | #include "base/time/time.h" |
| 7 | #include "gpu/command_buffer/service/gpu_scheduler.h" |
| 8 | #include "gpu/command_buffer/service/mocks.h" |
| 9 | |
| 10 | using testing::Invoke; |
| 11 | using testing::_; |
| 12 | |
| 13 | namespace gpu { |
| 14 | |
| 15 | AsyncAPIMock::AsyncAPIMock(bool default_do_commands) { |
| 16 | testing::DefaultValue<error::Error>::Set( |
| 17 | error::kNoError); |
| 18 | |
| 19 | if (default_do_commands) { |
| 20 | ON_CALL(*this, DoCommands(_, _, _, _)) |
| 21 | .WillByDefault(Invoke(this, &AsyncAPIMock::FakeDoCommands)); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | AsyncAPIMock::~AsyncAPIMock() {} |
| 26 | |
| 27 | error::Error AsyncAPIMock::FakeDoCommands(unsigned int num_commands, |
| 28 | const void* buffer, |
| 29 | int num_entries, |
| 30 | int* entries_processed) { |
| 31 | return AsyncAPIInterface::DoCommands( |
| 32 | num_commands, buffer, num_entries, entries_processed); |
| 33 | } |
| 34 | |
| 35 | void AsyncAPIMock::SetToken(unsigned int command, |
| 36 | unsigned int arg_count, |
| 37 | const void* _args) { |
| 38 | DCHECK(engine_); |
| 39 | DCHECK_EQ(1u, command); |
| 40 | DCHECK_EQ(1u, arg_count); |
| 41 | const cmd::SetToken* args = |
| 42 | static_cast<const cmd::SetToken*>(_args); |
| 43 | engine_->set_token(args->token); |
| 44 | } |
| 45 | |
| 46 | namespace gles2 { |
| 47 | |
| 48 | MockShaderTranslator::MockShaderTranslator() {} |
| 49 | |
| 50 | MockShaderTranslator::~MockShaderTranslator() {} |
| 51 | |
| 52 | MockProgramCache::MockProgramCache() {} |
| 53 | MockProgramCache::~MockProgramCache() {} |
| 54 | |
| 55 | MockMemoryTracker::MockMemoryTracker() {} |
| 56 | MockMemoryTracker::~MockMemoryTracker() {} |
| 57 | |
| 58 | } // namespace gles2 |
| 59 | } // namespace gpu |
| 60 | |
| 61 | |