| 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 "gpu/command_buffer/client/mapped_memory.h" | 5 #include "gpu/command_buffer/client/mapped_memory.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 using testing::Sequence; | 27 using testing::Sequence; |
| 28 using testing::DoAll; | 28 using testing::DoAll; |
| 29 using testing::Invoke; | 29 using testing::Invoke; |
| 30 using testing::_; | 30 using testing::_; |
| 31 | 31 |
| 32 class MappedMemoryTestBase : public testing::Test { | 32 class MappedMemoryTestBase : public testing::Test { |
| 33 protected: | 33 protected: |
| 34 static const unsigned int kBufferSize = 1024; | 34 static const unsigned int kBufferSize = 1024; |
| 35 | 35 |
| 36 virtual void SetUp() { | 36 virtual void SetUp() { |
| 37 api_mock_.reset(new AsyncAPIMock); | 37 api_mock_.reset(new AsyncAPIMock(true)); |
| 38 // ignore noops in the mock - we don't want to inspect the internals of the | 38 // ignore noops in the mock - we don't want to inspect the internals of the |
| 39 // helper. | 39 // helper. |
| 40 EXPECT_CALL(*api_mock_, DoCommand(cmd::kNoop, 0, _)) | 40 EXPECT_CALL(*api_mock_, DoCommand(cmd::kNoop, 0, _)) |
| 41 .WillRepeatedly(Return(error::kNoError)); | 41 .WillRepeatedly(Return(error::kNoError)); |
| 42 // Forward the SetToken calls to the engine | 42 // Forward the SetToken calls to the engine |
| 43 EXPECT_CALL(*api_mock_.get(), DoCommand(cmd::kSetToken, 1, _)) | 43 EXPECT_CALL(*api_mock_.get(), DoCommand(cmd::kSetToken, 1, _)) |
| 44 .WillRepeatedly(DoAll(Invoke(api_mock_.get(), &AsyncAPIMock::SetToken), | 44 .WillRepeatedly(DoAll(Invoke(api_mock_.get(), &AsyncAPIMock::SetToken), |
| 45 Return(error::kNoError))); | 45 Return(error::kNoError))); |
| 46 | 46 |
| 47 { | 47 { |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 unsigned int offset3; | 447 unsigned int offset3; |
| 448 void* mem3 = manager_->Alloc(kSize, &id3, &offset3); | 448 void* mem3 = manager_->Alloc(kSize, &id3, &offset3); |
| 449 EXPECT_EQ(manager_->bytes_in_use(), kSize * 2); | 449 EXPECT_EQ(manager_->bytes_in_use(), kSize * 2); |
| 450 | 450 |
| 451 manager_->Free(mem2); | 451 manager_->Free(mem2); |
| 452 manager_->Free(mem3); | 452 manager_->Free(mem3); |
| 453 EXPECT_EQ(manager_->bytes_in_use(), static_cast<size_t>(0)); | 453 EXPECT_EQ(manager_->bytes_in_use(), static_cast<size_t>(0)); |
| 454 } | 454 } |
| 455 | 455 |
| 456 } // namespace gpu | 456 } // namespace gpu |
| OLD | NEW |