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

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: 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
« base/task_runner_util.h ('K') | « 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..f5d379b5a1583a876f39e9cae3640ec1c4d53bdf 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, PostTaskAndReplyWithResultImplitConvert) {
Jeffrey Yasskin 2012/11/05 22:13:22 sp: Implit
awong 2012/11/19 05:57:09 Done.
+ 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.0f, result);
Jeffrey Yasskin 2012/11/05 22:13:22 s/42.0f/42.0/ since it's supposed to be a double,
awong 2012/11/19 05:57:09 Done.
+}
+
TEST(TaskRunnerHelpersTest, PostTaskAndReplyWithResultPassed) {
g_foo_destruct_count = 0;
g_foo_free_count = 0;
« base/task_runner_util.h ('K') | « base/task_runner_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698