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

Side by Side Diff: base/bind_unittest.cc

Issue 1124763003: Update from https://crrev.com/327068 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: update nacl, buildtools, fix display_change_notifier_unittest Created 5 years, 7 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
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 "base/callback.h" 7 #include "base/callback.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 copies = 0; 771 copies = 0;
772 assigns = 0; 772 assigns = 0;
773 Callback<void(CopyCounter)> forward_cb = 773 Callback<void(CopyCounter)> forward_cb =
774 Bind(&VoidPolymorphic1<CopyCounter>); 774 Bind(&VoidPolymorphic1<CopyCounter>);
775 forward_cb.Run(counter); 775 forward_cb.Run(counter);
776 EXPECT_GE(1, copies); 776 EXPECT_GE(1, copies);
777 EXPECT_EQ(0, assigns); 777 EXPECT_EQ(0, assigns);
778 778
779 copies = 0; 779 copies = 0;
780 assigns = 0; 780 assigns = 0;
781 DerivedCopyCounter dervied(&copies, &assigns); 781 DerivedCopyCounter derived(&copies, &assigns);
782 Callback<void(CopyCounter)> coerce_cb = 782 Callback<void(CopyCounter)> coerce_cb =
783 Bind(&VoidPolymorphic1<CopyCounter>); 783 Bind(&VoidPolymorphic1<CopyCounter>);
784 coerce_cb.Run(CopyCounter(dervied)); 784 coerce_cb.Run(CopyCounter(derived));
785 EXPECT_GE(2, copies); 785 EXPECT_GE(2, copies);
786 EXPECT_EQ(0, assigns); 786 EXPECT_EQ(0, assigns);
787 } 787 }
788 788
789 // Callback construction and assignment tests. 789 // Callback construction and assignment tests.
790 // - Construction from an InvokerStorageHolder should not cause ref/deref. 790 // - Construction from an InvokerStorageHolder should not cause ref/deref.
791 // - Assignment from other callback should only cause one ref 791 // - Assignment from other callback should only cause one ref
792 // 792 //
793 // TODO(ajwong): Is there actually a way to test this? 793 // TODO(ajwong): Is there actually a way to test this?
794 794
(...skipping 25 matching lines...) Expand all
820 base::Callback<void(int)> null_cb; 820 base::Callback<void(int)> null_cb;
821 ASSERT_TRUE(null_cb.is_null()); 821 ASSERT_TRUE(null_cb.is_null());
822 EXPECT_DEATH(base::Bind(null_cb, 42), ""); 822 EXPECT_DEATH(base::Bind(null_cb, 42), "");
823 } 823 }
824 824
825 #endif // (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) && 825 #endif // (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) &&
826 // GTEST_HAS_DEATH_TEST 826 // GTEST_HAS_DEATH_TEST
827 827
828 } // namespace 828 } // namespace
829 } // namespace base 829 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698