Index: base/mac/bind_objc_block_unittest.mm |
diff --git a/base/bind_helpers_unittest.cc b/base/mac/bind_objc_block_unittest.mm |
similarity index 61% |
copy from base/bind_helpers_unittest.cc |
copy to base/mac/bind_objc_block_unittest.mm |
index 3ef2d7543540464ddefc06c14d9726078d18a2b0..17fbe6ee94a0ab97b158e9449cbb4f08e8086f36 100644 |
--- a/base/bind_helpers_unittest.cc |
+++ b/base/mac/bind_objc_block_unittest.mm |
@@ -2,32 +2,35 @@ |
// 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" |
+#import "base/mac/bind_objc_block.h" |
#include "base/callback.h" |
#include "base/bind.h" |
+#include "base/bind_helpers.h" |
#include "testing/gtest/include/gtest/gtest.h" |
namespace { |
-void Increment(int* value) { |
- (*value)++; |
-} |
- |
-TEST(BindHelpersTest, TestScopedClosureRunnerExitScope) { |
+TEST(BindObjcBlockTest, TestScopedClosureRunnerExitScope) { |
int run_count = 0; |
+ int* ptr = &run_count; |
{ |
- base::ScopedClosureRunner runner(base::Bind(&Increment, &run_count)); |
+ base::ScopedClosureRunner runner(base::BindBlock(^{ |
+ (*ptr)++; |
+ })); |
EXPECT_EQ(0, run_count); |
} |
EXPECT_EQ(1, run_count); |
} |
-TEST(BindHelpersTest, TestScopedClosureRunnerRelease) { |
+TEST(BindObjcBlockTest, TestScopedClosureRunnerRelease) { |
int run_count = 0; |
+ int* ptr = &run_count; |
base::Closure c; |
{ |
- base::ScopedClosureRunner runner(base::Bind(&Increment, &run_count)); |
+ base::ScopedClosureRunner runner(base::BindBlock(^{ |
+ (*ptr)++; |
+ })); |
c = runner.Release(); |
EXPECT_EQ(0, run_count); |
} |