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

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

Issue 986823002: De-dupe copy requests for tab capture in DelegatedFrameHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove redundant portion of new test. Created 5 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
Index: content/browser/media/capture/video_capture_oracle_unittest.cc
diff --git a/content/browser/media/capture/video_capture_oracle_unittest.cc b/content/browser/media/capture/video_capture_oracle_unittest.cc
index 630e081bec37ec043b76a3d4783ab967aa7f4d43..f6d8712d22edbcb633ea91d45afd239602225993 100644
--- a/content/browser/media/capture/video_capture_oracle_unittest.cc
+++ b/content/browser/media/capture/video_capture_oracle_unittest.cc
@@ -1145,6 +1145,57 @@ TEST(VideoCaptureOracleTest, EnforcesFramesDeliveredInOrder) {
}
}
+// Tests that VideoCaptureOracle modifies the timestamp of an older capture when
+// newer captures have been aborted before the older one succeeds (since the
+// older frame will contain newer content).
+TEST(VideoCaptureOracleTest, ModifiesTimestampsDueToAbortedCaptures) {
+ const base::TimeDelta min_capture_period =
+ base::TimeDelta::FromSeconds(1) / 30;
+ const gfx::Rect empty_damage_rect;
+ const base::TimeDelta event_increment = min_capture_period * 2;
+
+ VideoCaptureOracle oracle(min_capture_period);
+
+ // Start with a stream of captures alternating success vs failure.
+ base::TimeTicks t = InitialTestTimeTicks();
+ int last_frame_number;
+ base::TimeTicks timestamp;
+ for (int i = 0; i < 10; ++i) {
+ t += event_increment;
+ ASSERT_TRUE(oracle.ObserveEventAndDecideCapture(
+ VideoCaptureOracle::kCompositorUpdate,
+ empty_damage_rect, t));
+ last_frame_number = oracle.RecordCapture();
+ if (i % 2 == 0) {
+ ASSERT_TRUE(oracle.CompleteCapture(last_frame_number, &timestamp));
+ ASSERT_EQ(t, timestamp);
+ } else {
+ oracle.CaptureAbortedOrFailed(last_frame_number);
+ }
+ }
+
+ // One capture will succeed after the 1 to 3 captures scheduled after it are
+ // first aborted.
+ for (int num_aborts = 1; num_aborts <= 3; ++num_aborts) {
+ t += event_increment;
+ ASSERT_TRUE(oracle.ObserveEventAndDecideCapture(
+ VideoCaptureOracle::kCompositorUpdate,
+ empty_damage_rect, t));
+ last_frame_number = oracle.RecordCapture();
+ for (int i = 0; i < num_aborts; ++i) {
+ t += event_increment;
+ ASSERT_TRUE(oracle.ObserveEventAndDecideCapture(
+ VideoCaptureOracle::kCompositorUpdate,
+ empty_damage_rect, t));
+ last_frame_number = oracle.RecordCapture();
+ oracle.CaptureAbortedOrFailed(last_frame_number);
+ }
+ ASSERT_TRUE(oracle.CompleteCapture(
+ last_frame_number - num_aborts, &timestamp));
+ ASSERT_EQ(t, timestamp);
+ }
+}
+
// Tests that VideoCaptureOracle transitions between using its two samplers in a
// way that does not introduce severe jank, pauses, etc.
TEST(VideoCaptureOracleTest, TransitionsSmoothlyBetweenSamplers) {

Powered by Google App Engine
This is Rietveld 408576698