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

Side by Side Diff: Source/core/html/TimeRangesTest.cpp

Issue 22417002: Rename ASSERT_NO_EXCEPTION_STATE and IGNORE_EXCEPTION_STATE (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/TimeRanges.cpp ('k') | Source/core/html/canvas/CanvasRenderingContext2D.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 25 matching lines...) Expand all
36 36
37 #include <sstream> 37 #include <sstream>
38 38
39 using WebCore::TimeRanges; 39 using WebCore::TimeRanges;
40 40
41 static std::string ToString(const TimeRanges& ranges) 41 static std::string ToString(const TimeRanges& ranges)
42 { 42 {
43 std::stringstream ss; 43 std::stringstream ss;
44 ss << "{"; 44 ss << "{";
45 for (unsigned i = 0; i < ranges.length(); ++i) 45 for (unsigned i = 0; i < ranges.length(); ++i)
46 ss << " [" << ranges.start(i, IGNORE_EXCEPTION_STATE) << "," << ranges.e nd(i, IGNORE_EXCEPTION_STATE) << ")"; 46 ss << " [" << ranges.start(i, IGNORE_EXCEPTION) << "," << ranges.end(i, IGNORE_EXCEPTION) << ")";
47 ss << " }"; 47 ss << " }";
48 48
49 return ss.str(); 49 return ss.str();
50 } 50 }
51 51
52 #define ASSERT_RANGE(expected, range) ASSERT_EQ(expected, ToString(*range)) 52 #define ASSERT_RANGE(expected, range) ASSERT_EQ(expected, ToString(*range))
53 53
54 TEST(TimeRanges, Empty) 54 TEST(TimeRanges, Empty)
55 { 55 {
56 ASSERT_RANGE("{ }", TimeRanges::create()); 56 ASSERT_RANGE("{ }", TimeRanges::create());
(...skipping 11 matching lines...) Expand all
68 68
69 rangeA->add(0, 2); 69 rangeA->add(0, 2);
70 rangeA->add(3, 4); 70 rangeA->add(3, 4);
71 rangeA->add(5, 100); 71 rangeA->add(5, 100);
72 72
73 std::string expected = "{ [0,2) [3,4) [5,100) }"; 73 std::string expected = "{ [0,2) [3,4) [5,100) }";
74 ASSERT_RANGE(expected, rangeA); 74 ASSERT_RANGE(expected, rangeA);
75 75
76 // Add the values in rangeA to rangeB in reverse order. 76 // Add the values in rangeA to rangeB in reverse order.
77 for (int i = rangeA->length() - 1; i >= 0; --i) 77 for (int i = rangeA->length() - 1; i >= 0; --i)
78 rangeB->add(rangeA->start(i, IGNORE_EXCEPTION_STATE), rangeA->end(i, IGN ORE_EXCEPTION_STATE)); 78 rangeB->add(rangeA->start(i, IGNORE_EXCEPTION), rangeA->end(i, IGNORE_EX CEPTION));
79 79
80 ASSERT_RANGE(expected, rangeB); 80 ASSERT_RANGE(expected, rangeB);
81 } 81 }
82 82
83 TEST(TimeRanges, OverlappingAdds) 83 TEST(TimeRanges, OverlappingAdds)
84 { 84 {
85 RefPtr<TimeRanges> ranges = TimeRanges::create(); 85 RefPtr<TimeRanges> ranges = TimeRanges::create();
86 86
87 ranges->add(0, 2); 87 ranges->add(0, 2);
88 ranges->add(10, 11); 88 ranges->add(10, 11);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 rangesB->add(6, 9); 281 rangesB->add(6, 9);
282 282
283 ASSERT_RANGE("{ [0,2) [4,7) [8,10) }", rangesA); 283 ASSERT_RANGE("{ [0,2) [4,7) [8,10) }", rangesA);
284 ASSERT_RANGE("{ [1,5) [6,9) }", rangesB); 284 ASSERT_RANGE("{ [1,5) [6,9) }", rangesB);
285 285
286 rangesA->intersectWith(rangesB.get()); 286 rangesA->intersectWith(rangesB.get());
287 287
288 ASSERT_RANGE("{ [1,2) [4,5) [6,7) [8,9) }", rangesA); 288 ASSERT_RANGE("{ [1,2) [4,5) [6,7) [8,9) }", rangesA);
289 ASSERT_RANGE("{ [1,5) [6,9) }", rangesB); 289 ASSERT_RANGE("{ [1,5) [6,9) }", rangesB);
290 } 290 }
OLDNEW
« no previous file with comments | « Source/core/html/TimeRanges.cpp ('k') | Source/core/html/canvas/CanvasRenderingContext2D.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698