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

Unified Diff: content/browser/renderer_host/media/video_capture_manager_unittest.cc

Issue 2810723002: Refactor VideoCaptureManager::GetDeviceFormatsInUse() (Closed)
Patch Set: Addressed review comments Created 3 years, 8 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
« no previous file with comments | « content/browser/renderer_host/media/video_capture_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/video_capture_manager_unittest.cc
diff --git a/content/browser/renderer_host/media/video_capture_manager_unittest.cc b/content/browser/renderer_host/media/video_capture_manager_unittest.cc
index 86dccd33f733d9d454950b925f4b7d432b8861d7..8baf53a4a88d618fa3094329c4772d4dc758690d 100644
--- a/content/browser/renderer_host/media/video_capture_manager_unittest.cc
+++ b/content/browser/renderer_host/media/video_capture_manager_unittest.cc
@@ -608,34 +608,27 @@ TEST_F(VideoCaptureManagerTest,
base::RunLoop().RunUntilIdle();
// Right after opening the device, we should see no format in use.
- media::VideoCaptureFormats formats_in_use;
- EXPECT_TRUE(vcm_->GetDeviceFormatsInUse(MEDIA_DEVICE_VIDEO_CAPTURE, device_id,
- &formats_in_use));
- EXPECT_TRUE(formats_in_use.empty());
+ EXPECT_EQ(base::nullopt,
+ vcm_->GetDeviceFormatInUse(MEDIA_DEVICE_VIDEO_CAPTURE, device_id));
EXPECT_CALL(*frame_observer_, OnStarted(_));
VideoCaptureControllerID client_id = StartClient(video_session_id, true);
base::RunLoop().RunUntilIdle();
- // After StartClient(), |formats_in_use| should contain one valid format.
- EXPECT_TRUE(vcm_->GetDeviceFormatsInUse(MEDIA_DEVICE_VIDEO_CAPTURE, device_id,
- &formats_in_use));
- EXPECT_EQ(formats_in_use.size(), 1u);
- if (formats_in_use.size()) {
- media::VideoCaptureFormat& format_in_use = formats_in_use.front();
- EXPECT_TRUE(format_in_use.IsValid());
- EXPECT_GT(format_in_use.frame_size.width(), 1);
- EXPECT_GT(format_in_use.frame_size.height(), 1);
- EXPECT_GT(format_in_use.frame_rate, 1);
- }
- formats_in_use.clear();
+ // After StartClient(), device's format in use should be valid.
+ base::Optional<media::VideoCaptureFormat> format_in_use =
+ vcm_->GetDeviceFormatInUse(MEDIA_DEVICE_VIDEO_CAPTURE, device_id);
+ EXPECT_TRUE(format_in_use.has_value());
+ EXPECT_TRUE(format_in_use->IsValid());
+ EXPECT_GT(format_in_use->frame_size.width(), 1);
+ EXPECT_GT(format_in_use->frame_size.height(), 1);
+ EXPECT_GT(format_in_use->frame_rate, 1);
EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, _));
StopClient(client_id);
base::RunLoop().RunUntilIdle();
- // After StopClient(), the device's formats in use should be empty again.
- EXPECT_TRUE(vcm_->GetDeviceFormatsInUse(MEDIA_DEVICE_VIDEO_CAPTURE, device_id,
- &formats_in_use));
- EXPECT_TRUE(formats_in_use.empty());
+ // After StopClient(), the device's format in use should be empty again.
+ EXPECT_EQ(base::nullopt,
+ vcm_->GetDeviceFormatInUse(MEDIA_DEVICE_VIDEO_CAPTURE, device_id));
vcm_->Close(video_session_id);
base::RunLoop().RunUntilIdle();
« no previous file with comments | « content/browser/renderer_host/media/video_capture_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698