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

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

Issue 1679773002: WTF::bind: Remove the need of hand-rolled code for bound arguments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make callInternal() private. Created 4 years, 10 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
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 80fbf93210e270418872b96641c02c6b3c7e515f..89dee4a0a50ab58c55907c52267be6916788a5ea 100644
--- a/third_party/WebKit/Source/wtf/FunctionalTest.cpp
+++ b/third_party/WebKit/Source/wtf/FunctionalTest.cpp
@@ -311,6 +311,23 @@ TEST(FunctionalTest, WrapUnwrapInPartialBind)
EXPECT_EQ(21, (*partiallyBoundFunction)(7));
}
+bool lotsOfArguments(int first, int second, int third, int fourth, int fifth, int sixth, int seventh, int eighth, int ninth, int tenth)
+{
+ return first == 1 && second == 2 && third == 3 && fourth == 4 && fifth == 5 && sixth == 6 && seventh == 7 && eighth == 8 && ninth == 9 && tenth == 10;
+}
+
+TEST(FunctionalTest, LotsOfBoundVariables)
+{
+ OwnPtr<Function<bool(int, int)>> eightBound = bind<int, int>(lotsOfArguments, 1, 2, 3, 4, 5, 6, 7, 8);
+ EXPECT_TRUE((*eightBound)(9, 10));
+
+ OwnPtr<Function<bool(int)>> nineBound = bind<int>(lotsOfArguments, 1, 2, 3, 4, 5, 6, 7, 8, 9);
+ EXPECT_TRUE((*nineBound)(10));
+
+ OwnPtr<Function<bool()>> allBound = bind(lotsOfArguments, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
+ EXPECT_TRUE((*allBound)());
+}
+
} // anonymous namespace
} // namespace WTF
« third_party/WebKit/Source/wtf/Functional.h ('K') | « 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