Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: base/memory/ref_counted_memory_unittest.cc

Issue 78603002: Added RefCountedMallocedMemory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: grammar fix Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/memory/ref_counted_memory.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « base/memory/ref_counted_memory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698