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