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

Unified Diff: content/browser/renderer_host/media/video_capture_controller_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: LOG in video_Frame and CHECK/return outside. Created 5 years 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: content/browser/renderer_host/media/video_capture_controller_unittest.cc
diff --git a/content/browser/renderer_host/media/video_capture_controller_unittest.cc b/content/browser/renderer_host/media/video_capture_controller_unittest.cc
index 9af6feeae0daabc0040d1c05f58631584a063ac5..c921fb7aa70068e6697f9c415fee5342ebd40e26 100644
--- a/content/browser/renderer_host/media/video_capture_controller_unittest.cc
+++ b/content/browser/renderer_host/media/video_capture_controller_unittest.cc
@@ -117,11 +117,14 @@ class VideoCaptureControllerTest : public testing::Test {
scoped_refptr<media::VideoFrame> WrapI420Buffer(gfx::Size dimensions,
uint8* data) {
- return media::VideoFrame::WrapExternalSharedMemory(
- media::PIXEL_FORMAT_I420, dimensions, gfx::Rect(dimensions), dimensions,
- data,
- media::VideoFrame::AllocationSize(media::PIXEL_FORMAT_I420, dimensions),
- base::SharedMemory::NULLHandle(), 0u, base::TimeDelta());
+ scoped_refptr<media::VideoFrame> video_frame =
+ media::VideoFrame::WrapExternalSharedMemory(
+ media::PIXEL_FORMAT_I420, dimensions, gfx::Rect(dimensions),
+ dimensions, data, media::VideoFrame::AllocationSize(
+ media::PIXEL_FORMAT_I420, dimensions),
+ base::SharedMemory::NULLHandle(), 0u, base::TimeDelta());
+ CHECK(video_frame);
+ return video_frame;
}
TestBrowserThreadBundle bundle_;
@@ -312,6 +315,7 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
}
scoped_refptr<media::VideoFrame> video_frame =
WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer->data()));
+ CHECK(video_frame);
ASSERT_FALSE(video_frame->metadata()->HasKey(
media::VideoFrameMetadata::RESOURCE_UTILIZATION));
client_a_->resource_utilization_ = 0.5;
@@ -341,6 +345,7 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
memset(buffer2->data(), buffer_no++, buffer2->mapped_size());
video_frame =
WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer2->data()));
+ CHECK(video_frame);
ASSERT_FALSE(video_frame->metadata()->HasKey(
media::VideoFrameMetadata::RESOURCE_UTILIZATION));
client_a_->resource_utilization_ = 0.5;
@@ -387,6 +392,7 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
memset(buffer->data(), buffer_no++, buffer->mapped_size());
video_frame =
WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer->data()));
+ CHECK(video_frame);
device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame,
base::TimeTicks());
}
@@ -435,6 +441,7 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
memset(buffer3->data(), buffer_no++, buffer3->mapped_size());
video_frame =
WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer3->data()));
+ CHECK(video_frame);
device_->OnIncomingCapturedVideoFrame(buffer3.Pass(), video_frame,
base::TimeTicks());
@@ -452,6 +459,7 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
memset(buffer4->data(), buffer_no++, buffer4->mapped_size());
video_frame =
WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer4->data()));
+ CHECK(video_frame);
device_->OnIncomingCapturedVideoFrame(buffer4.Pass(), video_frame,
base::TimeTicks());
// B2 is the only client left, and is the only one that should
@@ -500,6 +508,7 @@ TEST_F(VideoCaptureControllerTest, ErrorBeforeDeviceCreation) {
ASSERT_TRUE(buffer.get());
scoped_refptr<media::VideoFrame> video_frame =
WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer->data()));
+ CHECK(video_frame);
device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame,
base::TimeTicks());
@@ -537,6 +546,7 @@ TEST_F(VideoCaptureControllerTest, ErrorAfterDeviceCreation) {
scoped_refptr<media::VideoFrame> video_frame =
WrapI420Buffer(dims, static_cast<uint8*>(buffer->data()));
+ CHECK(video_frame);
device_->OnError(FROM_HERE, "Test Error");
device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame,
base::TimeTicks());

Powered by Google App Engine
This is Rietveld 408576698