1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #import "base/mac/bind_objc_block.h"
7 #include "base/callback.h"
9 #include "base/bind_helpers.h"
10 #include "testing/gtest/include/gtest/gtest.h"
14 TEST(BindObjcBlockTest, TestScopedClosureRunnerExitScope) {
16 int* ptr = &run_count;
18 base::ScopedClosureRunner runner(base::BindBlock(^{
21 EXPECT_EQ(0, run_count);
23 EXPECT_EQ(1, run_count);
26 TEST(BindObjcBlockTest, TestScopedClosureRunnerRelease) {
28 int* ptr = &run_count;
31 base::ScopedClosureRunner runner(base::BindBlock(^{
35 EXPECT_EQ(0, run_count);
37 EXPECT_EQ(0, run_count);
39 EXPECT_EQ(1, run_count);