From 997c7122e88f4420a822324f48b9ef731a130d87 Mon Sep 17 00:00:00 2001 From: "nsylvain@chromium.org" Date: Fri, 11 Feb 2011 23:55:08 +0000 Subject: Revert the "out-of-lining of test code" change within src/media to see if it fixes the gmock crashes we've been seeing since the change has been made. The original change was split between r74660, r74168, r74059 Review URL: http://codereview.chromium.org/6473006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74700 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/gpu/gpu_video_decoder_unittest.cc | 2 +- chrome/renderer/gpu_video_decoder_host_unittest.cc | 2 +- media/media.gyp | 2 - media/tools/omx_test/file_reader_util.cc | 4 -- media/tools/omx_test/file_reader_util.h | 3 -- media/tools/omx_test/file_sink.cc | 13 ------ media/tools/omx_test/file_sink.h | 14 ++++-- media/video/mock_objects.h | 54 ++++++++++++++++++++++ media/video/video_mock_objects.cc | 18 -------- media/video/video_mock_objects.h | 54 ---------------------- 10 files changed, 67 insertions(+), 99 deletions(-) create mode 100644 media/video/mock_objects.h delete mode 100644 media/video/video_mock_objects.cc delete mode 100644 media/video/video_mock_objects.h diff --git a/chrome/gpu/gpu_video_decoder_unittest.cc b/chrome/gpu/gpu_video_decoder_unittest.cc index 7767dcd..41e88d3 100644 --- a/chrome/gpu/gpu_video_decoder_unittest.cc +++ b/chrome/gpu/gpu_video_decoder_unittest.cc @@ -8,7 +8,7 @@ #include "chrome/gpu/gpu_video_decoder.h" #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" #include "ipc/ipc_message_utils.h" -#include "media/video/video_mock_objects.h" +#include "media/video/mock_objects.h" #include "testing/gtest/include/gtest/gtest.h" using testing::_; diff --git a/chrome/renderer/gpu_video_decoder_host_unittest.cc b/chrome/renderer/gpu_video_decoder_host_unittest.cc index e1956b5..52337e5 100644 --- a/chrome/renderer/gpu_video_decoder_host_unittest.cc +++ b/chrome/renderer/gpu_video_decoder_host_unittest.cc @@ -6,7 +6,7 @@ #include "chrome/common/gpu_messages.h" #include "chrome/common/message_router.h" #include "chrome/renderer/gpu_video_decoder_host.h" -#include "media/video/video_mock_objects.h" +#include "media/video/mock_objects.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/media/media.gyp b/media/media.gyp index 2e6e613..b2d8990 100644 --- a/media/media.gyp +++ b/media/media.gyp @@ -419,8 +419,6 @@ 'base/mock_filter_host.h', 'base/mock_filters.cc', 'base/mock_filters.h', - 'video/video_mock_objects.cc', - 'video/video_mock_objects.h', ], }, { diff --git a/media/tools/omx_test/file_reader_util.cc b/media/tools/omx_test/file_reader_util.cc index a599d2f..1ba7cea 100644 --- a/media/tools/omx_test/file_reader_util.cc +++ b/media/tools/omx_test/file_reader_util.cc @@ -46,8 +46,6 @@ YuvFileReader::YuvFileReader(const FilePath& path, output_nv21_(enable_csc) { } -YuvFileReader::~YuvFileReader() {} - void YuvFileReader::Read(uint8** output, int* size) { if (!file()) { *size = 0; @@ -232,8 +230,6 @@ H264FileReader::H264FileReader(const FilePath& path) used_(0) { } -H264FileReader::~H264FileReader() {} - void H264FileReader::Read(uint8** output, int *size) { // Fill the buffer when it's less than half full. int read = 0; diff --git a/media/tools/omx_test/file_reader_util.h b/media/tools/omx_test/file_reader_util.h index 01216e8..4bd028f 100644 --- a/media/tools/omx_test/file_reader_util.h +++ b/media/tools/omx_test/file_reader_util.h @@ -61,8 +61,6 @@ class YuvFileReader : public BasicFileReader { int height, int loop_count, bool output_nv21); - virtual ~YuvFileReader(); - virtual void Read(uint8** output, int* size); private: @@ -107,7 +105,6 @@ class FFmpegFileReader : public FileReader { class H264FileReader : public BasicFileReader { public: explicit H264FileReader(const FilePath& path); - virtual ~H264FileReader(); virtual void Read(uint8** output, int* size); private: diff --git a/media/tools/omx_test/file_sink.cc b/media/tools/omx_test/file_sink.cc index 5e92b02..98766ab 100644 --- a/media/tools/omx_test/file_sink.cc +++ b/media/tools/omx_test/file_sink.cc @@ -10,19 +10,6 @@ namespace media { -FileSink::FileSink(const FilePath& output_path, - bool simulate_copy, - bool enable_csc) - : output_path_(output_path), - simulate_copy_(simulate_copy), - enable_csc_(enable_csc), - width_(0), - height_(0), - copy_buf_size_(0), - csc_buf_size_(0) { -} - -FileSink::~FileSink() {} void FileSink::BufferReady(int size, uint8* buffer) { if (size > copy_buf_size_) { diff --git a/media/tools/omx_test/file_sink.h b/media/tools/omx_test/file_sink.h index 5703600..69907031 100644 --- a/media/tools/omx_test/file_sink.h +++ b/media/tools/omx_test/file_sink.h @@ -21,9 +21,17 @@ class FileSink { public: FileSink(const FilePath& output_path, bool simulate_copy, - bool enable_csc); - - virtual ~FileSink(); + bool enable_csc) + : output_path_(output_path), + simulate_copy_(simulate_copy), + enable_csc_(enable_csc), + width_(0), + height_(0), + copy_buf_size_(0), + csc_buf_size_(0) { + } + + virtual ~FileSink() {} virtual void BufferReady(int size, uint8* buffer); diff --git a/media/video/mock_objects.h b/media/video/mock_objects.h new file mode 100644 index 0000000..c0f3dd9 --- /dev/null +++ b/media/video/mock_objects.h @@ -0,0 +1,54 @@ +// Copyright (c) 2010 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. + +#ifndef MEDIA_VIDEO_MOCK_OBJECTS_H_ +#define MEDIA_VIDEO_MOCK_OBJECTS_H_ + +#include "media/video/video_decode_context.h" +#include "media/video/video_decode_engine.h" +#include "testing/gmock/include/gmock/gmock.h" + +namespace media { + +class MockVideoDecodeEngine : public VideoDecodeEngine { + public: + MockVideoDecodeEngine() {} + virtual ~MockVideoDecodeEngine() {} + + MOCK_METHOD4(Initialize, void(MessageLoop* message_loop, + EventHandler* event_handler, + VideoDecodeContext* context, + const VideoCodecConfig& config)); + MOCK_METHOD0(Uninitialize, void()); + MOCK_METHOD0(Flush, void()); + MOCK_METHOD0(Seek, void()); + MOCK_METHOD1(ConsumeVideoSample, void(scoped_refptr buffer)); + MOCK_METHOD1(ProduceVideoFrame, void(scoped_refptr frame)); + + private: + DISALLOW_COPY_AND_ASSIGN(MockVideoDecodeEngine); +}; + +class MockVideoDecodeContext : public VideoDecodeContext { + public: + MockVideoDecodeContext() {} + virtual ~MockVideoDecodeContext() {} + + MOCK_METHOD0(GetDevice, void*()); + MOCK_METHOD6(AllocateVideoFrames, void( + int n, size_t width, size_t height, VideoFrame::Format format, + std::vector >* frames, + Task* task)); + MOCK_METHOD0(ReleaseAllVideoFrames, void()); + MOCK_METHOD3(ConvertToVideoFrame, void( + void* buffer, scoped_refptr frame, Task* task)); + MOCK_METHOD1(Destroy, void(Task* task)); + + private: + DISALLOW_COPY_AND_ASSIGN(MockVideoDecodeContext); +}; + +} // namespace media + +#endif // MEDIA_VIDEO_MOCK_OBJECTS_H_ diff --git a/media/video/video_mock_objects.cc b/media/video/video_mock_objects.cc deleted file mode 100644 index 5873b59..0000000 --- a/media/video/video_mock_objects.cc +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2010 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. - -#include "media/video/video_mock_objects.h" - -namespace media { - -MockVideoDecodeEngine::MockVideoDecodeEngine() {} - -MockVideoDecodeEngine::~MockVideoDecodeEngine() {} - -MockVideoDecodeContext::MockVideoDecodeContext() {} - -MockVideoDecodeContext::~MockVideoDecodeContext() {} - - -} // namespace media diff --git a/media/video/video_mock_objects.h b/media/video/video_mock_objects.h deleted file mode 100644 index 1a9592c..0000000 --- a/media/video/video_mock_objects.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2010 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. - -#ifndef MEDIA_VIDEO_MOCK_OBJECTS_H_ -#define MEDIA_VIDEO_MOCK_OBJECTS_H_ - -#include "media/video/video_decode_context.h" -#include "media/video/video_decode_engine.h" -#include "testing/gmock/include/gmock/gmock.h" - -namespace media { - -class MockVideoDecodeEngine : public VideoDecodeEngine { - public: - MockVideoDecodeEngine(); - virtual ~MockVideoDecodeEngine(); - - MOCK_METHOD4(Initialize, void(MessageLoop* message_loop, - EventHandler* event_handler, - VideoDecodeContext* context, - const VideoCodecConfig& config)); - MOCK_METHOD0(Uninitialize, void()); - MOCK_METHOD0(Flush, void()); - MOCK_METHOD0(Seek, void()); - MOCK_METHOD1(ConsumeVideoSample, void(scoped_refptr buffer)); - MOCK_METHOD1(ProduceVideoFrame, void(scoped_refptr frame)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockVideoDecodeEngine); -}; - -class MockVideoDecodeContext : public VideoDecodeContext { - public: - MockVideoDecodeContext(); - virtual ~MockVideoDecodeContext(); - - MOCK_METHOD0(GetDevice, void*()); - MOCK_METHOD6(AllocateVideoFrames, void( - int n, size_t width, size_t height, VideoFrame::Format format, - std::vector >* frames, - Task* task)); - MOCK_METHOD0(ReleaseAllVideoFrames, void()); - MOCK_METHOD3(ConvertToVideoFrame, void( - void* buffer, scoped_refptr frame, Task* task)); - MOCK_METHOD1(Destroy, void(Task* task)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockVideoDecodeContext); -}; - -} // namespace media - -#endif // MEDIA_VIDEO_MOCK_OBJECTS_H_ -- cgit v1.1