OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 ASSERT_TRUE(source_.get() != NULL); | 215 ASSERT_TRUE(source_.get() != NULL); |
216 EXPECT_TRUE(NULL != source_->GetVideoCapturer()); | 216 EXPECT_TRUE(NULL != source_->GetVideoCapturer()); |
217 | 217 |
218 state_observer_.reset(new StateObserver(source_)); | 218 state_observer_.reset(new StateObserver(source_)); |
219 source_->RegisterObserver(state_observer_.get()); | 219 source_->RegisterObserver(state_observer_.get()); |
220 source_->AddSink(&renderer_); | 220 source_->AddSink(&renderer_); |
221 | 221 |
222 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 222 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
223 kMaxWaitMs); | 223 kMaxWaitMs); |
224 | 224 |
225 cricket::VideoRenderer* frameinput = source_->FrameInput(); | |
226 cricket::WebRtcVideoFrame test_frame; | |
227 frameinput->RenderFrame(&test_frame); | |
228 EXPECT_EQ(1, renderer_.num_rendered_frames()); | |
229 | |
230 source_->GetVideoCapturer()->Stop(); | 225 source_->GetVideoCapturer()->Stop(); |
231 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), | 226 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), |
232 kMaxWaitMs); | 227 kMaxWaitMs); |
233 } | 228 } |
234 | 229 |
235 // Test that a VideoSource transition to kEnded if the capture device | 230 // Test that a VideoSource transition to kEnded if the capture device |
236 // fails. | 231 // fails. |
237 TEST_F(VideoSourceTest, CameraFailed) { | 232 TEST_F(VideoSourceTest, CameraFailed) { |
238 CreateVideoSource(); | 233 CreateVideoSource(); |
239 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 234 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 FakeConstraints constraints; | 537 FakeConstraints constraints; |
543 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5); | 538 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5); |
544 | 539 |
545 CreateVideoSource(&constraints); | 540 CreateVideoSource(&constraints); |
546 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), | 541 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), |
547 kMaxWaitMs); | 542 kMaxWaitMs); |
548 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); | 543 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); |
549 ASSERT_TRUE(format != NULL); | 544 ASSERT_TRUE(format != NULL); |
550 EXPECT_EQ(30, format->framerate()); | 545 EXPECT_EQ(30, format->framerate()); |
551 } | 546 } |
OLD | NEW |