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

Unified Diff: cc/resources/video_resource_updater_unittest.cc

Issue 1476523005: Verify returned frames from media::VideoFrame::Wrap*() methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: posciak@ comments. Created 4 years, 11 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: cc/resources/video_resource_updater_unittest.cc
diff --git a/cc/resources/video_resource_updater_unittest.cc b/cc/resources/video_resource_updater_unittest.cc
index 064829e0a57b2981b7aac5d2211c309b80cbc183..6ea3a9cd966c2790cb46ba669c4f2294ad989d89 100644
--- a/cc/resources/video_resource_updater_unittest.cc
+++ b/cc/resources/video_resource_updater_unittest.cc
@@ -87,18 +87,21 @@ class VideoResourceUpdaterTest : public testing::Test {
static uint8_t u_data[kDimension * kDimension / 2] = {0};
static uint8_t v_data[kDimension * kDimension / 2] = {0};
- return media::VideoFrame::WrapExternalYuvData(
- media::PIXEL_FORMAT_YV16, // format
- size, // coded_size
- gfx::Rect(size), // visible_rect
- size, // natural_size
- size.width(), // y_stride
- size.width() / 2, // u_stride
- size.width() / 2, // v_stride
- y_data, // y_data
- u_data, // u_data
- v_data, // v_data
- base::TimeDelta()); // timestamp
+ scoped_refptr<media::VideoFrame> video_frame =
+ media::VideoFrame::WrapExternalYuvData(
+ media::PIXEL_FORMAT_YV16, // format
+ size, // coded_size
+ gfx::Rect(size), // visible_rect
+ size, // natural_size
+ size.width(), // y_stride
+ size.width() / 2, // u_stride
+ size.width() / 2, // v_stride
+ y_data, // y_data
+ u_data, // u_data
+ v_data, // v_data
+ base::TimeDelta()); // timestamp
+ EXPECT_NE(nullptr, video_frame.get());
DaleCurtis 2016/01/14 23:27:04 EXPECT_TRUE like you've used in most other places.
emircan 2016/01/15 00:28:28 Done.
+ return video_frame;
}
static void ReleaseMailboxCB(const gpu::SyncToken& sync_token) {}
@@ -112,14 +115,17 @@ class VideoResourceUpdaterTest : public testing::Test {
const gpu::SyncToken sync_token(7);
const unsigned target = GL_TEXTURE_2D;
- return media::VideoFrame::WrapNativeTexture(
- media::PIXEL_FORMAT_ARGB,
- gpu::MailboxHolder(mailbox, sync_token, target),
- base::Bind(&ReleaseMailboxCB),
- size, // coded_size
- gfx::Rect(size), // visible_rect
- size, // natural_size
- base::TimeDelta()); // timestamp
+ scoped_refptr<media::VideoFrame> video_frame =
+ media::VideoFrame::WrapNativeTexture(
+ media::PIXEL_FORMAT_ARGB,
+ gpu::MailboxHolder(mailbox, sync_token, target),
+ base::Bind(&ReleaseMailboxCB),
+ size, // coded_size
+ gfx::Rect(size), // visible_rect
+ size, // natural_size
+ base::TimeDelta()); // timestamp
+ EXPECT_NE(nullptr, video_frame.get());
DaleCurtis 2016/01/14 23:27:04 EXPECT_TRUE, remove get.
emircan 2016/01/15 00:28:27 Done.
+ return video_frame;
}
scoped_refptr<media::VideoFrame> CreateTestYUVHardareVideoFrame() {
@@ -133,18 +139,21 @@ class VideoResourceUpdaterTest : public testing::Test {
}
const gpu::SyncToken sync_token(7);
const unsigned target = GL_TEXTURE_RECTANGLE_ARB;
- return media::VideoFrame::WrapYUV420NativeTextures(
- gpu::MailboxHolder(mailbox[media::VideoFrame::kYPlane], sync_token,
- target),
- gpu::MailboxHolder(mailbox[media::VideoFrame::kUPlane], sync_token,
- target),
- gpu::MailboxHolder(mailbox[media::VideoFrame::kVPlane], sync_token,
- target),
- base::Bind(&ReleaseMailboxCB),
- size, // coded_size
- gfx::Rect(size), // visible_rect
- size, // natural_size
- base::TimeDelta()); // timestamp
+ scoped_refptr<media::VideoFrame> video_frame =
+ media::VideoFrame::WrapYUV420NativeTextures(
+ gpu::MailboxHolder(mailbox[media::VideoFrame::kYPlane], sync_token,
+ target),
+ gpu::MailboxHolder(mailbox[media::VideoFrame::kUPlane], sync_token,
+ target),
+ gpu::MailboxHolder(mailbox[media::VideoFrame::kVPlane], sync_token,
+ target),
+ base::Bind(&ReleaseMailboxCB),
+ size, // coded_size
+ gfx::Rect(size), // visible_rect
+ size, // natural_size
+ base::TimeDelta()); // timestamp
+ EXPECT_NE(nullptr, video_frame.get());
DaleCurtis 2016/01/14 23:27:04 EXPECT_TRUE, remove get.
emircan 2016/01/15 00:28:28 Done.
+ return video_frame;
}
WebGraphicsContext3DUploadCounter* context3d_;

Powered by Google App Engine
This is Rietveld 408576698