Index: webrtc/common_video/i420_video_frame_unittest.cc |
diff --git a/webrtc/common_video/i420_video_frame_unittest.cc b/webrtc/common_video/i420_video_frame_unittest.cc |
index eab8789f9a401a1b80503e6ce42f958acfde95d7..da3996b9bdfb0be287e6a1d0b03ab9eb8e9da5d8 100644 |
--- a/webrtc/common_video/i420_video_frame_unittest.cc |
+++ b/webrtc/common_video/i420_video_frame_unittest.cc |
@@ -16,27 +16,16 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
#include "webrtc/base/bind.h" |
#include "webrtc/base/scoped_ptr.h" |
+#include "webrtc/test/fake_texture_frame.h" |
namespace webrtc { |
-class NativeHandleImpl { |
- public: |
- NativeHandleImpl() : no_longer_needed_(false) {} |
- virtual ~NativeHandleImpl() {} |
- bool no_longer_needed() const { return no_longer_needed_; } |
- void SetNoLongerNeeded() { no_longer_needed_ = true; } |
- |
- private: |
- bool no_longer_needed_; |
-}; |
- |
bool EqualPlane(const uint8_t* data1, |
const uint8_t* data2, |
int stride, |
int width, |
int height); |
bool EqualFrames(const VideoFrame& frame1, const VideoFrame& frame2); |
-bool EqualTextureFrames(const VideoFrame& frame1, const VideoFrame& frame2); |
int ExpectedSize(int plane_stride, int image_height, PlaneType type); |
TEST(TestVideoFrame, InitialValues) { |
@@ -254,14 +243,14 @@ TEST(TestVideoFrame, FailToReuseAllocation) { |
} |
TEST(TestVideoFrame, TextureInitialValues) { |
- NativeHandleImpl handle; |
- VideoFrame frame(&handle, 640, 480, 100, 10, webrtc::kVideoRotation_0, |
- rtc::Callback0<void>()); |
+ test::FakeNativeHandle* handle = new test::FakeNativeHandle(); |
+ VideoFrame frame = test::CreateFakeNativeHandleFrame( |
+ handle, 640, 480, 100, 10, webrtc::kVideoRotation_0); |
EXPECT_EQ(640, frame.width()); |
EXPECT_EQ(480, frame.height()); |
EXPECT_EQ(100u, frame.timestamp()); |
EXPECT_EQ(10, frame.render_time_ms()); |
- EXPECT_EQ(&handle, frame.native_handle()); |
+ EXPECT_EQ(handle, frame.native_handle()); |
frame.set_timestamp(200); |
EXPECT_EQ(200u, frame.timestamp()); |
@@ -269,17 +258,6 @@ TEST(TestVideoFrame, TextureInitialValues) { |
EXPECT_EQ(20, frame.render_time_ms()); |
} |
-TEST(TestVideoFrame, NoLongerNeeded) { |
- NativeHandleImpl handle; |
- ASSERT_FALSE(handle.no_longer_needed()); |
- VideoFrame* frame = |
- new VideoFrame(&handle, 640, 480, 100, 200, webrtc::kVideoRotation_0, |
- rtc::Bind(&NativeHandleImpl::SetNoLongerNeeded, &handle)); |
- EXPECT_FALSE(handle.no_longer_needed()); |
- delete frame; |
- EXPECT_TRUE(handle.no_longer_needed()); |
-} |
- |
bool EqualPlane(const uint8_t* data1, |
const uint8_t* data2, |
int stride, |
@@ -315,14 +293,6 @@ bool EqualFrames(const VideoFrame& frame1, const VideoFrame& frame2) { |
frame1.stride(kVPlane), half_width, half_height); |
} |
-bool EqualTextureFrames(const VideoFrame& frame1, const VideoFrame& frame2) { |
- return ((frame1.native_handle() == frame2.native_handle()) && |
- (frame1.width() == frame2.width()) && |
- (frame1.height() == frame2.height()) && |
- (frame1.timestamp() == frame2.timestamp()) && |
- (frame1.render_time_ms() == frame2.render_time_ms())); |
-} |
- |
int ExpectedSize(int plane_stride, int image_height, PlaneType type) { |
if (type == kYPlane) { |
return (plane_stride * image_height); |