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

Side by Side Diff: media/base/mock_callback.h

Issue 6350001: Replace MockFilterCallback with MockCallback and simplify unit tests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: forgot some files Created 9 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 | « media/base/composite_filter_unittest.cc ('k') | media/base/mock_callback.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_BASE_MOCK_CALLBACK_H_
6 #define MEDIA_BASE_MOCK_CALLBACK_H_
7
8 #include "base/callback.h"
9 #include "testing/gmock/include/gmock/gmock.h"
10
11 namespace media {
12
13 // Helper class used to test that callbacks are executed.
14 //
15 // In most cases NewExpectedCallback() can be used but if need be you can
16 // manually set expectations on an MockCallback object:
17 //
18 // StrictMock<MockCallback>* callback =
19 // new StrictMock<MockCallback>();
20 // EXPECT_CALL(*callback, RunWithParams(_));
21 // EXPECT_CALL(*callback, Destructor());
22 //
23 // ...or if you don't care about verifying callback deletion:
24 //
25 // NiceMock<MockCallback>* callback =
26 // new NiceMock<MockCallback>();
27 // EXPECT_CALL(*callback, RunWithParams(_));
28 class MockCallback : public CallbackRunner<Tuple0> {
29 public:
30 MockCallback();
31 virtual ~MockCallback();
32
33 MOCK_METHOD1(RunWithParams, void(const Tuple0& params));
34
35 // Can be used to verify the object is destroyed.
36 MOCK_METHOD0(Destructor, void());
37
38 private:
39 DISALLOW_COPY_AND_ASSIGN(MockCallback);
40 };
41
42 // Convenience function that automatically creates and sets an expectation for
43 // the callback to run.
44 MockCallback* NewExpectedCallback();
45
46 } // namespace media
47
48 #endif // MEDIA_BASE_MOCK_CALLBACK_H_
OLDNEW
« no previous file with comments | « media/base/composite_filter_unittest.cc ('k') | media/base/mock_callback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698