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

Unified Diff: third_party/WebKit/Source/wtf/FunctionalTest.cpp

Issue 1975013003: Add support for std::unique_ptr as this pointer in WTF::bind() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use const&. Add tests. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/Functional.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/wtf/FunctionalTest.cpp
diff --git a/third_party/WebKit/Source/wtf/FunctionalTest.cpp b/third_party/WebKit/Source/wtf/FunctionalTest.cpp
index 3b70d038ef438680aec96eb1ce8527f268b237ed..fdac803ce2529b3190ae8363b19c76b111ab24e4 100644
--- a/third_party/WebKit/Source/wtf/FunctionalTest.cpp
+++ b/third_party/WebKit/Source/wtf/FunctionalTest.cpp
@@ -294,6 +294,18 @@ TEST(FunctionalTest, MemberFunctionPartBind)
EXPECT_EQ(25, (*objectBoundFunction2)(15));
}
+TEST(FunctionalTest, MemberFunctionBindByUniquePtr)
+{
+ std::unique_ptr<Function<int()>> function1 = WTF::bind(&A::f, wrapUnique(new A(10)));
+ EXPECT_EQ(10, (*function1)());
+}
+
+TEST(FunctionalTest, MemberFunctionBindByPassedUniquePtr)
+{
+ std::unique_ptr<Function<int()>> function1 = WTF::bind(&A::f, passed(wrapUnique(new A(10))));
+ EXPECT_EQ(10, (*function1)());
+}
+
class Number : public RefCounted<Number> {
public:
static PassRefPtr<Number> create(int value)
« no previous file with comments | « third_party/WebKit/Source/wtf/Functional.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698