Index: base/memory/ref_counted_memory_unittest.cc |
diff --git a/base/memory/ref_counted_memory_unittest.cc b/base/memory/ref_counted_memory_unittest.cc |
index c6f2b9c3d1c8f0878dca40c5f91fd91a7a8c8a9b..88c5b534851806e1412f69c5bd31106294bd118a 100644 |
--- a/base/memory/ref_counted_memory_unittest.cc |
+++ b/base/memory/ref_counted_memory_unittest.cc |
@@ -42,6 +42,16 @@ TEST(RefCountedMemoryUnitTest, RefCountedString) { |
EXPECT_EQ('e', mem->front()[1]); |
} |
+TEST(RefCountedMemoryUnitTest, RefCountedMallocedMemory) { |
+ void* data = malloc(6); |
+ memcpy(data, "hello", 6); |
+ |
+ scoped_refptr<RefCountedMemory> mem = new RefCountedMallocedMemory(data, 6); |
+ |
+ EXPECT_EQ(6U, mem->size()); |
+ EXPECT_EQ(0, memcmp("hello", mem->front(), 6)); |
+} |
+ |
TEST(RefCountedMemoryUnitTest, Equals) { |
std::string s1("same"); |
scoped_refptr<RefCountedMemory> mem1 = RefCountedString::TakeString(&s1); |