diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-09 00:16:06 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-09 00:16:06 +0000 |
commit | d3ae70d1a35c3112bb4809396a536da8135a32df (patch) | |
tree | 2e032c1c58f31187063b177c2d75f98ee4a84ad2 /media/base | |
parent | 83548cfb4900fa35d3f34a88340f10d2bcce74fc (diff) | |
download | chromium_src-d3ae70d1a35c3112bb4809396a536da8135a32df.zip chromium_src-d3ae70d1a35c3112bb4809396a536da8135a32df.tar.gz chromium_src-d3ae70d1a35c3112bb4809396a536da8135a32df.tar.bz2 |
Added new gmock-based MockFilterHost and deprecated the old one.
Updated FileDataSource tests to use the new MockFilterHost as a proof of concept, also because my pipeline refactoring completely broke the test.
BUG=16008
TEST=FileDataSourceTest.* should pass
Review URL: http://codereview.chromium.org/149350
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20219 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
-rw-r--r-- | media/base/mock_filter_host.h | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/media/base/mock_filter_host.h b/media/base/mock_filter_host.h index d6fde0b..3cc5860 100644 --- a/media/base/mock_filter_host.h +++ b/media/base/mock_filter_host.h @@ -1,11 +1,13 @@ // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this // source code is governed by a BSD-style license that can be found in the // LICENSE file. - -// The corresponding FilterHost implementation for MockPipeline. Maintains a -// reference to the parent MockPipeline and a reference to the Filter its -// hosting. Common usage is to check if the hosted filter has initialized by -// calling IsInitialized(). +// +// A FilterHost implementation based on gmock. Combined with setting a message +// loop on a filter, permits single-threaded testing of filters without +// requiring a pipeline. +// +// TODO(scherkus): Remove old_mocks::MockFilterHost as soon as other tests have +// transitioned over to the new gmock-based MockFilterHost. #ifndef MEDIA_BASE_MOCK_FILTER_HOST_H_ #define MEDIA_BASE_MOCK_FILTER_HOST_H_ @@ -19,10 +21,33 @@ #include "media/base/filters.h" #include "media/base/media_format.h" #include "media/base/mock_pipeline.h" +#include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" namespace media { +class MockFilterHost : public FilterHost { + public: + MockFilterHost() {} + + // FilterHost implementation. + MOCK_METHOD0(InitializationComplete, void()); + MOCK_METHOD1(Error, void(PipelineError error)); + MOCK_CONST_METHOD0(GetTime, base::TimeDelta()); + MOCK_METHOD1(SetTime, void(base::TimeDelta time)); + MOCK_METHOD1(SetDuration, void(base::TimeDelta duration)); + MOCK_METHOD1(SetBufferedTime, void(base::TimeDelta buffered_time)); + MOCK_METHOD1(SetTotalBytes, void(int64 total_bytes)); + MOCK_METHOD1(SetBufferedBytes, void(int64 buffered_bytes)); + MOCK_METHOD2(SetVideoSize, void(size_t width, size_t height)); + + private: + DISALLOW_COPY_AND_ASSIGN(MockFilterHost); +}; + +namespace old_mocks { + +// This version is deprecated. template <class Filter> class MockFilterHost : public FilterHost { public: @@ -121,6 +146,8 @@ class MockFilterHost : public FilterHost { DISALLOW_COPY_AND_ASSIGN(MockFilterHost); }; +} // namespace old_mocks + } // namespace media #endif // MEDIA_BASE_MOCK_FILTER_HOST_H_ |