| Index: base/test/mock_callback.cc
|
| diff --git a/media/base/mock_callback.h b/base/test/mock_callback.cc
|
| similarity index 40%
|
| copy from media/base/mock_callback.h
|
| copy to base/test/mock_callback.cc
|
| index 00d8276067cb441763d23544f8eff69ba0d43159..90c8c4c0616db2ab7ac01c3b15022303f2419789 100644
|
| --- a/media/base/mock_callback.h
|
| +++ b/base/test/mock_callback.cc
|
| @@ -2,35 +2,37 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef MEDIA_BASE_MOCK_CALLBACK_H_
|
| -#define MEDIA_BASE_MOCK_CALLBACK_H_
|
| +#include "base/test/mock_callback.h"
|
|
|
| +#include "base/basictypes.h"
|
| +#include "base/bind.h"
|
| #include "base/callback.h"
|
| -#include "media/base/pipeline_status.h"
|
| +#include "base/memory/ref_counted.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
|
|
| -namespace media {
|
| +namespace {
|
|
|
| -// Utility mock for testing methods expecting Closures. See
|
| -// NewExpectedClosure() below for a helper suitable when expectation order is
|
| -// not checked (or when the expectation can be set at mock construction time).
|
| class MockClosure : public base::RefCountedThreadSafe<MockClosure> {
|
| public:
|
| - MockClosure();
|
| - MOCK_METHOD0(Run, void());
|
| + MockClosure() {}
|
| + MOCK_METHOD0(OnRun, void());
|
|
|
| - protected:
|
| + private:
|
| friend class base::RefCountedThreadSafe<MockClosure>;
|
| - virtual ~MockClosure();
|
| + virtual ~MockClosure() {}
|
|
|
| - private:
|
| DISALLOW_COPY_AND_ASSIGN(MockClosure);
|
| };
|
|
|
| -// Return a callback that expects to be run once.
|
| -base::Closure NewExpectedClosure();
|
| -base::Callback<void(PipelineStatus)> NewExpectedStatusCB(PipelineStatus status);
|
| +} // namespace
|
| +
|
| +namespace base {
|
| +
|
| +base::Closure NewExpectedClosure() {
|
| + MockClosure* mock_closure = new MockClosure();
|
| + EXPECT_CALL(*mock_closure, OnRun());
|
| + return base::Bind(&MockClosure::OnRun, mock_closure);
|
| +}
|
|
|
| -} // namespace media
|
| +} // namespace base
|
|
|
| -#endif // MEDIA_BASE_MOCK_CALLBACK_H_
|
|
|