| Index: base/memory/ref_counted_unittest.cc
|
| diff --git a/base/memory/ref_counted_unittest.cc b/base/memory/ref_counted_unittest.cc
|
| index 3f56b4a1c0b19c74ede34c5b53b67b902a3788e2..54f62cf4cc579cf0525b23386956144a7753ba09 100644
|
| --- a/base/memory/ref_counted_unittest.cc
|
| +++ b/base/memory/ref_counted_unittest.cc
|
| @@ -105,6 +105,22 @@ class ScopedRefPtrCountDerived : public ScopedRefPtrCountBase {
|
| int ScopedRefPtrCountDerived::constructor_count_ = 0;
|
| int ScopedRefPtrCountDerived::destructor_count_ = 0;
|
|
|
| +class Other : public base::RefCounted<Other> {
|
| + private:
|
| + friend class base::RefCounted<Other>;
|
| +
|
| + ~Other() {}
|
| +};
|
| +
|
| +scoped_refptr<Other> Overloaded(scoped_refptr<Other> other) {
|
| + return other;
|
| +}
|
| +
|
| +scoped_refptr<SelfAssign> Overloaded(scoped_refptr<SelfAssign> self_assign) {
|
| + return self_assign;
|
| +}
|
| +
|
| +
|
| } // end namespace
|
|
|
| TEST(RefCountedUnitTest, TestSelfAssignment) {
|
| @@ -461,3 +477,21 @@ TEST(RefCountedUnitTest, MoveConstructorDerived) {
|
| EXPECT_EQ(1, ScopedRefPtrCountDerived::destructor_count());
|
| }
|
|
|
| +TEST(RefCountedUnitTest, TestOverloadResolutionCopy) {
|
| + scoped_refptr<Derived> derived(new Derived);
|
| + scoped_refptr<SelfAssign> expected(derived);
|
| + EXPECT_EQ(expected, Overloaded(derived));
|
| +
|
| + scoped_refptr<Other> other(new Other);
|
| + EXPECT_EQ(other, Overloaded(other));
|
| +}
|
| +
|
| +TEST(RefCountedUnitTest, TestOverloadResolutionMove) {
|
| + scoped_refptr<Derived> derived(new Derived);
|
| + scoped_refptr<SelfAssign> expected(derived);
|
| + EXPECT_EQ(expected, Overloaded(std::move(derived)));
|
| +
|
| + scoped_refptr<Other> other(new Other);
|
| + scoped_refptr<Other> other2(other);
|
| + EXPECT_EQ(other2, Overloaded(std::move(other)));
|
| +}
|
|
|