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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 rangesB->add(6, 9); 291 rangesB->add(6, 9);
292 292
293 ASSERT_RANGE("{ [0,2) [4,7) [8,10) }", rangesA); 293 ASSERT_RANGE("{ [0,2) [4,7) [8,10) }", rangesA);
294 ASSERT_RANGE("{ [1,5) [6,9) }", rangesB); 294 ASSERT_RANGE("{ [1,5) [6,9) }", rangesB);
295 295
296 rangesA->intersectWith(rangesB.get()); 296 rangesA->intersectWith(rangesB.get());
297 297
298 ASSERT_RANGE("{ [1,2) [4,5) [6,7) [8,9) }", rangesA); 298 ASSERT_RANGE("{ [1,2) [4,5) [6,7) [8,9) }", rangesA);
299 ASSERT_RANGE("{ [1,5) [6,9) }", rangesB); 299 ASSERT_RANGE("{ [1,5) [6,9) }", rangesB);
300 } 300 }
301
302 TEST(TimeRanges, Nearest)
303 {
304 RefPtrWillBeRawPtr<TimeRanges> ranges = TimeRanges::create();
305 ranges->add(0, 2);
306 ranges->add(5, 7);
307
308 ASSERT_EQ(0, ranges->nearest(0));
309 ASSERT_EQ(1, ranges->nearest(1));
310 ASSERT_EQ(2, ranges->nearest(2));
311 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
312 ASSERT_EQ(5, ranges->nearest(4));
313 ASSERT_EQ(5, ranges->nearest(5));
314 ASSERT_EQ(7, ranges->nearest(8));
315 }
OLDNEW
« 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