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

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

Issue 562493003: Allow seeks to zero on streaming sources. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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
« Source/core/html/HTMLMediaElement.cpp ('K') | « Source/core/html/TimeRanges.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/TimeRangesTest.cpp
diff --git a/Source/core/html/TimeRangesTest.cpp b/Source/core/html/TimeRangesTest.cpp
index 7621f2b1a19725b63abac7819d68faaf4e771414..e4b11d6ceadccebc51fcbbbc6cbc9fcbf515a58a 100644
--- a/Source/core/html/TimeRangesTest.cpp
+++ b/Source/core/html/TimeRangesTest.cpp
@@ -298,3 +298,18 @@ TEST(TimeRanges, IntersectWith_Gaps3)
ASSERT_RANGE("{ [1,2) [4,5) [6,7) [8,9) }", rangesA);
ASSERT_RANGE("{ [1,5) [6,9) }", rangesB);
}
+
+TEST(TimeRanges, Nearest)
+{
+ RefPtrWillBeRawPtr<TimeRanges> ranges = TimeRanges::create();
+ ranges->add(0, 2);
+ ranges->add(5, 7);
+
+ ASSERT_EQ(0, ranges->nearest(0));
+ ASSERT_EQ(1, ranges->nearest(1));
+ ASSERT_EQ(2, ranges->nearest(2));
+ ASSERT_EQ(2, ranges->nearest(3));
philipj_slow 2014/09/10 12:51:18 Can you also test the case where the point is exac
DaleCurtis 2014/09/10 17:45:19 Damn, you caught me! :) I was trying to avoid any
+ ASSERT_EQ(5, ranges->nearest(4));
+ ASSERT_EQ(5, ranges->nearest(5));
+ ASSERT_EQ(7, ranges->nearest(8));
+}
« Source/core/html/HTMLMediaElement.cpp ('K') | « Source/core/html/TimeRanges.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698