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

Unified Diff: base/memory/ref_counted_unittest.cc

Issue 2446403006: Member initialization for scoped_refptr<T>::ptr_. (Closed)
Patch Set: remove extraneous TestOpaqueRefCounted calls Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/memory/ref_counted.h ('k') | base/test/opaque_ref_counted.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/ref_counted_unittest.cc
diff --git a/base/memory/ref_counted_unittest.cc b/base/memory/ref_counted_unittest.cc
index 7c4e07af49e4a1e48fba7019d38e4177278a4665..65c15d26ab1142a15cbd4e419e7badadbe5e6849 100644
--- a/base/memory/ref_counted_unittest.cc
+++ b/base/memory/ref_counted_unittest.cc
@@ -4,6 +4,8 @@
#include "base/memory/ref_counted.h"
+#include <utility>
+
#include "base/test/opaque_ref_counted.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -156,13 +158,34 @@ TEST(RefCountedUnitTest, ScopedRefPtrToSelfMoveAssignment) {
}
TEST(RefCountedUnitTest, ScopedRefPtrToOpaque) {
- scoped_refptr<base::OpaqueRefCounted> p = base::MakeOpaqueRefCounted();
- base::TestOpaqueRefCounted(p);
+ scoped_refptr<base::OpaqueRefCounted> initial = base::MakeOpaqueRefCounted();
+ base::TestOpaqueRefCounted(initial);
+
+ scoped_refptr<base::OpaqueRefCounted> assigned;
+ assigned = initial;
+
+ scoped_refptr<base::OpaqueRefCounted> copied(initial);
+
+ scoped_refptr<base::OpaqueRefCounted> moved(std::move(initial));
+
+ scoped_refptr<base::OpaqueRefCounted> move_assigned;
+ move_assigned = std::move(moved);
+}
+
+TEST(RefCountedUnitTest, ScopedRefPtrToOpaqueThreadSafe) {
+ scoped_refptr<base::OpaqueRefCountedThreadSafe> initial =
+ base::MakeOpaqueRefCountedThreadSafe();
+ base::TestOpaqueRefCountedThreadSafe(initial);
+
+ scoped_refptr<base::OpaqueRefCountedThreadSafe> assigned;
+ assigned = initial;
+
+ scoped_refptr<base::OpaqueRefCountedThreadSafe> copied(initial);
+
+ scoped_refptr<base::OpaqueRefCountedThreadSafe> moved(std::move(initial));
- scoped_refptr<base::OpaqueRefCounted> q;
- q = p;
- base::TestOpaqueRefCounted(p);
- base::TestOpaqueRefCounted(q);
+ scoped_refptr<base::OpaqueRefCountedThreadSafe> move_assigned;
+ move_assigned = std::move(moved);
}
TEST(RefCountedUnitTest, BooleanTesting) {
« no previous file with comments | « base/memory/ref_counted.h ('k') | base/test/opaque_ref_counted.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698