OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" | 5 #include "remoting/host/screen_recorder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "remoting/base/base_mock_objects.h" | 9 #include "remoting/base/base_mock_objects.h" |
10 #include "remoting/host/host_mock_objects.h" | 10 #include "remoting/host/host_mock_objects.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 // Expect the encoder be called. | 137 // Expect the encoder be called. |
138 EXPECT_CALL(*encoder_, Encode(data, false, _)) | 138 EXPECT_CALL(*encoder_, Encode(data, false, _)) |
139 .WillRepeatedly(FinishEncode()); | 139 .WillRepeatedly(FinishEncode()); |
140 | 140 |
141 MockVideoStub video_stub; | 141 MockVideoStub video_stub; |
142 EXPECT_CALL(*connection_, video_stub()) | 142 EXPECT_CALL(*connection_, video_stub()) |
143 .WillRepeatedly(Return(&video_stub)); | 143 .WillRepeatedly(Return(&video_stub)); |
144 | 144 |
145 // By default delete the arguments when ProcessVideoPacket is received. | 145 // By default delete the arguments when ProcessVideoPacket is received. |
146 EXPECT_CALL(video_stub, ProcessVideoPacket(_, _)) | 146 EXPECT_CALL(video_stub, ProcessVideoPacketPtr(_, _)) |
147 .WillRepeatedly(FinishSend()); | 147 .WillRepeatedly(FinishSend()); |
148 | 148 |
149 // For the first time when ProcessVideoPacket is received we stop the | 149 // For the first time when ProcessVideoPacket is received we stop the |
150 // ScreenRecorder. | 150 // ScreenRecorder. |
151 EXPECT_CALL(video_stub, ProcessVideoPacket(_, _)) | 151 EXPECT_CALL(video_stub, ProcessVideoPacketPtr(_, _)) |
152 .WillOnce(DoAll( | 152 .WillOnce(DoAll( |
153 FinishSend(), | 153 FinishSend(), |
154 StopScreenRecorder(record_, | 154 StopScreenRecorder(record_, |
155 base::Bind(&QuitMessageLoop, &message_loop_)))) | 155 base::Bind(&QuitMessageLoop, &message_loop_)))) |
156 .RetiresOnSaturation(); | 156 .RetiresOnSaturation(); |
157 | 157 |
158 // Add the mock client connection to the session. | 158 // Add the mock client connection to the session. |
159 record_->AddConnection(connection_.get()); | 159 record_->AddConnection(connection_.get()); |
160 | 160 |
161 // Start the recording. | 161 // Start the recording. |
162 record_->Start(); | 162 record_->Start(); |
163 message_loop_.Run(); | 163 message_loop_.Run(); |
164 } | 164 } |
165 | 165 |
166 TEST_F(ScreenRecorderTest, StopWithoutStart) { | 166 TEST_F(ScreenRecorderTest, StopWithoutStart) { |
167 record_->Stop(base::Bind(&QuitMessageLoop, &message_loop_)); | 167 record_->Stop(base::Bind(&QuitMessageLoop, &message_loop_)); |
168 message_loop_.Run(); | 168 message_loop_.Run(); |
169 } | 169 } |
170 | 170 |
171 } // namespace remoting | 171 } // namespace remoting |
OLD | NEW |