| 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 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "gpu/command_buffer/client/cmd_buffer_helper.h" | 9 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
| 10 #include "gpu/command_buffer/service/mocks.h" | 10 #include "gpu/command_buffer/service/mocks.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 101 } |
| 102 | 102 |
| 103 virtual void TearDown() { | 103 virtual void TearDown() { |
| 104 // If the GpuScheduler posts any tasks, this forces them to run. | 104 // If the GpuScheduler posts any tasks, this forces them to run. |
| 105 MessageLoop::current()->RunUntilIdle(); | 105 MessageLoop::current()->RunUntilIdle(); |
| 106 | 106 |
| 107 MappedMemoryTestBase::TearDown(); | 107 MappedMemoryTestBase::TearDown(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 scoped_ptr<MemoryChunk> chunk_; | 110 scoped_ptr<MemoryChunk> chunk_; |
| 111 scoped_array<uint8> buffer_; | 111 scoped_ptr<uint8[]> buffer_; |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 #ifndef _MSC_VER | 114 #ifndef _MSC_VER |
| 115 const int32 MemoryChunkTest::kShmId; | 115 const int32 MemoryChunkTest::kShmId; |
| 116 #endif | 116 #endif |
| 117 | 117 |
| 118 TEST_F(MemoryChunkTest, Basic) { | 118 TEST_F(MemoryChunkTest, Basic) { |
| 119 const unsigned int kSize = 16; | 119 const unsigned int kSize = 16; |
| 120 EXPECT_EQ(kShmId, chunk_->shm_id()); | 120 EXPECT_EQ(kShmId, chunk_->shm_id()); |
| 121 EXPECT_EQ(kBufferSize, chunk_->GetLargestFreeSizeWithoutWaiting()); | 121 EXPECT_EQ(kBufferSize, chunk_->GetLargestFreeSizeWithoutWaiting()); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 ASSERT_TRUE(mem3); | 299 ASSERT_TRUE(mem3); |
| 300 EXPECT_NE(-1, id1); | 300 EXPECT_NE(-1, id1); |
| 301 EXPECT_EQ(id1, id2); | 301 EXPECT_EQ(id1, id2); |
| 302 EXPECT_NE(id2, id3); | 302 EXPECT_NE(id2, id3); |
| 303 EXPECT_EQ(0u, offset1); | 303 EXPECT_EQ(0u, offset1); |
| 304 EXPECT_EQ(kSize, offset2); | 304 EXPECT_EQ(kSize, offset2); |
| 305 EXPECT_EQ(0u, offset3); | 305 EXPECT_EQ(0u, offset3); |
| 306 } | 306 } |
| 307 | 307 |
| 308 } // namespace gpu | 308 } // namespace gpu |
| OLD | NEW |