OLD | NEW |
---|---|
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 TEST(TimeRanges, Empty) | 54 TEST(TimeRanges, Empty) |
55 { | 55 { |
56 ASSERT_RANGE("{ }", TimeRanges::create()); | 56 ASSERT_RANGE("{ }", TimeRanges::create()); |
57 } | 57 } |
58 | 58 |
59 TEST(TimeRanges, SingleRange) | 59 TEST(TimeRanges, SingleRange) |
60 { | 60 { |
61 ASSERT_RANGE("{ [1,2) }", TimeRanges::create(1, 2)); | 61 ASSERT_RANGE("{ [1,2) }", TimeRanges::create(1, 2)); |
62 } | 62 } |
63 | 63 |
64 TEST(TimeRanges, CreateFromWebTimeRanges) | |
65 { | |
66 blink::WebTimeRanges webRanges(static_cast<size_t>(2)); | |
acolwell GONE FROM CHROMIUM
2013/11/12 18:25:17
nit: s/static_cast<size_t>(2)/2u/ ?
philipj_slow
2013/11/12 19:47:58
Unfortunately, GCC then doesn't pick the correct c
| |
67 webRanges[0].start = 0; | |
68 webRanges[0].end = 1; | |
69 webRanges[1].start = 2; | |
70 webRanges[1].end = 3; | |
71 ASSERT_RANGE("{ [0,1) [2,3) }", TimeRanges::create(webRanges)); | |
72 } | |
73 | |
64 TEST(TimeRanges, AddOrder) | 74 TEST(TimeRanges, AddOrder) |
65 { | 75 { |
66 RefPtr<TimeRanges> rangeA = TimeRanges::create(); | 76 RefPtr<TimeRanges> rangeA = TimeRanges::create(); |
67 RefPtr<TimeRanges> rangeB = TimeRanges::create(); | 77 RefPtr<TimeRanges> rangeB = TimeRanges::create(); |
68 | 78 |
69 rangeA->add(0, 2); | 79 rangeA->add(0, 2); |
70 rangeA->add(3, 4); | 80 rangeA->add(3, 4); |
71 rangeA->add(5, 100); | 81 rangeA->add(5, 100); |
72 | 82 |
73 std::string expected = "{ [0,2) [3,4) [5,100) }"; | 83 std::string expected = "{ [0,2) [3,4) [5,100) }"; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 rangesB->add(6, 9); | 291 rangesB->add(6, 9); |
282 | 292 |
283 ASSERT_RANGE("{ [0,2) [4,7) [8,10) }", rangesA); | 293 ASSERT_RANGE("{ [0,2) [4,7) [8,10) }", rangesA); |
284 ASSERT_RANGE("{ [1,5) [6,9) }", rangesB); | 294 ASSERT_RANGE("{ [1,5) [6,9) }", rangesB); |
285 | 295 |
286 rangesA->intersectWith(rangesB.get()); | 296 rangesA->intersectWith(rangesB.get()); |
287 | 297 |
288 ASSERT_RANGE("{ [1,2) [4,5) [6,7) [8,9) }", rangesA); | 298 ASSERT_RANGE("{ [1,2) [4,5) [6,7) [8,9) }", rangesA); |
289 ASSERT_RANGE("{ [1,5) [6,9) }", rangesB); | 299 ASSERT_RANGE("{ [1,5) [6,9) }", rangesB); |
290 } | 300 } |
OLD | NEW |