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

Side by Side 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, 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 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 ASSERT_EQ(2, ranges->nearest(3, 0)); 311 ASSERT_EQ(2, ranges->nearest(3, 0));
312 ASSERT_EQ(5, ranges->nearest(4, 0)); 312 ASSERT_EQ(5, ranges->nearest(4, 0));
313 ASSERT_EQ(5, ranges->nearest(5, 0)); 313 ASSERT_EQ(5, ranges->nearest(5, 0));
314 ASSERT_EQ(7, ranges->nearest(8, 0)); 314 ASSERT_EQ(7, ranges->nearest(8, 0));
315 315
316 ranges->add(9, 11); 316 ranges->add(9, 11);
317 ASSERT_EQ(7, ranges->nearest(8, 6)); 317 ASSERT_EQ(7, ranges->nearest(8, 6));
318 ASSERT_EQ(7, ranges->nearest(8, 8)); 318 ASSERT_EQ(7, ranges->nearest(8, 8));
319 ASSERT_EQ(9, ranges->nearest(8, 10)); 319 ASSERT_EQ(9, ranges->nearest(8, 10));
320 } 320 }
321
322 TEST(TimeRanges, NearestRange)
323 {
324 RefPtrWillBeRawPtr<TimeRanges> ranges = TimeRanges::create();
325 ranges->add(0, 2);
326 ranges->add(5, 7);
327
328 ASSERT_EQ(0u, ranges->nearestRange(0));
329 ASSERT_EQ(0u, ranges->nearestRange(1));
330 ASSERT_EQ(0u, ranges->nearestRange(2));
331 ASSERT_EQ(0u, ranges->nearestRange(3));
332 ASSERT_EQ(1u, ranges->nearestRange(4));
333 ASSERT_EQ(1u, ranges->nearestRange(5));
334 ASSERT_EQ(1u, ranges->nearestRange(8));
335
336 ranges->add(9, 11);
337 ASSERT_EQ(2u, ranges->nearestRange(8));
338 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698