diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 23:06:59 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 23:06:59 +0000 |
commit | 9e9c869011d525480e1e463ceed357313356815e (patch) | |
tree | e21f999296a94dc8055d804d07518ecbcb465356 /media/base | |
parent | 97dc320a8fd7b25abbac5b35d6cc49111668416b (diff) | |
download | chromium_src-9e9c869011d525480e1e463ceed357313356815e.zip chromium_src-9e9c869011d525480e1e463ceed357313356815e.tar.gz chromium_src-9e9c869011d525480e1e463ceed357313356815e.tar.bz2 |
Checking in media/base/mock_filters.h, a new set of mock filters based on gmock.
TEST=FFmpegDemuxer tests should continue to run
BUG=none
Review URL: http://codereview.chromium.org/147046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
-rw-r--r-- | media/base/mock_filters.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/media/base/mock_filters.h b/media/base/mock_filters.h new file mode 100644 index 0000000..2a2b13c --- /dev/null +++ b/media/base/mock_filters.h @@ -0,0 +1,48 @@ +// 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. +// +// A new breed of mock media filters, this time using gmock! Feel free to add +// actions if you need interesting side-effects (i.e., copying data to the +// buffer passed into MockDataSource::Read()). +// +// Don't forget you can use StrictMock<> and NiceMock<> if you want the mock +// filters to fail the test or do nothing when an unexpected method is called. +// http://code.google.com/p/googlemock/wiki/CookBook#Nice_Mocks_and_Strict_Mocks + +#ifndef MEDIA_BASE_MOCK_FILTERS_H_ +#define MEDIA_BASE_MOCK_FILTERS_H_ + +#include "media/base/filters.h" +#include "testing/gmock/include/gmock/gmock.h" + +namespace media { + +class MockDataSource : public DataSource { + public: + MockDataSource() {} + + // MediaFilter implementation. + MOCK_METHOD0(Stop, void()); + MOCK_METHOD1(SetPlaybackRate, void(float playback_rate)); + MOCK_METHOD1(Seek, void(base::TimeDelta time)); + + // DataSource implementation. + MOCK_METHOD1(Initialize, bool(const std::string& url)); + MOCK_METHOD0(media_format, const MediaFormat&()); + MOCK_METHOD2(Read, size_t(uint8* data, size_t size)); + MOCK_METHOD1(GetPosition, bool(int64* position_out)); + MOCK_METHOD1(SetPosition, bool(int64 position)); + MOCK_METHOD1(GetSize, bool(int64* size_out)); + MOCK_METHOD0(IsSeekable, bool()); + + protected: + virtual ~MockDataSource() {} + + private: + DISALLOW_COPY_AND_ASSIGN(MockDataSource); +}; + +} // namespace media + +#endif // MEDIA_BASE_MOCK_FILTERS_H_ |