OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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. |
| 4 |
| 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 |
| 7 #include "base/mac/mac_util.h" |
| 8 #include "chrome/browser/mac/closure_blocks_leopard_compat.h" |
| 9 |
| 10 namespace { |
| 11 |
| 12 // It should be possible to declare a block on OSes as early as Leopard |
| 13 // (10.5). This should be buildable with the 10.5 SDK and a 10.5 deployment |
| 14 // target, and runnable on 10.5. However, the block itself is not expected to |
| 15 // be runnable on 10.5. This test verfies that blocks are buildable on 10.5 |
| 16 // and runnable on Snow Leopard (10.6) and later. |
| 17 TEST(ClosureBlocksLeopardCompatTest, Basic) { |
| 18 bool ran = false; |
| 19 |
| 20 void (^test_block)(bool*) = ^(bool* ran_pointer) { *ran_pointer = true; }; |
| 21 |
| 22 ASSERT_FALSE(ran); |
| 23 |
| 24 if (base::mac::IsOSSnowLeopardOrLater()) { |
| 25 test_block(&ran); |
| 26 |
| 27 ASSERT_TRUE(ran); |
| 28 } |
| 29 } |
| 30 |
| 31 } // namespace |
OLD | NEW |