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 |