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 // This file contains the tests for the FencedAllocator class. | 5 // This file contains the tests for the FencedAllocator class. |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/memory/aligned_memory.h" | 9 #include "base/memory/aligned_memory.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 using testing::Invoke; | 31 using testing::Invoke; |
32 using testing::InvokeWithoutArgs; | 32 using testing::InvokeWithoutArgs; |
33 using testing::_; | 33 using testing::_; |
34 | 34 |
35 class BaseFencedAllocatorTest : public testing::Test { | 35 class BaseFencedAllocatorTest : public testing::Test { |
36 protected: | 36 protected: |
37 static const unsigned int kBufferSize = 1024; | 37 static const unsigned int kBufferSize = 1024; |
38 static const int kAllocAlignment = 16; | 38 static const int kAllocAlignment = 16; |
39 | 39 |
40 virtual void SetUp() { | 40 virtual void SetUp() { |
41 api_mock_.reset(new AsyncAPIMock); | 41 api_mock_.reset(new AsyncAPIMock(true)); |
42 // ignore noops in the mock - we don't want to inspect the internals of the | 42 // ignore noops in the mock - we don't want to inspect the internals of the |
43 // helper. | 43 // helper. |
44 EXPECT_CALL(*api_mock_, DoCommand(cmd::kNoop, 0, _)) | 44 EXPECT_CALL(*api_mock_, DoCommand(cmd::kNoop, 0, _)) |
45 .WillRepeatedly(Return(error::kNoError)); | 45 .WillRepeatedly(Return(error::kNoError)); |
46 // Forward the SetToken calls to the engine | 46 // Forward the SetToken calls to the engine |
47 EXPECT_CALL(*api_mock_.get(), DoCommand(cmd::kSetToken, 1, _)) | 47 EXPECT_CALL(*api_mock_.get(), DoCommand(cmd::kSetToken, 1, _)) |
48 .WillRepeatedly(DoAll(Invoke(api_mock_.get(), &AsyncAPIMock::SetToken), | 48 .WillRepeatedly(DoAll(Invoke(api_mock_.get(), &AsyncAPIMock::SetToken), |
49 Return(error::kNoError))); | 49 Return(error::kNoError))); |
50 | 50 |
51 { | 51 { |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 EXPECT_LE(token, GetToken()); | 636 EXPECT_LE(token, GetToken()); |
637 | 637 |
638 // Free up everything. | 638 // Free up everything. |
639 for (unsigned int i = 0; i < kAllocCount; ++i) { | 639 for (unsigned int i = 0; i < kAllocCount; ++i) { |
640 allocator_->Free(pointers[i]); | 640 allocator_->Free(pointers[i]); |
641 EXPECT_TRUE(allocator_->CheckConsistency()); | 641 EXPECT_TRUE(allocator_->CheckConsistency()); |
642 } | 642 } |
643 } | 643 } |
644 | 644 |
645 } // namespace gpu | 645 } // namespace gpu |
OLD | NEW |