Remove task.h and finish base::Bind() migration.
Over 341 CLs, in ~3 months, touching 3251 unique files!
Top 5 most CLs:
(121) jhawkins
( 45) dcheng
( 24) achuith
( 23) csilv
( 12) tfarina
( 12) groby
~1000 files touched:
(918) jhawkins
100+ files touched:
(486) ajwong
(385) willchan
(372) dcheng
(126) csilv
(123) fischman
(112) sergeyu
49+ files touched:
(65) tfarina
(57) acolwell
(52) adamk
(49) tzik
BUG=35223
TEST=existing
Review URL: http://codereview.chromium.org/9114020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116748 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/bind_helpers_unittest.cc b/base/bind_helpers_unittest.cc
new file mode 100644
index 0000000..3ef2d754
--- /dev/null
+++ b/base/bind_helpers_unittest.cc
@@ -0,0 +1,39 @@
+// 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/bind_helpers.h"
+
+#include "base/callback.h"
+#include "base/bind.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+
+void Increment(int* value) {
+ (*value)++;
+}
+
+TEST(BindHelpersTest, TestScopedClosureRunnerExitScope) {
+ int run_count = 0;
+ {
+ base::ScopedClosureRunner runner(base::Bind(&Increment, &run_count));
+ EXPECT_EQ(0, run_count);
+ }
+ EXPECT_EQ(1, run_count);
+}
+
+TEST(BindHelpersTest, TestScopedClosureRunnerRelease) {
+ int run_count = 0;
+ base::Closure c;
+ {
+ base::ScopedClosureRunner runner(base::Bind(&Increment, &run_count));
+ c = runner.Release();
+ EXPECT_EQ(0, run_count);
+ }
+ EXPECT_EQ(0, run_count);
+ c.Run();
+ EXPECT_EQ(1, run_count);
+}
+
+} // namespace