| // Copyright 2014 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 "testing/gtest/include/gtest/gtest.h" |
| #include "wtf/RefCounted.h" |
| #include "wtf/text/StringImpl.h" |
| TEST(RefPtrTest, Basic) { |
| RefPtr<StringImpl> string; |
| string = StringImpl::create("test"); |
| TEST(RefPtrTest, MoveAssignmentOperator) { |
| RefPtr<StringImpl> a = StringImpl::create("a"); |
| RefPtr<StringImpl> b = StringImpl::create("b"); |
| class RefCountedClass : public RefCounted<RefCountedClass> {}; |
| TEST(RefPtrTest, ConstObject) { |
| // This test is only to ensure we force the compilation of a const RefCounted |
| // object to ensure the generated code compiles. |
| RefPtr<const RefCountedClass> ptrToConst = adoptRef(new RefCountedClass()); |