| Index: base/memory/ref_counted_unittest.cc
|
| diff --git a/base/memory/ref_counted_unittest.cc b/base/memory/ref_counted_unittest.cc
|
| index 65c15d26ab1142a15cbd4e419e7badadbe5e6849..1b2cdb29d120521cdd3eb5db624dc85858c28bb5 100644
|
| --- a/base/memory/ref_counted_unittest.cc
|
| +++ b/base/memory/ref_counted_unittest.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include <utility>
|
|
|
| +#include "base/test/gtest_util.h"
|
| #include "base/test/opaque_ref_counted.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| @@ -122,6 +123,14 @@ scoped_refptr<SelfAssign> Overloaded(scoped_refptr<SelfAssign> self_assign) {
|
| return self_assign;
|
| }
|
|
|
| +class InitialValueIsOne : public base::RefCounted<InitialValueIsOne> {
|
| + public:
|
| + InitialValueIsOne() : RefCounted<InitialValueIsOne>(1) {}
|
| +
|
| + private:
|
| + friend class base::RefCounted<InitialValueIsOne>;
|
| + ~InitialValueIsOne() {}
|
| +};
|
|
|
| } // end namespace
|
|
|
| @@ -528,3 +537,15 @@ TEST(RefCountedUnitTest, TestOverloadResolutionMove) {
|
| scoped_refptr<Other> other2(other);
|
| EXPECT_EQ(other2, Overloaded(std::move(other)));
|
| }
|
| +
|
| +TEST(RefCountedUnitTest, TestInitialValueIsOne) {
|
| + scoped_refptr<InitialValueIsOne> obj = base::MakeShared<InitialValueIsOne>();
|
| + obj = nullptr;
|
| +
|
| + scoped_refptr<InitialValueIsOne> obj2 = base::AdoptRef(new InitialValueIsOne);
|
| + obj2 = nullptr;
|
| +}
|
| +
|
| +TEST(RefCountedDeathTest, TestAdoptRef) {
|
| + EXPECT_DCHECK_DEATH(make_scoped_refptr(new InitialValueIsOne));
|
| +}
|
|
|