diff options
author | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 21:48:54 +0000 |
---|---|---|
committer | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-14 21:48:54 +0000 |
commit | 115288648041898b6d50f7d2e17391e2d1972a76 (patch) | |
tree | eee67d927a7ebb40e87848924a8f26c5c5cb99ca /base/bind_unittest.cc | |
parent | e91ac22d99252095839ca7c82c092972bd56445e (diff) | |
download | chromium_src-115288648041898b6d50f7d2e17391e2d1972a76.zip chromium_src-115288648041898b6d50f7d2e17391e2d1972a76.tar.gz chromium_src-115288648041898b6d50f7d2e17391e2d1972a76.tar.bz2 |
Revert 114494 - Remove BindStateHolder and have Bind() return a Callback<> object directly.
This removes some complexity and also fixes a bug where if you call Bind() with the result of Bind(), the resulting Callback would only be valid during the first call. Ouch.
BUG=none
TEST=new unittests
Review URL: http://codereview.chromium.org/8738001
TBR=ajwong@chromium.org
Review URL: http://codereview.chromium.org/8914022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114495 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/bind_unittest.cc')
-rw-r--r-- | base/bind_unittest.cc | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/base/bind_unittest.cc b/base/bind_unittest.cc index 372523b..654a277 100644 --- a/base/bind_unittest.cc +++ b/base/bind_unittest.cc @@ -199,18 +199,10 @@ void RefArgSet(int &n) { n = 2; } -void PtrArgSet(int *n) { - *n = 2; -} - int FunctionWithWeakFirstParam(WeakPtr<NoRef> o, int n) { return n; } -void TakesACallback(const Closure& callback) { - callback.Run(); -} - class BindTest : public ::testing::Test { public: BindTest() { @@ -292,25 +284,6 @@ TEST_F(BindTest, CurryingTest) { EXPECT_EQ(63, c0.Run()); } -// Test that currying the rvalue result of another Bind() works correctly. -// - rvalue should be usable as argument to Bind(). -// - multiple runs of resulting Callback remain valid. -TEST_F(BindTest, CurryingRvalueResultOfBind) { - int n = 0; - Closure cb = base::Bind(&TakesACallback, base::Bind(&PtrArgSet, &n)); - - // If we implement Bind() such that the return value has auto_ptr-like - // semantics, the second call here will fail because ownership of - // the internal BindState<> would have been transfered to a *temporary* - // constructon of a Callback object on the first call. - cb.Run(); - EXPECT_EQ(2, n); - - n = 0; - cb.Run(); - EXPECT_EQ(2, n); -} - // Function type support. // - Normal function. // - Normal function bound with non-refcounted first argument. |