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

Side by Side Diff: base/bind_unittest.cc

Issue 2162053006: Move EXPECT_DCHECK_DEATH from base/task_scheduler and use it in relevant base/ tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge up to r408965 Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « base/base.gyp ('k') | base/memory/weak_ptr_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/test/gtest_util.h"
16 #include "build/build_config.h" 17 #include "build/build_config.h"
17 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 20
20 using ::testing::Mock; 21 using ::testing::Mock;
21 using ::testing::Return; 22 using ::testing::Return;
22 using ::testing::StrictMock; 23 using ::testing::StrictMock;
23 24
24 namespace base { 25 namespace base {
25 namespace { 26 namespace {
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 // - Can bind a __stdcall function. 1089 // - Can bind a __stdcall function.
1089 TEST_F(BindTest, WindowsCallingConventions) { 1090 TEST_F(BindTest, WindowsCallingConventions) {
1090 Callback<int()> fastcall_cb = Bind(&FastCallFunc, 1); 1091 Callback<int()> fastcall_cb = Bind(&FastCallFunc, 1);
1091 EXPECT_EQ(1, fastcall_cb.Run()); 1092 EXPECT_EQ(1, fastcall_cb.Run());
1092 1093
1093 Callback<int()> stdcall_cb = Bind(&StdCallFunc, 2); 1094 Callback<int()> stdcall_cb = Bind(&StdCallFunc, 2);
1094 EXPECT_EQ(2, stdcall_cb.Run()); 1095 EXPECT_EQ(2, stdcall_cb.Run());
1095 } 1096 }
1096 #endif 1097 #endif
1097 1098
1098 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && GTEST_HAS_DEATH_TEST
1099
1100 // Test null callbacks cause a DCHECK. 1099 // Test null callbacks cause a DCHECK.
1101 TEST(BindDeathTest, NullCallback) { 1100 TEST(BindDeathTest, NullCallback) {
1102 base::Callback<void(int)> null_cb; 1101 base::Callback<void(int)> null_cb;
1103 ASSERT_TRUE(null_cb.is_null()); 1102 ASSERT_TRUE(null_cb.is_null());
1104 EXPECT_DEATH(base::Bind(null_cb, 42), ""); 1103 EXPECT_DCHECK_DEATH(base::Bind(null_cb, 42), "");
1105 } 1104 }
1106 1105
1107 #endif // (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) &&
1108 // GTEST_HAS_DEATH_TEST
1109
1110 } // namespace 1106 } // namespace
1111 } // namespace base 1107 } // namespace base
OLDNEW
« no previous file with comments | « base/base.gyp ('k') | base/memory/weak_ptr_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698