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

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

Issue 2615953003: Rename IGNORE_EXCEPTION to IGNORE_EXCEPTION_FOR_TESTING (Closed)
Patch Set: temp Created 3 years, 11 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 21 matching lines...) Expand all
32 32
33 #include "bindings/core/v8/ExceptionState.h" 33 #include "bindings/core/v8/ExceptionState.h"
34 #include "testing/gtest/include/gtest/gtest.h" 34 #include "testing/gtest/include/gtest/gtest.h"
35 #include <sstream> 35 #include <sstream>
36 36
37 namespace blink { 37 namespace blink {
38 38
39 static std::string ToString(const TimeRanges& ranges) { 39 static std::string ToString(const TimeRanges& ranges) {
40 std::stringstream ss; 40 std::stringstream ss;
41 ss << "{"; 41 ss << "{";
42 for (unsigned i = 0; i < ranges.length(); ++i) 42 for (unsigned i = 0; i < ranges.length(); ++i) {
43 ss << " [" << ranges.start(i, IGNORE_EXCEPTION) << "," 43 ss << " [" << ranges.start(i, IGNORE_EXCEPTION_FOR_TESTING) << ","
44 << ranges.end(i, IGNORE_EXCEPTION) << ")"; 44 << ranges.end(i, IGNORE_EXCEPTION_FOR_TESTING) << ")";
45 }
45 ss << " }"; 46 ss << " }";
46 47
47 return ss.str(); 48 return ss.str();
48 } 49 }
49 50
50 #define ASSERT_RANGE(expected, range) ASSERT_EQ(expected, ToString(*range)) 51 #define ASSERT_RANGE(expected, range) ASSERT_EQ(expected, ToString(*range))
51 52
52 TEST(TimeRangesTest, Empty) { 53 TEST(TimeRangesTest, Empty) {
53 ASSERT_RANGE("{ }", TimeRanges::create()); 54 ASSERT_RANGE("{ }", TimeRanges::create());
54 } 55 }
(...skipping 16 matching lines...) Expand all
71 TimeRanges* rangeB = TimeRanges::create(); 72 TimeRanges* rangeB = TimeRanges::create();
72 73
73 rangeA->add(0, 2); 74 rangeA->add(0, 2);
74 rangeA->add(3, 4); 75 rangeA->add(3, 4);
75 rangeA->add(5, 100); 76 rangeA->add(5, 100);
76 77
77 std::string expected = "{ [0,2) [3,4) [5,100) }"; 78 std::string expected = "{ [0,2) [3,4) [5,100) }";
78 ASSERT_RANGE(expected, rangeA); 79 ASSERT_RANGE(expected, rangeA);
79 80
80 // Add the values in rangeA to rangeB in reverse order. 81 // Add the values in rangeA to rangeB in reverse order.
81 for (int i = rangeA->length() - 1; i >= 0; --i) 82 for (int i = rangeA->length() - 1; i >= 0; --i) {
82 rangeB->add(rangeA->start(i, IGNORE_EXCEPTION), 83 rangeB->add(rangeA->start(i, IGNORE_EXCEPTION_FOR_TESTING),
83 rangeA->end(i, IGNORE_EXCEPTION)); 84 rangeA->end(i, IGNORE_EXCEPTION_FOR_TESTING));
85 }
84 86
85 ASSERT_RANGE(expected, rangeB); 87 ASSERT_RANGE(expected, rangeB);
86 } 88 }
87 89
88 TEST(TimeRangesTest, OverlappingAdds) { 90 TEST(TimeRangesTest, OverlappingAdds) {
89 TimeRanges* ranges = TimeRanges::create(); 91 TimeRanges* ranges = TimeRanges::create();
90 92
91 ranges->add(0, 2); 93 ranges->add(0, 2);
92 ranges->add(10, 11); 94 ranges->add(10, 11);
93 ASSERT_RANGE("{ [0,2) [10,11) }", ranges); 95 ASSERT_RANGE("{ [0,2) [10,11) }", ranges);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 ASSERT_EQ(5, ranges->nearest(5, 0)); 298 ASSERT_EQ(5, ranges->nearest(5, 0));
297 ASSERT_EQ(7, ranges->nearest(8, 0)); 299 ASSERT_EQ(7, ranges->nearest(8, 0));
298 300
299 ranges->add(9, 11); 301 ranges->add(9, 11);
300 ASSERT_EQ(7, ranges->nearest(8, 6)); 302 ASSERT_EQ(7, ranges->nearest(8, 6));
301 ASSERT_EQ(7, ranges->nearest(8, 8)); 303 ASSERT_EQ(7, ranges->nearest(8, 8));
302 ASSERT_EQ(9, ranges->nearest(8, 10)); 304 ASSERT_EQ(9, ranges->nearest(8, 10));
303 } 305 }
304 306
305 } // namespace blink 307 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/TimeRanges.cpp ('k') | third_party/WebKit/Source/core/html/forms/InputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698