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 "content/browser/renderer_host/resource_buffer.h" | 5 #include "content/browser/loader/resource_buffer.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
8 namespace content { | 8 namespace content { |
9 | 9 |
10 TEST(ResourceBufferTest, BasicAllocations) { | 10 TEST(ResourceBufferTest, BasicAllocations) { |
11 scoped_refptr<ResourceBuffer> buf = new ResourceBuffer(); | 11 scoped_refptr<ResourceBuffer> buf = new ResourceBuffer(); |
12 EXPECT_TRUE(buf->Initialize(100, 5, 10)); | 12 EXPECT_TRUE(buf->Initialize(100, 5, 10)); |
13 EXPECT_TRUE(buf->CanAllocate()); | 13 EXPECT_TRUE(buf->CanAllocate()); |
14 | 14 |
15 // First allocation | 15 // First allocation |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 // Full. | 129 // Full. |
130 EXPECT_FALSE(buf->CanAllocate()); | 130 EXPECT_FALSE(buf->CanAllocate()); |
131 | 131 |
132 // Still full, even if there is a small hole at the end. | 132 // Still full, even if there is a small hole at the end. |
133 buf->ShrinkLastAllocation(5); | 133 buf->ShrinkLastAllocation(5); |
134 EXPECT_FALSE(buf->CanAllocate()); | 134 EXPECT_FALSE(buf->CanAllocate()); |
135 } | 135 } |
136 | 136 |
137 } // namespace content | 137 } // namespace content |
OLD | NEW |