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

Unified Diff: Source/core/html/TimeRangesTest.cpp

Issue 982553002: Paint buffered range closest to the current play position (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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: Source/core/html/TimeRangesTest.cpp
diff --git a/Source/core/html/TimeRangesTest.cpp b/Source/core/html/TimeRangesTest.cpp
index aab2e9d4ffb3065a0ebc3d4861634e1de7679ede..146f6c85b964fcee4866bfc39288d5a52c350358 100644
--- a/Source/core/html/TimeRangesTest.cpp
+++ b/Source/core/html/TimeRangesTest.cpp
@@ -318,3 +318,21 @@ TEST(TimeRanges, Nearest)
ASSERT_EQ(7, ranges->nearest(8, 8));
ASSERT_EQ(9, ranges->nearest(8, 10));
}
+
+TEST(TimeRanges, NearestRange)
+{
+ RefPtrWillBeRawPtr<TimeRanges> ranges = TimeRanges::create();
+ ranges->add(0, 2);
+ ranges->add(5, 7);
+
+ ASSERT_EQ(0u, ranges->nearestRange(0));
+ ASSERT_EQ(0u, ranges->nearestRange(1));
+ ASSERT_EQ(0u, ranges->nearestRange(2));
+ ASSERT_EQ(0u, ranges->nearestRange(3));
+ ASSERT_EQ(1u, ranges->nearestRange(4));
+ ASSERT_EQ(1u, ranges->nearestRange(5));
+ ASSERT_EQ(1u, ranges->nearestRange(8));
+
+ ranges->add(9, 11);
+ ASSERT_EQ(2u, ranges->nearestRange(8));
+}

Powered by Google App Engine
This is Rietveld 408576698