| Index: third_party/WebKit/Source/wtf/PassRefPtrTest.cpp
|
| diff --git a/third_party/WebKit/Source/wtf/PassRefPtrTest.cpp b/third_party/WebKit/Source/wtf/PassRefPtrTest.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ae646d5b0c53ac51265f749d1a5feda08478d13c
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/wtf/PassRefPtrTest.cpp
|
| @@ -0,0 +1,26 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "wtf/PassRefPtr.h"
|
| +
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +#include "wtf/RefCounted.h"
|
| +
|
| +namespace WTF {
|
| +
|
| +class RefCountedClass : public RefCounted<RefCountedClass> {
|
| +};
|
| +
|
| +TEST(PassRefPtrTest, MoveConstructor)
|
| +{
|
| + PassRefPtr<RefCountedClass> oldPassRefPtr = adoptRef(new RefCountedClass());
|
| + RefCountedClass* rawPtr = oldPassRefPtr.get();
|
| + EXPECT_EQ(rawPtr->refCount(), 1);
|
| + PassRefPtr<RefCountedClass> newPassRefPtr(std::move(oldPassRefPtr));
|
| + EXPECT_EQ(oldPassRefPtr.get(), nullptr);
|
| + EXPECT_EQ(newPassRefPtr.get(), rawPtr);
|
| + EXPECT_EQ(rawPtr->refCount(), 1);
|
| +}
|
| +
|
| +} // namespace WTF
|
|
|