Handle account removal correctly on all platforms.
[chromium-blink-merge.git] / gpu / command_buffer / service / mocks.cc
blob143ec0b4d84d8d1f9d6b7d0b2073c769848cfd83
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.
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"
10 using testing::Invoke;
11 using testing::_;
13 namespace gpu {
15 AsyncAPIMock::AsyncAPIMock(bool default_do_commands) {
16 testing::DefaultValue<error::Error>::Set(
17 error::kNoError);
19 if (default_do_commands) {
20 ON_CALL(*this, DoCommands(_, _, _, _))
21 .WillByDefault(Invoke(this, &AsyncAPIMock::FakeDoCommands));
25 AsyncAPIMock::~AsyncAPIMock() {}
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);
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);
46 namespace gles2 {
48 MockShaderTranslator::MockShaderTranslator() {}
50 MockShaderTranslator::~MockShaderTranslator() {}
52 MockProgramCache::MockProgramCache() {}
53 MockProgramCache::~MockProgramCache() {}
55 MockMemoryTracker::MockMemoryTracker() {}
56 MockMemoryTracker::~MockMemoryTracker() {}
58 } // namespace gles2
59 } // namespace gpu