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

Unified Diff: base/memory/ref_counted_unittest.cc

Issue 1993433002: Adds equality operators for comparing scoped_refptr with nullptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses review comments Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/memory/ref_counted.h ('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_unittest.cc
diff --git a/base/memory/ref_counted_unittest.cc b/base/memory/ref_counted_unittest.cc
index 54f62cf4cc579cf0525b23386956144a7753ba09..7c4e07af49e4a1e48fba7019d38e4177278a4665 100644
--- a/base/memory/ref_counted_unittest.cc
+++ b/base/memory/ref_counted_unittest.cc
@@ -204,6 +204,16 @@ TEST(RefCountedUnitTest, Equality) {
EXPECT_NE(p2, p1);
}
+TEST(RefCountedUnitTest, NullptrEquality) {
+ scoped_refptr<SelfAssign> ptr_to_an_instance(new SelfAssign);
+ scoped_refptr<SelfAssign> ptr_to_nullptr;
+
+ EXPECT_NE(nullptr, ptr_to_an_instance);
+ EXPECT_NE(ptr_to_an_instance, nullptr);
+ EXPECT_EQ(nullptr, ptr_to_nullptr);
+ EXPECT_EQ(ptr_to_nullptr, nullptr);
+}
+
TEST(RefCountedUnitTest, ConvertibleEquality) {
scoped_refptr<Derived> p1(new Derived);
scoped_refptr<SelfAssign> p2;
« no previous file with comments | « base/memory/ref_counted.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698