OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 EXPECT_TRUE(capture_manager_.StopVideoCapture(&video_capturer_, | 154 EXPECT_TRUE(capture_manager_.StopVideoCapture(&video_capturer_, |
155 format_qvga_)); | 155 format_qvga_)); |
156 EXPECT_EQ_WAIT(cricket::CS_STOPPED, capture_state(), kMsCallbackWait); | 156 EXPECT_EQ_WAIT(cricket::CS_STOPPED, capture_state(), kMsCallbackWait); |
157 EXPECT_EQ(2, callback_count()); | 157 EXPECT_EQ(2, callback_count()); |
158 // Last stop call should fail as it is one more than the number of start | 158 // Last stop call should fail as it is one more than the number of start |
159 // calls. | 159 // calls. |
160 EXPECT_FALSE(capture_manager_.StopVideoCapture(&video_capturer_, | 160 EXPECT_FALSE(capture_manager_.StopVideoCapture(&video_capturer_, |
161 format_vga_)); | 161 format_vga_)); |
162 } | 162 } |
| 163 |
| 164 TEST_F(CaptureManagerTest, TestForceRestart) { |
| 165 EXPECT_TRUE(capture_manager_.StartVideoCapture(&video_capturer_, |
| 166 format_qvga_)); |
| 167 capture_manager_.AddVideoSink(&video_capturer_, &video_renderer_); |
| 168 EXPECT_EQ_WAIT(1, callback_count(), kMsCallbackWait); |
| 169 EXPECT_TRUE(video_capturer_.CaptureFrame()); |
| 170 EXPECT_EQ(1, NumFramesRendered()); |
| 171 EXPECT_TRUE(WasRenderedResolution(format_qvga_)); |
| 172 // Now restart with vga. |
| 173 EXPECT_TRUE(capture_manager_.RestartVideoCapture( |
| 174 &video_capturer_, format_qvga_, format_vga_, |
| 175 cricket::CaptureManager::kForceRestart)); |
| 176 EXPECT_TRUE(video_capturer_.CaptureFrame()); |
| 177 EXPECT_EQ(2, NumFramesRendered()); |
| 178 EXPECT_TRUE(WasRenderedResolution(format_vga_)); |
| 179 EXPECT_TRUE(capture_manager_.StopVideoCapture(&video_capturer_, |
| 180 format_vga_)); |
| 181 } |
| 182 |
| 183 TEST_F(CaptureManagerTest, TestRequestRestart) { |
| 184 EXPECT_TRUE(capture_manager_.StartVideoCapture(&video_capturer_, |
| 185 format_vga_)); |
| 186 capture_manager_.AddVideoSink(&video_capturer_, &video_renderer_); |
| 187 EXPECT_EQ_WAIT(1, callback_count(), kMsCallbackWait); |
| 188 EXPECT_TRUE(video_capturer_.CaptureFrame()); |
| 189 EXPECT_EQ(1, NumFramesRendered()); |
| 190 EXPECT_TRUE(WasRenderedResolution(format_vga_)); |
| 191 // Now request restart with qvga. |
| 192 EXPECT_TRUE(capture_manager_.RestartVideoCapture( |
| 193 &video_capturer_, format_vga_, format_qvga_, |
| 194 cricket::CaptureManager::kRequestRestart)); |
| 195 EXPECT_TRUE(video_capturer_.CaptureFrame()); |
| 196 EXPECT_EQ(2, NumFramesRendered()); |
| 197 EXPECT_TRUE(WasRenderedResolution(format_vga_)); |
| 198 EXPECT_TRUE(capture_manager_.StopVideoCapture(&video_capturer_, |
| 199 format_qvga_)); |
| 200 } |
OLD | NEW |