From d9d3ff3e2010839f81ef5522cb14dfb2a08dc401 Mon Sep 17 00:00:00 2001 From: "hclam@chromium.org" Date: Fri, 5 Mar 2010 23:52:02 +0000 Subject: Fix crashing in FFmpegGlueTest.Write and friends BUG=36037 TEST=FFmpegGlueTest.* runs on build bot FFmpegGlueTest.Write was crashing on build bots due to that it has dependencies on previous test to run. And strangely the build bot didn't run all the test cases, resulting the crash. This is fixed by extracting the initialization step and putting it into a common test setup task. Review URL: http://codereview.chromium.org/668034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40800 0039d316-1c4b-4281-b951-d872f2087c98 --- media/filters/ffmpeg_glue_unittest.cc | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/media/filters/ffmpeg_glue_unittest.cc b/media/filters/ffmpeg_glue_unittest.cc index 65e4878..3bf65e4 100644 --- a/media/filters/ffmpeg_glue_unittest.cc +++ b/media/filters/ffmpeg_glue_unittest.cc @@ -35,10 +35,20 @@ class MockProtocol : public FFmpegURLProtocol { class FFmpegGlueTest : public ::testing::Test { public: FFmpegGlueTest() { + } + + virtual void SetUp() { MockFFmpeg::set(&mock_ffmpeg_); + + // Singleton should initialize FFmpeg. + CHECK(FFmpegGlue::get()); + + // Assign our static copy of URLProtocol for the rest of the tests. + protocol_ = MockFFmpeg::protocol(); + CHECK(protocol_); } - virtual ~FFmpegGlueTest() { + virtual void TearDown() { MockFFmpeg::set(NULL); } @@ -67,13 +77,6 @@ class FFmpegGlueTest : public ::testing::Test { URLProtocol* FFmpegGlueTest::protocol_ = NULL; TEST_F(FFmpegGlueTest, InitializeFFmpeg) { - // Singleton should initialize FFmpeg. - FFmpegGlue* glue = FFmpegGlue::get(); - EXPECT_TRUE(glue); - - // Assign our static copy of URLProtocol for the rest of the tests. - protocol_ = MockFFmpeg::protocol(); - // Make sure URLProtocol was filled out correctly. EXPECT_STREQ("http", protocol_->name); EXPECT_TRUE(protocol_->url_close); @@ -182,9 +185,7 @@ TEST_F(FFmpegGlueTest, OpenClose) { mock_ffmpeg_.CheckPoint(2); } -// This test is crashing on build bot. See bug: -// http://code.google.com/p/chromium/issues/detail?id=36037. -TEST_F(FFmpegGlueTest, DISABLED_Write) { +TEST_F(FFmpegGlueTest, Write) { scoped_ptr > protocol( new StrictMock()); URLContext context; @@ -202,9 +203,7 @@ TEST_F(FFmpegGlueTest, DISABLED_Write) { protocol_->url_close(&context); } -// This test is crashing on build bot. See bug: -// http://code.google.com/p/chromium/issues/detail?id=36037. -TEST_F(FFmpegGlueTest, DISABLED_Read) { +TEST_F(FFmpegGlueTest, Read) { scoped_ptr > protocol( new StrictMock()); URLContext context; @@ -230,9 +229,7 @@ TEST_F(FFmpegGlueTest, DISABLED_Read) { protocol_->url_close(&context); } -// This test is crashing on build bot. See bug: -// http://code.google.com/p/chromium/issues/detail?id=36037. -TEST_F(FFmpegGlueTest, DISABLED_Seek) { +TEST_F(FFmpegGlueTest, Seek) { scoped_ptr > protocol( new StrictMock()); URLContext context; @@ -308,9 +305,7 @@ TEST_F(FFmpegGlueTest, DISABLED_Seek) { protocol_->url_close(&context); } -// This test is crashing on build bot. See bug: -// http://code.google.com/p/chromium/issues/detail?id=36037. -TEST_F(FFmpegGlueTest, DISABLED_Destroy) { +TEST_F(FFmpegGlueTest, Destroy) { // Create our protocol and add them to the glue layer. scoped_ptr > > protocol( new StrictMock >()); -- cgit v1.1