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

Unified Diff: base/task_runner_util_unittest.cc

Issue 11369061: Disassociate argument type from return type in PostTaskAndReplyWithResult template. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix cut/paste error Created 8 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/task_runner_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_runner_util_unittest.cc
diff --git a/base/task_runner_util_unittest.cc b/base/task_runner_util_unittest.cc
index e6430bf4e006e29527353d8af7aa4999000ee499..d4d37692bace08028a619dccb7a752494cbaafdd 100644
--- a/base/task_runner_util_unittest.cc
+++ b/base/task_runner_util_unittest.cc
@@ -20,6 +20,10 @@ void StoreValue(int* destination, int value) {
*destination = value;
}
+void StoreDoubleValue(double* destination, double value) {
+ *destination = value;
+}
+
int g_foo_destruct_count = 0;
int g_foo_free_count = 0;
@@ -75,6 +79,21 @@ TEST(TaskRunnerHelpersTest, PostTaskAndReplyWithResult) {
EXPECT_EQ(42, result);
}
+TEST(TaskRunnerHelpersTest, PostTaskAndReplyWithResultImplicitConvert) {
+ MessageLoop message_loop;
+ double result = 0;
+
+ PostTaskAndReplyWithResult(
+ message_loop.message_loop_proxy(),
+ FROM_HERE,
+ Bind(&ReturnFourtyTwo),
+ Bind(&StoreDoubleValue, &result));
+
+ message_loop.RunUntilIdle();
+
+ EXPECT_DOUBLE_EQ(42.0, result);
+}
+
TEST(TaskRunnerHelpersTest, PostTaskAndReplyWithResultPassed) {
g_foo_destruct_count = 0;
g_foo_free_count = 0;
« no previous file with comments | « base/task_runner_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698