diff options
-rw-r--r-- | remoting/host/screen_recorder.cc | 4 | ||||
-rw-r--r-- | remoting/host/screen_recorder_unittest.cc | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/remoting/host/screen_recorder.cc b/remoting/host/screen_recorder.cc index 4a32705..be4fbeb 100644 --- a/remoting/host/screen_recorder.cc +++ b/remoting/host/screen_recorder.cc @@ -132,8 +132,10 @@ void ScreenRecorder::DoStart() { void ScreenRecorder::DoStop(Task* done_task) { DCHECK_EQ(capture_loop_, MessageLoop::current()); + // We might have not started when we receive a stop command, simply run the + // task and then return. if (!is_recording_) { - NOTREACHED() << "Record session not started."; + DoCompleteStop(done_task); return; } diff --git a/remoting/host/screen_recorder_unittest.cc b/remoting/host/screen_recorder_unittest.cc index 85ba54a..6f61051 100644 --- a/remoting/host/screen_recorder_unittest.cc +++ b/remoting/host/screen_recorder_unittest.cc @@ -194,7 +194,9 @@ TEST_F(ScreenRecorderTest, StartAndStop) { message_loop_.Run(); } -// TODO(hclam): Add test for double buffering. -// TODO(hclam): Add test for multiple captures. +TEST_F(ScreenRecorderTest, StopWithoutStart) { + record_->Stop(NewRunnableFunction(&QuitMessageLoop, &message_loop_)); + message_loop_.Run(); +} } // namespace remoting |