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

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

Issue 2092093002: Make WTF::Function be a base::Callback wrapper (5/5) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@03_wrap
Patch Set: rebase Created 4 years, 6 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 5f9196220fa4f84a9f03ada791ee2ed28d27a5e9..d21003a280ab37c5abf8d215a294c3d0fa5a866d 100644
--- a/third_party/WebKit/Source/wtf/FunctionalTest.cpp
+++ b/third_party/WebKit/Source/wtf/FunctionalTest.cpp
@@ -531,16 +531,16 @@ TEST(FunctionalTest, CountCopiesOfBoundArguments)
{
CountCopy lvalue;
std::unique_ptr<Function<int()>> bound = bind(takeCountCopyAsConstReference, lvalue);
- EXPECT_EQ(1, (*bound)()); // unwrapping.
+ EXPECT_EQ(2, (*bound)()); // wrapping and unwrapping.
bound = bind(takeCountCopyAsConstReference, CountCopy()); // Rvalue.
- EXPECT_EQ(1, (*bound)());
+ EXPECT_EQ(2, (*bound)());
bound = bind(takeCountCopyAsValue, lvalue);
- EXPECT_EQ(2, (*bound)()); // unwrapping and copying in the final function argument.
+ EXPECT_EQ(3, (*bound)()); // wrapping, unwrapping and copying in the final function argument.
bound = bind(takeCountCopyAsValue, CountCopy());
- EXPECT_EQ(2, (*bound)());
+ EXPECT_EQ(3, (*bound)());
}
TEST(FunctionalTest, MoveUnboundArgumentsByRvalueReference)
@@ -568,7 +568,7 @@ TEST(FunctionalTest, CountCopiesOfUnboundArguments)
EXPECT_EQ(0, (*bound1)(CountCopy()));
std::unique_ptr<Function<int(CountCopy)>> bound2 = bind(takeCountCopyAsValue);
- EXPECT_EQ(2, (*bound2)(lvalue)); // At PartBoundFunctionImpl::operator() and at the destination function.
+ EXPECT_EQ(3, (*bound2)(lvalue)); // At Function::operator(), at Callback::Run() and at the destination function.
EXPECT_LE((*bound2)(CountCopy()), 2); // Compiler is allowed to optimize one copy away if the argument is rvalue.
}
« 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