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