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

Side by Side Diff: base/test/mock_callback.cc

Issue 11238034: Added completion notification to Profile's ClearNetworkingHistorySince. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Final touches. Created 8 years, 1 month 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
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 #ifndef MEDIA_BASE_MOCK_CALLBACK_H_ 5 #include "base/test/mock_callback.h"
6 #define MEDIA_BASE_MOCK_CALLBACK_H_
7 6
7 #include "base/basictypes.h"
8 #include "base/bind.h"
8 #include "base/callback.h" 9 #include "base/callback.h"
9 #include "media/base/pipeline_status.h" 10 #include "base/memory/ref_counted.h"
10 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
11 12
12 namespace media { 13 namespace {
13 14
14 // Utility mock for testing methods expecting Closures. See
15 // NewExpectedClosure() below for a helper suitable when expectation order is
16 // not checked (or when the expectation can be set at mock construction time).
17 class MockClosure : public base::RefCountedThreadSafe<MockClosure> { 15 class MockClosure : public base::RefCountedThreadSafe<MockClosure> {
18 public: 16 public:
19 MockClosure(); 17 MockClosure() {}
20 MOCK_METHOD0(Run, void()); 18 MOCK_METHOD0(OnRun, void());
21
22 protected:
23 friend class base::RefCountedThreadSafe<MockClosure>;
24 virtual ~MockClosure();
25 19
26 private: 20 private:
21 friend class base::RefCountedThreadSafe<MockClosure>;
22 virtual ~MockClosure() {}
23
27 DISALLOW_COPY_AND_ASSIGN(MockClosure); 24 DISALLOW_COPY_AND_ASSIGN(MockClosure);
28 }; 25 };
29 26
30 // Return a callback that expects to be run once. 27 } // namespace
31 base::Closure NewExpectedClosure();
32 base::Callback<void(PipelineStatus)> NewExpectedStatusCB(PipelineStatus status);
33 28
34 } // namespace media 29 namespace base {
35 30
36 #endif // MEDIA_BASE_MOCK_CALLBACK_H_ 31 base::Closure NewExpectedClosure() {
32 MockClosure* mock_closure = new MockClosure();
33 EXPECT_CALL(*mock_closure, OnRun());
34 return base::Bind(&MockClosure::OnRun, mock_closure);
35 }
36
37 } // namespace base
38
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698