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

Side by Side Diff: base/callback_unittest.cc

Issue 9028009: base::Bind: Remove callback_old.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Actually remove callback_old.h Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « base/callback_old.h ('k') | base/observer_list_threadsafe.h » ('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) 2011 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/callback.h" 5 #include "base/callback.h"
6 #include "base/callback_internal.h" 6 #include "base/callback_internal.h"
7 #include "base/callback_old.h"
8 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
9 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
10 9
11 namespace base { 10 namespace base {
12 11
13 namespace { 12 namespace {
14 13
15 class HelperObject { 14 class HelperObject {
16 public: 15 public:
17 HelperObject() : next_number_(0) { } 16 HelperObject() : next_number_(0) { }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } // namespace internal 54 } // namespace internal
56 55
57 namespace { 56 namespace {
58 57
59 typedef internal::BindState<void(void), void(void), void(FakeInvoker)> 58 typedef internal::BindState<void(void), void(void), void(FakeInvoker)>
60 FakeBindState1; 59 FakeBindState1;
61 typedef internal::BindState<void(void), void(void), 60 typedef internal::BindState<void(void), void(void),
62 void(FakeInvoker, FakeInvoker)> 61 void(FakeInvoker, FakeInvoker)>
63 FakeBindState2; 62 FakeBindState2;
64 63
65 TEST(CallbackOld, OneArg) {
66 HelperObject obj;
67 scoped_ptr<Callback1<int*>::Type> callback(
68 NewCallback(&obj, &HelperObject::GetNextNumberArg));
69
70 int number = 0;
71 callback->Run(&number);
72 EXPECT_EQ(number, 1);
73 }
74
75 TEST(CallbackOld, ReturnValue) {
76 HelperObject obj;
77 scoped_ptr<CallbackWithReturnValue<int>::Type> callback(
78 NewCallbackWithReturnValue(&obj, &HelperObject::GetNextNumber));
79
80 EXPECT_EQ(callback->Run(), 1);
81 }
82
83 class CallbackTest : public ::testing::Test { 64 class CallbackTest : public ::testing::Test {
84 public: 65 public:
85 CallbackTest() 66 CallbackTest()
86 : callback_a_(new FakeBindState1()), 67 : callback_a_(new FakeBindState1()),
87 callback_b_(new FakeBindState2()) { 68 callback_b_(new FakeBindState2()) {
88 } 69 }
89 70
90 virtual ~CallbackTest() { 71 virtual ~CallbackTest() {
91 } 72 }
92 73
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 ASSERT_FALSE(callback_a_.Equals(null_callback_)); 125 ASSERT_FALSE(callback_a_.Equals(null_callback_));
145 126
146 callback_a_.Reset(); 127 callback_a_.Reset();
147 128
148 EXPECT_TRUE(callback_a_.is_null()); 129 EXPECT_TRUE(callback_a_.is_null());
149 EXPECT_TRUE(callback_a_.Equals(null_callback_)); 130 EXPECT_TRUE(callback_a_.Equals(null_callback_));
150 } 131 }
151 132
152 } // namespace 133 } // namespace
153 } // namespace base 134 } // namespace base
OLDNEW
« no previous file with comments | « base/callback_old.h ('k') | base/observer_list_threadsafe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698