OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "base/mac/bind_objc_block.h" | 5 #import "base/mac/bind_objc_block.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
| 9 #include "base/bind.h" |
9 #include "base/callback.h" | 10 #include "base/callback.h" |
10 #include "base/bind.h" | |
11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 TEST(BindObjcBlockTest, TestScopedClosureRunnerExitScope) { | 16 TEST(BindObjcBlockTest, TestScopedClosureRunnerExitScope) { |
17 int run_count = 0; | 17 int run_count = 0; |
18 int* ptr = &run_count; | 18 int* ptr = &run_count; |
19 { | 19 { |
20 base::ScopedClosureRunner runner(base::BindBlock(^{ | 20 base::ScopedClosureRunner runner(base::BindBlock(^{ |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 const std::string& d, int e, const std::string& f) { | 90 const std::string& d, int e, const std::string& f) { |
91 *ptr = c + d + f; | 91 *ptr = c + d + f; |
92 *ptr2 = a + b + e; | 92 *ptr2 = a + b + e; |
93 }); | 93 }); |
94 c.Run(1, 2, "infinite", "improbability", 3, "drive"); | 94 c.Run(1, 2, "infinite", "improbability", 3, "drive"); |
95 EXPECT_EQ(result1, "infiniteimprobabilitydrive"); | 95 EXPECT_EQ(result1, "infiniteimprobabilitydrive"); |
96 EXPECT_EQ(result2, 6); | 96 EXPECT_EQ(result2, 6); |
97 } | 97 } |
98 | 98 |
99 } // namespace | 99 } // namespace |
OLD | NEW |