Reviewers: dglazkov
CL:
https://codereview.chromium.org/2385643002/Message:
Hi, added test for empty WebRange construction, since the problem was faulty
DCHECK it would fail only in debug builds. The test is quite simple, please
advise if you would like to have it expanded in some way. PTAL.
Description:
Add WebRange test for explicit empty ranges creation.
This is followup of
https://codereview.chromium.org/2373613005/.
Affected files (+11, -4 lines):
M third_party/WebKit/Source/web/BUILD.gn
A + third_party/WebKit/Source/web/tests/WebRangeTest.cpp
Index: third_party/WebKit/Source/web/BUILD.gn
diff --git a/third_party/WebKit/Source/web/BUILD.gn b/third_party/WebKit/Source/web/BUILD.gn
index 2816303ff8e2d840e974352992bba5305d999b5d..9d54d3db52484e90f51c39cf05a256c8381566e8 100644
--- a/third_party/WebKit/Source/web/BUILD.gn
+++ b/third_party/WebKit/Source/web/BUILD.gn
@@ -364,6 +364,7 @@ test("webkit_unit_tests") {
"tests/WebInputEventConversionTest.cpp",
"tests/WebMeaningfulLayoutsTest.cpp",
"tests/WebPluginContainerTest.cpp",
+ "tests/WebRangeTest.cpp",
"tests/WebScopedWindowFocusAllowedIndicatorTest.cpp",
"tests/WebSearchableFormDataTest.cpp",
"tests/WebSelectorTest.cpp",
Index: third_party/WebKit/Source/web/tests/WebRangeTest.cpp
diff --git a/third_party/WebKit/Source/core/animation/animatable/AnimatableNeutralTest.cpp b/third_party/WebKit/Source/web/tests/WebRangeTest.cpp
similarity index 83%
copy from third_party/WebKit/Source/core/animation/animatable/AnimatableNeutralTest.cpp
copy to third_party/WebKit/Source/web/tests/WebRangeTest.cpp
index 8873e3ec1781d0adcc1785ca802ed86f84b3b509..da184505dc7368543e41d6a2a942d86e398b75d7 100644
--- a/third_party/WebKit/Source/core/animation/animatable/AnimatableNeutralTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebRangeTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Google Inc. All rights reserved.
+ * Copyright (C) 2017 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -28,15 +28,21 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "core/animation/animatable/AnimatableNeutral.h"
+#include "public/web/WebRange.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace blink {
-TEST(AnimationAnimatableNeutralTest, Create)
+TEST(WebRangeTest, Empty)
{
- EXPECT_TRUE(AnimatableValue::neutralValue());
+ WebRange empty1(0, 0);
+ EXPECT_FALSE(empty1.isNull());
+ EXPECT_TRUE(empty1.isEmpty());
+
+ WebRange empty2(57, 0);
+ EXPECT_FALSE(empty2.isNull());
+ EXPECT_TRUE(empty2.isEmpty());
}
} // namespace blink