| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 TEST_F(WebRtcVideoCapturerTest, TestCapture) { | 84 TEST_F(WebRtcVideoCapturerTest, TestCapture) { |
| 85 EXPECT_TRUE(capturer_->Init(cricket::Device(kTestDeviceName, kTestDeviceId))); | 85 EXPECT_TRUE(capturer_->Init(cricket::Device(kTestDeviceName, kTestDeviceId))); |
| 86 cricket::VideoFormat format( | 86 cricket::VideoFormat format( |
| 87 capturer_->GetSupportedFormats()->at(0)); | 87 capturer_->GetSupportedFormats()->at(0)); |
| 88 EXPECT_EQ(cricket::CS_STARTING, capturer_->Start(format)); | 88 EXPECT_EQ(cricket::CS_STARTING, capturer_->Start(format)); |
| 89 EXPECT_TRUE(capturer_->IsRunning()); | 89 EXPECT_TRUE(capturer_->IsRunning()); |
| 90 ASSERT_TRUE(capturer_->GetCaptureFormat() != NULL); | 90 ASSERT_TRUE(capturer_->GetCaptureFormat() != NULL); |
| 91 EXPECT_EQ(format, *capturer_->GetCaptureFormat()); | 91 EXPECT_EQ(format, *capturer_->GetCaptureFormat()); |
| 92 EXPECT_EQ_WAIT(cricket::CS_RUNNING, listener_.last_capture_state(), 1000); | 92 EXPECT_EQ_WAIT(cricket::CS_RUNNING, listener_.last_capture_state(), 1000); |
| 93 EXPECT_TRUE(factory_->modules[0]->SendFrame(640, 480)); | 93 factory_->modules[0]->SendFrame(640, 480); |
| 94 EXPECT_TRUE_WAIT(listener_.frame_count() > 0, 5000); | 94 EXPECT_TRUE_WAIT(listener_.frame_count() > 0, 5000); |
| 95 EXPECT_EQ(capturer_->GetCaptureFormat()->fourcc, listener_.frame_fourcc()); | 95 EXPECT_EQ(capturer_->GetCaptureFormat()->fourcc, listener_.frame_fourcc()); |
| 96 EXPECT_EQ(640, listener_.frame_width()); | 96 EXPECT_EQ(640, listener_.frame_width()); |
| 97 EXPECT_EQ(480, listener_.frame_height()); | 97 EXPECT_EQ(480, listener_.frame_height()); |
| 98 EXPECT_EQ(cricket::CS_FAILED, capturer_->Start(format)); | 98 EXPECT_EQ(cricket::CS_FAILED, capturer_->Start(format)); |
| 99 capturer_->Stop(); | 99 capturer_->Stop(); |
| 100 EXPECT_FALSE(capturer_->IsRunning()); | 100 EXPECT_FALSE(capturer_->IsRunning()); |
| 101 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL); | 101 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL); |
| 102 EXPECT_EQ_WAIT(cricket::CS_STOPPED, listener_.last_capture_state(), 1000); | 102 EXPECT_EQ_WAIT(cricket::CS_STOPPED, listener_.last_capture_state(), 1000); |
| 103 } | 103 } |
| 104 | 104 |
| 105 TEST_F(WebRtcVideoCapturerTest, TestCaptureVcm) { | 105 TEST_F(WebRtcVideoCapturerTest, TestCaptureVcm) { |
| 106 EXPECT_TRUE(capturer_->Init(factory_->Create(0, | 106 EXPECT_TRUE(capturer_->Init(factory_->Create(0, |
| 107 reinterpret_cast<const char*>(kTestDeviceId.c_str())))); | 107 reinterpret_cast<const char*>(kTestDeviceId.c_str())))); |
| 108 EXPECT_TRUE(capturer_->GetSupportedFormats()->empty()); | 108 EXPECT_TRUE(capturer_->GetSupportedFormats()->empty()); |
| 109 VideoFormat format; | 109 VideoFormat format; |
| 110 EXPECT_TRUE(capturer_->GetBestCaptureFormat(kDefaultVideoFormat, &format)); | 110 EXPECT_TRUE(capturer_->GetBestCaptureFormat(kDefaultVideoFormat, &format)); |
| 111 EXPECT_EQ(kDefaultVideoFormat.width, format.width); | 111 EXPECT_EQ(kDefaultVideoFormat.width, format.width); |
| 112 EXPECT_EQ(kDefaultVideoFormat.height, format.height); | 112 EXPECT_EQ(kDefaultVideoFormat.height, format.height); |
| 113 EXPECT_EQ(kDefaultVideoFormat.interval, format.interval); | 113 EXPECT_EQ(kDefaultVideoFormat.interval, format.interval); |
| 114 EXPECT_EQ(cricket::FOURCC_I420, format.fourcc); | 114 EXPECT_EQ(cricket::FOURCC_I420, format.fourcc); |
| 115 EXPECT_EQ(cricket::CS_STARTING, capturer_->Start(format)); | 115 EXPECT_EQ(cricket::CS_STARTING, capturer_->Start(format)); |
| 116 EXPECT_TRUE(capturer_->IsRunning()); | 116 EXPECT_TRUE(capturer_->IsRunning()); |
| 117 ASSERT_TRUE(capturer_->GetCaptureFormat() != NULL); | 117 ASSERT_TRUE(capturer_->GetCaptureFormat() != NULL); |
| 118 EXPECT_EQ(format, *capturer_->GetCaptureFormat()); | 118 EXPECT_EQ(format, *capturer_->GetCaptureFormat()); |
| 119 EXPECT_EQ_WAIT(cricket::CS_RUNNING, listener_.last_capture_state(), 1000); | 119 EXPECT_EQ_WAIT(cricket::CS_RUNNING, listener_.last_capture_state(), 1000); |
| 120 EXPECT_TRUE(factory_->modules[0]->SendFrame(640, 480)); | 120 factory_->modules[0]->SendFrame(640, 480); |
| 121 EXPECT_TRUE_WAIT(listener_.frame_count() > 0, 5000); | 121 EXPECT_TRUE_WAIT(listener_.frame_count() > 0, 5000); |
| 122 EXPECT_EQ(capturer_->GetCaptureFormat()->fourcc, listener_.frame_fourcc()); | 122 EXPECT_EQ(capturer_->GetCaptureFormat()->fourcc, listener_.frame_fourcc()); |
| 123 EXPECT_EQ(640, listener_.frame_width()); | 123 EXPECT_EQ(640, listener_.frame_width()); |
| 124 EXPECT_EQ(480, listener_.frame_height()); | 124 EXPECT_EQ(480, listener_.frame_height()); |
| 125 EXPECT_EQ(cricket::CS_FAILED, capturer_->Start(format)); | 125 EXPECT_EQ(cricket::CS_FAILED, capturer_->Start(format)); |
| 126 capturer_->Stop(); | 126 capturer_->Stop(); |
| 127 EXPECT_FALSE(capturer_->IsRunning()); | 127 EXPECT_FALSE(capturer_->IsRunning()); |
| 128 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL); | 128 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL); |
| 129 } | 129 } |
| 130 | 130 |
| 131 TEST_F(WebRtcVideoCapturerTest, TestCaptureWithoutInit) { | 131 TEST_F(WebRtcVideoCapturerTest, TestCaptureWithoutInit) { |
| 132 cricket::VideoFormat format; | 132 cricket::VideoFormat format; |
| 133 EXPECT_EQ(cricket::CS_FAILED, capturer_->Start(format)); | 133 EXPECT_EQ(cricket::CS_FAILED, capturer_->Start(format)); |
| 134 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL); | 134 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL); |
| 135 EXPECT_FALSE(capturer_->IsRunning()); | 135 EXPECT_FALSE(capturer_->IsRunning()); |
| 136 } | 136 } |
| 137 | 137 |
| 138 #endif // HAVE_WEBRTC_VIDEO | 138 #endif // HAVE_WEBRTC_VIDEO |
| OLD | NEW |