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

Side by Side Diff: base/memory/ref_counted_memory_unittest.cc

Issue 11830007: Avoid sending notifications when the bitmap data in history has not changed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split the changes to MergeFavicon() and SetFavicons() into two CLs as only the changes to MergeFavi… Created 7 years, 11 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/memory/ref_counted_memory.cc ('k') | chrome/browser/history/history_backend.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/memory/ref_counted_memory.h" 5 #include "base/memory/ref_counted_memory.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace base { 9 namespace base {
10 10
(...skipping 24 matching lines...) Expand all
35 std::string s("destroy me"); 35 std::string s("destroy me");
36 scoped_refptr<RefCountedMemory> mem = RefCountedString::TakeString(&s); 36 scoped_refptr<RefCountedMemory> mem = RefCountedString::TakeString(&s);
37 37
38 EXPECT_EQ(0U, s.size()); 38 EXPECT_EQ(0U, s.size());
39 39
40 EXPECT_EQ(10U, mem->size()); 40 EXPECT_EQ(10U, mem->size());
41 EXPECT_EQ('d', mem->front()[0]); 41 EXPECT_EQ('d', mem->front()[0]);
42 EXPECT_EQ('e', mem->front()[1]); 42 EXPECT_EQ('e', mem->front()[1]);
43 } 43 }
44 44
45 TEST(RefCountedMemoryUnitTest, Equals) {
46 std::string s1("same");
47 scoped_refptr<RefCountedMemory> mem1 = RefCountedString::TakeString(&s1);
48
49 std::vector<unsigned char> d2;
50 d2.push_back('s');
51 d2.push_back('a');
52 d2.push_back('m');
53 d2.push_back('e');
54 scoped_refptr<RefCountedMemory> mem2 = RefCountedBytes::TakeVector(&d2);
55
56 EXPECT_TRUE(mem1->Equals(mem2));
57
58 std::string s3("diff");
59 scoped_refptr<RefCountedMemory> mem3 = RefCountedString::TakeString(&s3);
60
61 EXPECT_FALSE(mem1->Equals(mem3));
62 EXPECT_FALSE(mem2->Equals(mem3));
63 }
64
65 TEST(RefCountedMemoryUnitTest, EqualsNull) {
66 std::string s("str");
67 scoped_refptr<RefCountedMemory> mem = RefCountedString::TakeString(&s);
68 EXPECT_FALSE(mem->Equals(NULL));
69 }
70
45 } // namespace base 71 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/ref_counted_memory.cc ('k') | chrome/browser/history/history_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698