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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 EXPECT_EQ(kTestDeviceId, capturer_->GetId()); | 68 EXPECT_EQ(kTestDeviceId, capturer_->GetId()); |
69 EXPECT_TRUE(NULL != capturer_->GetSupportedFormats()); | 69 EXPECT_TRUE(NULL != capturer_->GetSupportedFormats()); |
70 ASSERT_EQ(1U, capturer_->GetSupportedFormats()->size()); | 70 ASSERT_EQ(1U, capturer_->GetSupportedFormats()->size()); |
71 EXPECT_EQ(640, (*capturer_->GetSupportedFormats())[0].width); | 71 EXPECT_EQ(640, (*capturer_->GetSupportedFormats())[0].width); |
72 EXPECT_EQ(480, (*capturer_->GetSupportedFormats())[0].height); | 72 EXPECT_EQ(480, (*capturer_->GetSupportedFormats())[0].height); |
73 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL); // not started yet | 73 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL); // not started yet |
74 EXPECT_FALSE(capturer_->IsRunning()); | 74 EXPECT_FALSE(capturer_->IsRunning()); |
75 } | 75 } |
76 | 76 |
77 TEST_F(WebRtcVideoCapturerTest, TestInitVcm) { | 77 TEST_F(WebRtcVideoCapturerTest, TestInitVcm) { |
78 EXPECT_TRUE(capturer_->Init(factory_->Create(0, | 78 EXPECT_TRUE(capturer_->Init(factory_->Create( |
79 reinterpret_cast<const char*>(kTestDeviceId.c_str())))); | 79 reinterpret_cast<const char*>(kTestDeviceId.c_str())))); |
80 } | 80 } |
81 | 81 |
82 TEST_F(WebRtcVideoCapturerTest, TestCapture) { | 82 TEST_F(WebRtcVideoCapturerTest, TestCapture) { |
83 EXPECT_TRUE(capturer_->Init(cricket::Device(kTestDeviceName, kTestDeviceId))); | 83 EXPECT_TRUE(capturer_->Init(cricket::Device(kTestDeviceName, kTestDeviceId))); |
84 cricket::VideoCapturerListener listener(capturer_.get()); | 84 cricket::VideoCapturerListener listener(capturer_.get()); |
85 cricket::VideoFormat format( | 85 cricket::VideoFormat format( |
86 capturer_->GetSupportedFormats()->at(0)); | 86 capturer_->GetSupportedFormats()->at(0)); |
87 EXPECT_EQ(cricket::CS_STARTING, capturer_->Start(format)); | 87 EXPECT_EQ(cricket::CS_STARTING, capturer_->Start(format)); |
88 EXPECT_TRUE(capturer_->IsRunning()); | 88 EXPECT_TRUE(capturer_->IsRunning()); |
89 ASSERT_TRUE(capturer_->GetCaptureFormat() != NULL); | 89 ASSERT_TRUE(capturer_->GetCaptureFormat() != NULL); |
90 EXPECT_EQ(format, *capturer_->GetCaptureFormat()); | 90 EXPECT_EQ(format, *capturer_->GetCaptureFormat()); |
91 EXPECT_EQ_WAIT(cricket::CS_RUNNING, listener.last_capture_state(), 1000); | 91 EXPECT_EQ_WAIT(cricket::CS_RUNNING, listener.last_capture_state(), 1000); |
92 factory_->modules[0]->SendFrame(640, 480); | 92 factory_->modules[0]->SendFrame(640, 480); |
93 EXPECT_TRUE_WAIT(listener.frame_count() > 0, 5000); | 93 EXPECT_TRUE_WAIT(listener.frame_count() > 0, 5000); |
94 EXPECT_EQ(640, listener.frame_width()); | 94 EXPECT_EQ(640, listener.frame_width()); |
95 EXPECT_EQ(480, listener.frame_height()); | 95 EXPECT_EQ(480, listener.frame_height()); |
96 EXPECT_EQ(cricket::CS_FAILED, capturer_->Start(format)); | 96 EXPECT_EQ(cricket::CS_FAILED, capturer_->Start(format)); |
97 capturer_->Stop(); | 97 capturer_->Stop(); |
98 EXPECT_FALSE(capturer_->IsRunning()); | 98 EXPECT_FALSE(capturer_->IsRunning()); |
99 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL); | 99 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL); |
100 EXPECT_EQ_WAIT(cricket::CS_STOPPED, listener.last_capture_state(), 1000); | 100 EXPECT_EQ_WAIT(cricket::CS_STOPPED, listener.last_capture_state(), 1000); |
101 } | 101 } |
102 | 102 |
103 TEST_F(WebRtcVideoCapturerTest, TestCaptureVcm) { | 103 TEST_F(WebRtcVideoCapturerTest, TestCaptureVcm) { |
104 EXPECT_TRUE(capturer_->Init(factory_->Create(0, | 104 EXPECT_TRUE(capturer_->Init(factory_->Create( |
105 reinterpret_cast<const char*>(kTestDeviceId.c_str())))); | 105 reinterpret_cast<const char*>(kTestDeviceId.c_str())))); |
106 cricket::VideoCapturerListener listener(capturer_.get()); | 106 cricket::VideoCapturerListener listener(capturer_.get()); |
107 EXPECT_TRUE(capturer_->GetSupportedFormats()->empty()); | 107 EXPECT_TRUE(capturer_->GetSupportedFormats()->empty()); |
108 VideoFormat format; | 108 VideoFormat format; |
109 EXPECT_TRUE(capturer_->GetBestCaptureFormat(kDefaultVideoFormat, &format)); | 109 EXPECT_TRUE(capturer_->GetBestCaptureFormat(kDefaultVideoFormat, &format)); |
110 EXPECT_EQ(kDefaultVideoFormat.width, format.width); | 110 EXPECT_EQ(kDefaultVideoFormat.width, format.width); |
111 EXPECT_EQ(kDefaultVideoFormat.height, format.height); | 111 EXPECT_EQ(kDefaultVideoFormat.height, format.height); |
112 EXPECT_EQ(kDefaultVideoFormat.interval, format.interval); | 112 EXPECT_EQ(kDefaultVideoFormat.interval, format.interval); |
113 EXPECT_EQ(cricket::FOURCC_I420, format.fourcc); | 113 EXPECT_EQ(cricket::FOURCC_I420, format.fourcc); |
114 EXPECT_EQ(cricket::CS_STARTING, capturer_->Start(format)); | 114 EXPECT_EQ(cricket::CS_STARTING, capturer_->Start(format)); |
(...skipping 12 matching lines...) Expand all Loading... |
127 } | 127 } |
128 | 128 |
129 TEST_F(WebRtcVideoCapturerTest, TestCaptureWithoutInit) { | 129 TEST_F(WebRtcVideoCapturerTest, TestCaptureWithoutInit) { |
130 cricket::VideoFormat format; | 130 cricket::VideoFormat format; |
131 EXPECT_EQ(cricket::CS_FAILED, capturer_->Start(format)); | 131 EXPECT_EQ(cricket::CS_FAILED, capturer_->Start(format)); |
132 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL); | 132 EXPECT_TRUE(capturer_->GetCaptureFormat() == NULL); |
133 EXPECT_FALSE(capturer_->IsRunning()); | 133 EXPECT_FALSE(capturer_->IsRunning()); |
134 } | 134 } |
135 | 135 |
136 #endif // HAVE_WEBRTC_VIDEO | 136 #endif // HAVE_WEBRTC_VIDEO |
OLD | NEW |