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

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

Issue 2390103002: Reland: VideoCapture: migrate VideoCapture renderer-->host messages to mojo, part 1 (Closed)
Patch Set: rockot@ comments (plenty of renaming) Created 4 years, 2 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_host.cc ('k') | content/common/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/video_capture_host_unittest.cc
diff --git a/content/browser/renderer_host/media/video_capture_host_unittest.cc b/content/browser/renderer_host/media/video_capture_host_unittest.cc
index 2b98a1175e9519f14ba285c24b0a469a49f681ec..2e163232df20092927cdfd1b673956652a9cd469 100644
--- a/content/browser/renderer_host/media/video_capture_host_unittest.cc
+++ b/content/browser/renderer_host/media/video_capture_host_unittest.cc
@@ -67,8 +67,8 @@ static const int kDeviceId = 555;
// Define to use a real video capture device.
// #define TEST_REAL_CAPTURE_DEVICE
-// Simple class used for dumping video to a file. This can be used for
-// verifying the output.
+// Simple class used for dumping video to a file. This can be used for verifying
+// the output.
class DumpVideo {
public:
DumpVideo() {}
@@ -291,7 +291,7 @@ class VideoCaptureHostTest : public testing::Test {
// Verifies and removes the expectations on host_ and
// returns true iff successful.
Mock::VerifyAndClearExpectations(host_.get());
- EXPECT_EQ(0u, host_->entries_.size());
+ EXPECT_TRUE(host_->controllers_.empty());
CloseSession();
@@ -402,7 +402,24 @@ class VideoCaptureHostTest : public testing::Test {
params.requested_format = media::VideoCaptureFormat(
gfx::Size(352, 288), 30, media::PIXEL_FORMAT_I420);
host_->OnStartCapture(kDeviceId, opened_session_id_, params);
- host_->OnStopCapture(kDeviceId);
+ host_->Stop(kDeviceId);
+ run_loop.RunUntilIdle();
+ WaitForVideoDeviceThread();
+ }
+
+ void PauseResumeCapture() {
+ InSequence s;
+ base::RunLoop run_loop;
+ EXPECT_CALL(*host_.get(),
+ OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_PAUSED));
+ host_->Pause(kDeviceId);
+
+ EXPECT_CALL(*host_.get(),
+ OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_RESUMED));
+ media::VideoCaptureParams params;
+ params.requested_format = media::VideoCaptureFormat(
+ gfx::Size(352, 288), 30, media::PIXEL_FORMAT_I420);
+ host_->OnResumeCapture(kDeviceId, opened_session_id_, params);
run_loop.RunUntilIdle();
WaitForVideoDeviceThread();
}
@@ -433,7 +450,7 @@ class VideoCaptureHostTest : public testing::Test {
OnStateChanged(kDeviceId, VIDEO_CAPTURE_STATE_STOPPED))
.WillOnce(ExitMessageLoop(task_runner_, run_loop.QuitClosure()));
- host_->OnStopCapture(kDeviceId);
+ host_->Stop(kDeviceId);
host_->SetReturnReceivedDibs(true);
host_->ReturnReceivedDibs(kDeviceId);
@@ -441,7 +458,7 @@ class VideoCaptureHostTest : public testing::Test {
host_->SetReturnReceivedDibs(false);
// Expect the VideoCaptureDevice has been stopped
- EXPECT_EQ(0u, host_->entries_.size());
+ EXPECT_TRUE(host_->controllers_.empty());
}
void NotifyPacketReady() {
@@ -480,16 +497,16 @@ class VideoCaptureHostTest : public testing::Test {
scoped_refptr<MockVideoCaptureHost> host_;
private:
- // media_stream_manager_ needs to outlive thread_bundle_ because it is a
- // MessageLoop::DestructionObserver. audio_manager_ needs to outlive
- // thread_bundle_ because it uses the underlying message loop.
+ // |media_stream_manager_| needs to outlive |thread_bundle_| because it is a
+ // MessageLoop::DestructionObserver. |audio_manager_| needs to outlive
+ // |thread_bundle_| because it uses the underlying message loop.
StrictMock<MockMediaStreamRequester> stream_requester_;
std::unique_ptr<MediaStreamManager> media_stream_manager_;
- content::TestBrowserThreadBundle thread_bundle_;
+ const content::TestBrowserThreadBundle thread_bundle_;
media::ScopedAudioManagerPtr audio_manager_;
content::TestBrowserContext browser_context_;
content::TestContentBrowserClient browser_client_;
- scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
int opened_session_id_;
std::string opened_device_label_;
@@ -543,4 +560,10 @@ TEST_F(VideoCaptureHostTest, CaptureAndDump720P) {
}
#endif
+TEST_F(VideoCaptureHostTest, PauseResumeCapture) {
+ StartCapture();
+ PauseResumeCapture();
+ StopCapture();
+}
+
} // namespace content
« no previous file with comments | « content/browser/renderer_host/media/video_capture_host.cc ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698