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

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

Issue 2770923003: TabCapture: enforce active refresh if there is un-sampled compositor update (Closed)
Patch Set: address comments on PS#2 Created 3 years, 9 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 fcfa40c469178c924ea86f65e432190c7341e994..d75daae8e75404f2f1523626523c3d14b11fe86c 100644
--- a/media/capture/content/video_capture_oracle_unittest.cc
+++ b/media/capture/content/video_capture_oracle_unittest.cc
@@ -350,6 +350,42 @@ TEST(VideoCaptureOracleTest, DoesNotRapidlyChangeCaptureSize) {
}
}
+// Tests that un-sampled compositor update event will fail the next passive
+// refresh request, forcing an active refresh.
+TEST(VideoCaptureOracleTest, EnforceActiveRefreshForUnsampledCompositorUpdate) {
+ const gfx::Rect damage_rect(Get720pSize());
+ const base::TimeDelta event_increment = Get30HzPeriod() * 2;
+ const base::TimeDelta short_event_increment = Get30HzPeriod() / 4;
+
+ VideoCaptureOracle oracle(Get30HzPeriod(), Get720pSize(),
+ media::RESOLUTION_POLICY_FIXED_RESOLUTION, false);
+
+ base::TimeTicks t = InitialTestTimeTicks();
+ int last_frame_number;
+ base::TimeTicks ignored;
+
+ // CompositorUpdate is sampled normally.
+ t += event_increment;
+ ASSERT_TRUE(oracle.ObserveEventAndDecideCapture(
+ VideoCaptureOracle::kCompositorUpdate, damage_rect, t));
+ last_frame_number = oracle.next_frame_number();
+ oracle.RecordCapture(0.0);
+ ASSERT_TRUE(oracle.CompleteCapture(last_frame_number, true, &ignored));
+
+ // Next CompositorUpdate comes too soon and won't be sampled.
+ t += short_event_increment;
+ ASSERT_FALSE(oracle.ObserveEventAndDecideCapture(
+ VideoCaptureOracle::kCompositorUpdate, damage_rect, t));
+
+ // Then the next valid PassiveRefreshRequest will fail to enforce an
+ // ActiveRefreshRequest to capture the updated content.
+ t += event_increment;
+ ASSERT_FALSE(oracle.ObserveEventAndDecideCapture(
+ VideoCaptureOracle::kPassiveRefreshRequest, damage_rect, t));
+ ASSERT_TRUE(oracle.ObserveEventAndDecideCapture(
+ VideoCaptureOracle::kActiveRefreshRequest, damage_rect, t));
+}
+
namespace {
// Tests that VideoCaptureOracle can auto-throttle by stepping the capture size
« 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