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

Unified Diff: media/filters/ffmpeg_glue_unittest.cc

Issue 7587012: Remove mock_ffmpeg and update media unittests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: media/filters/ffmpeg_glue_unittest.cc
diff --git a/media/filters/ffmpeg_glue_unittest.cc b/media/filters/ffmpeg_glue_unittest.cc
index 158ddbb49fc316592da019019dae8d5fc14916ca..a97f41089d460dfead45c1cca24c87f01e721286 100644
--- a/media/filters/ffmpeg_glue_unittest.cc
+++ b/media/filters/ffmpeg_glue_unittest.cc
@@ -4,7 +4,6 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
-#include "media/base/mock_ffmpeg.h"
#include "media/base/mock_filters.h"
#include "media/ffmpeg/ffmpeg_common.h"
#include "media/filters/ffmpeg_glue.h"
@@ -36,17 +35,19 @@ class MockProtocol : public FFmpegURLProtocol {
class FFmpegGlueTest : public ::testing::Test {
public:
- FFmpegGlueTest() {}
+ FFmpegGlueTest() : protocol_(NULL) {}
virtual void SetUp() {
scherkus (not reviewing) 2011/08/11 01:26:29 Shouldn't this test initialize the media library?
acolwell GONE FROM CHROMIUM 2011/08/11 23:54:40 Done.
// Singleton should initialize FFmpeg.
CHECK(FFmpegGlue::GetInstance());
// Assign our static copy of URLProtocol for the rest of the tests.
- protocol_ = MockFFmpeg::protocol();
+ protocol_ = FFmpegGlue::url_protocol();
CHECK(protocol_);
}
+ MOCK_METHOD1(CheckPoint, void(int val));
+
// Helper to open a URLContext pointing to the given mocked protocol.
// Callers are expected to close the context at the end of their test.
virtual void OpenContext(MockProtocol* protocol, URLContext* context) {
@@ -62,15 +63,12 @@ class FFmpegGlueTest : public ::testing::Test {
protected:
// Fixture members.
- MockFFmpeg mock_ffmpeg_;
- static URLProtocol* protocol_;
+ URLProtocol* protocol_;
private:
DISALLOW_COPY_AND_ASSIGN(FFmpegGlueTest);
};
-URLProtocol* FFmpegGlueTest::protocol_ = NULL;
-
TEST_F(FFmpegGlueTest, InitializeFFmpeg) {
// Make sure URLProtocol was filled out correctly.
EXPECT_STREQ("http", protocol_->name);
@@ -118,7 +116,7 @@ TEST_F(FFmpegGlueTest, AddRemoveGetProtocol) {
InSequence s;
EXPECT_CALL(*protocol_a, OnDestroy());
EXPECT_CALL(*protocol_b, OnDestroy());
- EXPECT_CALL(mock_ffmpeg_, CheckPoint(0));
+ EXPECT_CALL(*this, CheckPoint(0));
glue->RemoveProtocol(protocol_a.get());
glue->GetProtocol(key_a, &protocol_c);
@@ -132,7 +130,7 @@ TEST_F(FFmpegGlueTest, AddRemoveGetProtocol) {
protocol_b.reset();
// Data sources should be deleted by this point.
- mock_ffmpeg_.CheckPoint(0);
+ CheckPoint(0);
}
TEST_F(FFmpegGlueTest, OpenClose) {
@@ -162,22 +160,22 @@ TEST_F(FFmpegGlueTest, OpenClose) {
// held by FFmpeg. Once we close the URLContext, the protocol should be
// destroyed.
InSequence s;
- EXPECT_CALL(mock_ffmpeg_, CheckPoint(0));
- EXPECT_CALL(mock_ffmpeg_, CheckPoint(1));
+ EXPECT_CALL(*this, CheckPoint(0));
+ EXPECT_CALL(*this, CheckPoint(1));
EXPECT_CALL(*protocol, OnDestroy());
- EXPECT_CALL(mock_ffmpeg_, CheckPoint(2));
+ EXPECT_CALL(*this, CheckPoint(2));
// Remove the protocol from the glue layer, releasing a reference.
glue->RemoveProtocol(protocol.get());
- mock_ffmpeg_.CheckPoint(0);
+ CheckPoint(0);
// Remove our own reference -- URLContext should maintain a reference.
- mock_ffmpeg_.CheckPoint(1);
+ CheckPoint(1);
protocol.reset();
// Close the URLContext, which should release the final reference.
EXPECT_EQ(0, protocol_->url_close(&context));
- mock_ffmpeg_.CheckPoint(2);
+ CheckPoint(2);
}
TEST_F(FFmpegGlueTest, Write) {
@@ -309,11 +307,11 @@ TEST_F(FFmpegGlueTest, Destroy) {
// We should expect the protocol to get destroyed when the unit test
// exits.
InSequence s;
- EXPECT_CALL(mock_ffmpeg_, CheckPoint(0));
+ EXPECT_CALL(*this, CheckPoint(0));
EXPECT_CALL(*protocol, OnDestroy());
// Remove our own reference, we shouldn't be destroyed yet.
- mock_ffmpeg_.CheckPoint(0);
+ CheckPoint(0);
protocol.reset();
// ~FFmpegGlue() will be called when this unit test finishes execution. By

Powered by Google App Engine
This is Rietveld 408576698