Add propagation of test duration to PC framework user.

Add method to get real test execution time, where test execution time is
time from call setup to call terminated.

Bug: webrtc:10138
Change-Id: I7ae3995c0051ecb4fc796b895be1180c8aab77cf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/134302
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Bjorn Mellem <mellem@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27822}
This commit is contained in:
Artem Titov
2019-05-02 10:52:07 +02:00
committed by Commit Bot
parent e82266836b
commit b93c4e622f
4 changed files with 20 additions and 0 deletions

View File

@ -237,6 +237,13 @@ class PeerConnectionE2EQualityTestFixture {
rtc::NetworkManager* network_manager,
rtc::FunctionView<void(PeerConfigurer*)> configurer) = 0;
virtual void Run(RunParams run_params) = 0;
// Returns real test duration - the time of test execution measured during
// test. Client must call this method only after test is finished (after
// Run(...) method returned). Test execution time is time from end of call
// setup (offer/answer, ICE candidates exchange done and ICE connected) to
// start of call tear down (PeerConnection closed).
virtual TimeDelta GetRealTestDuration() const = 0;
};
} // namespace webrtc_pc_e2e

View File

@ -122,6 +122,7 @@ TEST(PeerConnectionE2EQualityTestSmokeTest, MAYBE_RunWithEmulatedNetwork) {
run_params.video_encoder_bitrate_multiplier = 1.1;
fixture->Run(run_params);
EXPECT_GE(fixture->GetRealTestDuration(), run_params.run_duration);
for (auto stream_label : video_analyzer_ptr->GetKnownVideoStreams()) {
FrameCounters stream_conters =
video_analyzer_ptr->GetPerStreamCounters().at(stream_label);

View File

@ -369,6 +369,11 @@ void PeerConnectionE2EQualityTest::Run(
RTC_FROM_HERE,
rtc::Bind(&PeerConnectionE2EQualityTest::TearDownCallOnSignalingThread,
this));
Timestamp end_time = Now();
{
rtc::CritScope crit(&lock_);
real_test_duration_ = end_time - start_time_;
}
audio_quality_analyzer_->Stop();
video_quality_analyzer_injection_helper_->Stop();

View File

@ -179,6 +179,12 @@ class PeerConnectionE2EQualityTest
rtc::FunctionView<void(PeerConfigurer*)> configurer) override;
void Run(RunParams run_params) override;
TimeDelta GetRealTestDuration() const override {
rtc::CritScope crit(&lock_);
RTC_CHECK_NE(real_test_duration_, TimeDelta::Zero());
return real_test_duration_;
}
private:
struct ScheduledActivity {
ScheduledActivity(TimeDelta initial_delay_since_start,
@ -253,6 +259,7 @@ class PeerConnectionE2EQualityTest
// Time when test call was started. Minus infinity means that call wasn't
// started yet.
Timestamp start_time_ RTC_GUARDED_BY(lock_) = Timestamp::MinusInfinity();
TimeDelta real_test_duration_ RTC_GUARDED_BY(lock_) = TimeDelta::Zero();
// Queue of activities that were added before test call was started.
// Activities from this queue will be posted on the |task_queue_| after test
// call will be set up and then this queue will be unused.