Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Unified Diff: webrtc/video/overuse_frame_detector_unittest.cc

Issue 2304363002: Let ViEEncoder express resolution requests as Sinkwants (Closed)
Patch Set: Fix broken test RunOnTqNormalUsage. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/video/overuse_frame_detector_unittest.cc
diff --git a/webrtc/video/overuse_frame_detector_unittest.cc b/webrtc/video/overuse_frame_detector_unittest.cc
index f00b32df6e147dccabe145f90090964ef18d7e7b..9e8b70facdae7adeaa60606c86b3935dff5189b3 100644
--- a/webrtc/video/overuse_frame_detector_unittest.cc
+++ b/webrtc/video/overuse_frame_detector_unittest.cc
@@ -57,12 +57,10 @@ class OveruseFrameDetectorUnderTest : public OveruseFrameDetector {
OveruseFrameDetectorUnderTest(Clock* clock,
const CpuOveruseOptions& options,
CpuOveruseObserver* overuse_observer,
- EncodedFrameObserver* encoder_timing,
CpuOveruseMetricsObserver* metrics_observer)
: OveruseFrameDetector(clock,
options,
overuse_observer,
- encoder_timing,
metrics_observer) {}
~OveruseFrameDetectorUnderTest() {}
@@ -81,7 +79,7 @@ class OveruseFrameDetectorTest : public ::testing::Test,
void ReinitializeOveruseDetector() {
overuse_detector_.reset(new OveruseFrameDetectorUnderTest(
- clock_.get(), options_, observer_.get(), nullptr, this));
+ clock_.get(), options_, observer_.get(), this));
}
void OnEncodedFrameTimeMeasured(int encode_time_ms,
@@ -166,8 +164,8 @@ TEST_F(OveruseFrameDetectorTest, OveruseAndRecover) {
}
TEST_F(OveruseFrameDetectorTest, OveruseAndRecoverWithNoObserver) {
- overuse_detector_.reset(new OveruseFrameDetectorUnderTest(
- clock_.get(), options_, nullptr, nullptr, this));
+ overuse_detector_.reset(
+ new OveruseFrameDetectorUnderTest(clock_.get(), options_, nullptr, this));
EXPECT_CALL(*(observer_.get()), OveruseDetected()).Times(0);
TriggerOveruse(options_.high_threshold_consecutive_count);
EXPECT_CALL(*(observer_.get()), NormalUsage()).Times(0);
@@ -186,7 +184,7 @@ TEST_F(OveruseFrameDetectorTest, TriggerUnderuseWithMinProcessCount) {
options_.min_process_count = 1;
CpuOveruseObserverImpl overuse_observer;
overuse_detector_.reset(new OveruseFrameDetectorUnderTest(
- clock_.get(), options_, &overuse_observer, nullptr, this));
+ clock_.get(), options_, &overuse_observer, this));
InsertAndSendFramesWithInterval(
1200, kFrameInterval33ms, kWidth, kHeight, kProcessTime5ms);
overuse_detector_->CheckForOveruse();
@@ -330,11 +328,9 @@ TEST_F(OveruseFrameDetectorTest, RunOnTqNormalUsage) {
});
event.Wait(rtc::Event::kForever);
- // Expect NormalUsage(). When called, stop the |overuse_detector_| and then
- // set |event| to end the test.
+ // Expect NormalUsage().
EXPECT_CALL(*(observer_.get()), NormalUsage())
.WillOnce(Invoke([this, &event] {
- overuse_detector_->StopCheckForOveruse();
event.Set();
}));
@@ -347,6 +343,14 @@ TEST_F(OveruseFrameDetectorTest, RunOnTqNormalUsage) {
kDelayMs2);
});
+ // Wait for NormalUsage().
+ EXPECT_TRUE(event.Wait(10000));
+
+ // Delete the detector on TQ.
+ queue.PostTask([this, &event] {
+ overuse_detector_.reset();
+ event.Set();
+ });
EXPECT_TRUE(event.Wait(10000));
}

Powered by Google App Engine
This is Rietveld 408576698