| 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 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 TEST_F(BindTest, CapturelessLambda) { | 1234 TEST_F(BindTest, CapturelessLambda) { |
| 1235 EXPECT_FALSE(internal::IsConvertibleToRunType<void>::value); | 1235 EXPECT_FALSE(internal::IsConvertibleToRunType<void>::value); |
| 1236 EXPECT_FALSE(internal::IsConvertibleToRunType<int>::value); | 1236 EXPECT_FALSE(internal::IsConvertibleToRunType<int>::value); |
| 1237 EXPECT_FALSE(internal::IsConvertibleToRunType<void(*)()>::value); | 1237 EXPECT_FALSE(internal::IsConvertibleToRunType<void(*)()>::value); |
| 1238 EXPECT_FALSE(internal::IsConvertibleToRunType<void(NoRef::*)()>::value); | 1238 EXPECT_FALSE(internal::IsConvertibleToRunType<void(NoRef::*)()>::value); |
| 1239 | 1239 |
| 1240 auto f = []() {}; | 1240 auto f = []() {}; |
| 1241 EXPECT_TRUE(internal::IsConvertibleToRunType<decltype(f)>::value); | 1241 EXPECT_TRUE(internal::IsConvertibleToRunType<decltype(f)>::value); |
| 1242 | 1242 |
| 1243 int i = 0; | 1243 int i = 0; |
| 1244 auto g = [i]() {}; | 1244 auto g = [i]() { (void)i; }; |
| 1245 EXPECT_FALSE(internal::IsConvertibleToRunType<decltype(g)>::value); | 1245 EXPECT_FALSE(internal::IsConvertibleToRunType<decltype(g)>::value); |
| 1246 | 1246 |
| 1247 auto h = [](int, double) { return 'k'; }; | 1247 auto h = [](int, double) { return 'k'; }; |
| 1248 EXPECT_TRUE((std::is_same< | 1248 EXPECT_TRUE((std::is_same< |
| 1249 char(int, double), | 1249 char(int, double), |
| 1250 internal::ExtractCallableRunType<decltype(h)>>::value)); | 1250 internal::ExtractCallableRunType<decltype(h)>>::value)); |
| 1251 | 1251 |
| 1252 EXPECT_EQ(42, Bind([] { return 42; }).Run()); | 1252 EXPECT_EQ(42, Bind([] { return 42; }).Run()); |
| 1253 EXPECT_EQ(42, Bind([](int i) { return i * 7; }, 6).Run()); | 1253 EXPECT_EQ(42, Bind([](int i) { return i * 7; }, 6).Run()); |
| 1254 | 1254 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 | 1410 |
| 1411 // Test null callbacks cause a DCHECK. | 1411 // Test null callbacks cause a DCHECK. |
| 1412 TEST(BindDeathTest, NullCallback) { | 1412 TEST(BindDeathTest, NullCallback) { |
| 1413 base::Callback<void(int)> null_cb; | 1413 base::Callback<void(int)> null_cb; |
| 1414 ASSERT_TRUE(null_cb.is_null()); | 1414 ASSERT_TRUE(null_cb.is_null()); |
| 1415 EXPECT_DCHECK_DEATH(base::Bind(null_cb, 42)); | 1415 EXPECT_DCHECK_DEATH(base::Bind(null_cb, 42)); |
| 1416 } | 1416 } |
| 1417 | 1417 |
| 1418 } // namespace | 1418 } // namespace |
| 1419 } // namespace base | 1419 } // namespace base |
| OLD | NEW |