OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
| 5 #include "remoting/host/screen_recorder.h" |
| 6 |
| 7 #include "base/bind.h" |
5 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
6 #include "base/task.h" | 9 #include "base/task.h" |
7 #include "remoting/base/base_mock_objects.h" | 10 #include "remoting/base/base_mock_objects.h" |
8 #include "remoting/host/host_mock_objects.h" | 11 #include "remoting/host/host_mock_objects.h" |
9 #include "remoting/host/screen_recorder.h" | |
10 #include "remoting/proto/video.pb.h" | 12 #include "remoting/proto/video.pb.h" |
11 #include "remoting/protocol/protocol_mock_objects.h" | 13 #include "remoting/protocol/protocol_mock_objects.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
14 | 16 |
15 using ::remoting::protocol::MockConnectionToClient; | 17 using ::remoting::protocol::MockConnectionToClient; |
16 using ::remoting::protocol::MockConnectionToClientEventHandler; | 18 using ::remoting::protocol::MockConnectionToClientEventHandler; |
17 using ::remoting::protocol::MockHostStub; | 19 using ::remoting::protocol::MockHostStub; |
18 using ::remoting::protocol::MockVideoStub; | 20 using ::remoting::protocol::MockVideoStub; |
19 | 21 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // By default delete the arguments when ProcessVideoPacket is received. | 185 // By default delete the arguments when ProcessVideoPacket is received. |
184 EXPECT_CALL(video_stub, ProcessVideoPacket(_, _)) | 186 EXPECT_CALL(video_stub, ProcessVideoPacket(_, _)) |
185 .WillRepeatedly(FinishSend()); | 187 .WillRepeatedly(FinishSend()); |
186 | 188 |
187 // For the first time when ProcessVideoPacket is received we stop the | 189 // For the first time when ProcessVideoPacket is received we stop the |
188 // ScreenRecorder. | 190 // ScreenRecorder. |
189 EXPECT_CALL(video_stub, ProcessVideoPacket(_, _)) | 191 EXPECT_CALL(video_stub, ProcessVideoPacket(_, _)) |
190 .WillOnce(DoAll( | 192 .WillOnce(DoAll( |
191 FinishSend(), | 193 FinishSend(), |
192 StopScreenRecorder(record_, | 194 StopScreenRecorder(record_, |
193 NewRunnableFunction(&QuitMessageLoop, | 195 base::Bind(&QuitMessageLoop, &message_loop_)))) |
194 &message_loop_)))) | |
195 .RetiresOnSaturation(); | 196 .RetiresOnSaturation(); |
196 | 197 |
197 // Add the mock client connection to the session. | 198 // Add the mock client connection to the session. |
198 record_->AddConnection(connection_); | 199 record_->AddConnection(connection_); |
199 | 200 |
200 // Start the recording. | 201 // Start the recording. |
201 record_->Start(); | 202 record_->Start(); |
202 message_loop_.Run(); | 203 message_loop_.Run(); |
203 } | 204 } |
204 | 205 |
205 TEST_F(ScreenRecorderTest, StopWithoutStart) { | 206 TEST_F(ScreenRecorderTest, StopWithoutStart) { |
206 record_->Stop(NewRunnableFunction(&QuitMessageLoop, &message_loop_)); | 207 record_->Stop(base::Bind(&QuitMessageLoop, &message_loop_)); |
207 message_loop_.Run(); | 208 message_loop_.Run(); |
208 } | 209 } |
209 | 210 |
210 } // namespace remoting | 211 } // namespace remoting |
OLD | NEW |