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

Side by Side Diff: third_party/WebKit/Source/wtf/PassRefPtrTest.cpp

Issue 2274793002: Added move constructor to PassRefPtr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed reviewer comments Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/PassRefPtr.h ('k') | third_party/WebKit/Source/wtf/wtf.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "wtf/PassRefPtr.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "wtf/RefCounted.h"
9
10 namespace WTF {
11
12 class RefCountedClass : public RefCounted<RefCountedClass> {
13 };
14
15 TEST(PassRefPtrTest, MoveConstructor)
16 {
17 PassRefPtr<RefCountedClass> oldPassRefPtr = adoptRef(new RefCountedClass());
18 RefCountedClass* rawPtr = oldPassRefPtr.get();
19 EXPECT_EQ(rawPtr->refCount(), 1);
20 PassRefPtr<RefCountedClass> newPassRefPtr(std::move(oldPassRefPtr));
21 EXPECT_EQ(oldPassRefPtr.get(), nullptr);
22 EXPECT_EQ(newPassRefPtr.get(), rawPtr);
23 EXPECT_EQ(rawPtr->refCount(), 1);
24 }
25
26 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/PassRefPtr.h ('k') | third_party/WebKit/Source/wtf/wtf.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698