diff options
author | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-20 08:28:14 +0000 |
---|---|---|
committer | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-20 08:28:14 +0000 |
commit | 8cf362c47537537f8f42cce51cf012e37b7ed15b (patch) | |
tree | 9051287133265f106bc7e5f4980399b3548058ab /base/bind_unittest.cc | |
parent | 39cf85204d923c48f824b205f7a4e905d7ba9620 (diff) | |
download | chromium_src-8cf362c47537537f8f42cce51cf012e37b7ed15b.zip chromium_src-8cf362c47537537f8f42cce51cf012e37b7ed15b.tar.gz chromium_src-8cf362c47537537f8f42cce51cf012e37b7ed15b.tar.bz2 |
Add DCHECK to avoid binding values to null callbacks
BUG=161714
TEST=base_unittests
Review URL: https://chromiumcodereview.appspot.com/11419061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168764 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/bind_unittest.cc')
-rw-r--r-- | base/bind_unittest.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/base/bind_unittest.cc b/base/bind_unittest.cc index 0f91b2e..1d808a6 100644 --- a/base/bind_unittest.cc +++ b/base/bind_unittest.cc @@ -798,5 +798,17 @@ TEST_F(BindTest, WindowsCallingConventions) { } #endif +#if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && GTEST_HAS_DEATH_TEST + +// Test null callbacks cause a DCHECK. +TEST(BindDeathTest, NullCallback) { + base::Callback<void(int)> null_cb; + ASSERT_TRUE(null_cb.is_null()); + EXPECT_DEATH(base::Bind(null_cb, 42), ""); +} + +#endif // (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && + // GTEST_HAS_DEATH_TEST + } // namespace } // namespace base |