diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-02 01:03:48 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-02 01:03:48 +0000 |
commit | e27ab169509090c8e263a6c4334cc6a392a624a5 (patch) | |
tree | 2e9d4451c3df8fa8d61ea354bf158279c283e9ee /remoting | |
parent | 7e12507dab72e6797cb8a3a718df21b4f7c26630 (diff) | |
download | chromium_src-e27ab169509090c8e263a6c4334cc6a392a624a5.zip chromium_src-e27ab169509090c8e263a6c4334cc6a392a624a5.tar.gz chromium_src-e27ab169509090c8e263a6c4334cc6a392a624a5.tar.bz2 |
Stop ScreenRecorder before it started
Allow ScreenRecorder to be stopped anytime.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/6246034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73392 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-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 |