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

Unified Diff: media/capture/content/video_capture_oracle_unittest.cc

Issue 1865283003: Revert of Tab/Desktop Capture: Use requests instead of timer-based refreshing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@video_refresh_from_sinks
Patch Set: Created 4 years, 8 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
« no previous file with comments | « media/capture/content/video_capture_oracle.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/capture/content/video_capture_oracle_unittest.cc
diff --git a/media/capture/content/video_capture_oracle_unittest.cc b/media/capture/content/video_capture_oracle_unittest.cc
index dbfcae29183f287c7dad877414d35b1998c65bef..64fff4fb4d0de881ef211420c1309377815e784f 100644
--- a/media/capture/content/video_capture_oracle_unittest.cc
+++ b/media/capture/content/video_capture_oracle_unittest.cc
@@ -198,12 +198,12 @@
}
}
-// Tests that VideoCaptureOracle prevents refresh request events from initiating
+// Tests that VideoCaptureOracle prevents timer polling from initiating
// simultaneous captures.
-TEST(VideoCaptureOracleTest, SamplesAtCorrectTimesAroundRefreshRequests) {
+TEST(VideoCaptureOracleTest, SamplesOnlyOneOverdueFrameAtATime) {
const base::TimeDelta vsync_interval = base::TimeDelta::FromSeconds(1) / 60;
- const base::TimeDelta refresh_interval =
- base::TimeDelta::FromMilliseconds(125); // 8 FPS
+ const base::TimeDelta timer_interval = base::TimeDelta::FromMilliseconds(
+ VideoCaptureOracle::kMinTimerPollPeriodMillis);
VideoCaptureOracle oracle(Get30HzPeriod(), Get720pSize(),
media::RESOLUTION_POLICY_FIXED_RESOLUTION, false);
@@ -236,24 +236,24 @@
}
int frame_number = oracle.RecordCapture(0.0);
- // Stop providing the compositor events and start providing refresh request
+ // Stop providing the compositor events and start providing timer polling
// events. No overdue samplings should be recommended because of the
// not-yet-complete compositor-based capture.
for (int i = 0; i < 10; ++i) {
- t += refresh_interval;
+ t += timer_interval;
ASSERT_FALSE(oracle.ObserveEventAndDecideCapture(
- VideoCaptureOracle::kPassiveRefreshRequest, gfx::Rect(), t));
+ VideoCaptureOracle::kTimerPoll, gfx::Rect(), t));
}
// Now, complete the oustanding compositor-based capture and continue
- // providing refresh request events. The oracle should start recommending
+ // providing timer polling events. The oracle should start recommending
// sampling again.
ASSERT_TRUE(oracle.CompleteCapture(frame_number, true, &ignored));
did_complete_a_capture = false;
for (int i = 0; i < 10; ++i) {
- t += refresh_interval;
- if (oracle.ObserveEventAndDecideCapture(
- VideoCaptureOracle::kPassiveRefreshRequest, gfx::Rect(), t)) {
+ t += timer_interval;
+ if (oracle.ObserveEventAndDecideCapture(VideoCaptureOracle::kTimerPoll,
+ gfx::Rect(), t)) {
ASSERT_TRUE(
oracle.CompleteCapture(oracle.RecordCapture(0.0), true, &ignored));
did_complete_a_capture = true;
@@ -261,30 +261,30 @@
}
ASSERT_TRUE(did_complete_a_capture);
- // Start one more "refresh" capture, but do not notify of completion yet.
+ // Start one more timer-based capture, but do not notify of completion yet.
for (int i = 0; i <= 10; ++i) {
ASSERT_GT(10, i) << "BUG: Seems like it'll never happen!";
- t += refresh_interval;
- if (oracle.ObserveEventAndDecideCapture(
- VideoCaptureOracle::kPassiveRefreshRequest, gfx::Rect(), t)) {
+ t += timer_interval;
+ if (oracle.ObserveEventAndDecideCapture(VideoCaptureOracle::kTimerPoll,
+ gfx::Rect(), t)) {
break;
}
}
frame_number = oracle.RecordCapture(0.0);
// Confirm that the oracle does not recommend sampling until the outstanding
- // "refresh" capture completes.
- for (int i = 0; i < 10; ++i) {
- t += refresh_interval;
+ // timer-based capture completes.
+ for (int i = 0; i < 10; ++i) {
+ t += timer_interval;
ASSERT_FALSE(oracle.ObserveEventAndDecideCapture(
- VideoCaptureOracle::kPassiveRefreshRequest, gfx::Rect(), t));
+ VideoCaptureOracle::kTimerPoll, gfx::Rect(), t));
}
ASSERT_TRUE(oracle.CompleteCapture(frame_number, true, &ignored));
for (int i = 0; i <= 10; ++i) {
ASSERT_GT(10, i) << "BUG: Seems like it'll never happen!";
- t += refresh_interval;
- if (oracle.ObserveEventAndDecideCapture(
- VideoCaptureOracle::kPassiveRefreshRequest, gfx::Rect(), t)) {
+ t += timer_interval;
+ if (oracle.ObserveEventAndDecideCapture(VideoCaptureOracle::kTimerPoll,
+ gfx::Rect(), t)) {
break;
}
}
« no previous file with comments | « media/capture/content/video_capture_oracle.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698