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

Unified Diff: base/mac/bind_objc_block_unittest.mm

Issue 10818034: Adding the possibility to build a closure from an ObjectiveC block. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Adding whitespace. Created 8 years, 5 months 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/mac/bind_objc_block.mm ('K') | « base/mac/bind_objc_block.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« base/mac/bind_objc_block.mm ('K') | « base/mac/bind_objc_block.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698