diff options
author | battre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-17 02:48:06 +0000 |
---|---|---|
committer | battre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-17 02:48:06 +0000 |
commit | 95991b1967e509c94c3eb6bb0750fafd398c863c (patch) | |
tree | 0a60e38f57eb9c81d0ac2a2e37d18fec86945a0d /base/task_runner_util_unittest.cc | |
parent | 533ba2ca7197b5b528173f207d0be4d171595cc2 (diff) | |
download | chromium_src-95991b1967e509c94c3eb6bb0750fafd398c863c.zip chromium_src-95991b1967e509c94c3eb6bb0750fafd398c863c.tar.gz chromium_src-95991b1967e509c94c3eb6bb0750fafd398c863c.tar.bz2 |
Move PostTaskAndReplyWithStatus into task_runner_helpers.h
BUG=TBD
TEST=no
Review URL: http://codereview.chromium.org/9416060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132527 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/task_runner_util_unittest.cc')
-rw-r--r-- | base/task_runner_util_unittest.cc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/base/task_runner_util_unittest.cc b/base/task_runner_util_unittest.cc new file mode 100644 index 0000000..4c58826 --- /dev/null +++ b/base/task_runner_util_unittest.cc @@ -0,0 +1,40 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/task_runner_util.h" + +#include "base/bind.h" +#include "base/message_loop.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace base { + +namespace { + +int ReturnFourtyTwo() { + return 42; +} + +void StoreValue(int* destination, int value) { + *destination = value; +} + +} // namespace + +TEST(TaskRunnerHelpersTest, PostAndReplyWithStatus) { + MessageLoop message_loop; + int result = 0; + + PostTaskAndReplyWithResult( + message_loop.message_loop_proxy(), + FROM_HERE, + Bind(&ReturnFourtyTwo), + Bind(&StoreValue, &result)); + + message_loop.RunAllPending(); + + EXPECT_EQ(42, result); +} + +} // namespace base |