Add WebRange test for explicit empty ranges creation. (issue 2385643002 by mharanczyk@opera.com)

0 views
Skip to first unread message

mhara...@opera.com

unread,
Sep 30, 2016, 6:10:46 AM9/30/16
to dgla...@chromium.org, chromium...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org
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


dgla...@chromium.org

unread,
Sep 30, 2016, 12:28:23 PM9/30/16
to mhara...@opera.com, blink-...@chromium.org, chromium...@chromium.org, kinuko...@chromium.org

commit-bot@chromium.org via codereview.chromium.org

unread,
Oct 3, 2016, 4:42:56 AM10/3/16
to mhara...@opera.com, dgla...@chromium.org, commi...@chromium.org, blink-...@chromium.org, chromium...@chromium.org, kinuko...@chromium.org

commit-bot@chromium.org via codereview.chromium.org

unread,
Oct 3, 2016, 6:06:17 AM10/3/16
to mhara...@opera.com, dgla...@chromium.org, commi...@chromium.org, blink-...@chromium.org, chromium...@chromium.org, kinuko...@chromium.org
Failed to apply patch for third_party/WebKit/Source/web/tests/WebRangeTest.cpp:
While running git apply --index -3 -p1;
error: patch failed:
third_party/WebKit/Source/core/animation/animatable/AnimatableNeutralTest.cpp:28
Falling back to three-way merge...
Applied patch to 'third_party/WebKit/Source/web/tests/WebRangeTest.cpp' with
conflicts.
U third_party/WebKit/Source/web/tests/WebRangeTest.cpp

Patch: NR
third_party/WebKit/Source/core/animation/animatable/AnimatableNeutralTest.cpp->third_party/WebKit/Source/web/tests/WebRangeTest.cpp

commit-bot@chromium.org via codereview.chromium.org

unread,
Oct 3, 2016, 7:21:42 AM10/3/16
to mhara...@opera.com, dgla...@chromium.org, commi...@chromium.org, blink-...@chromium.org, chromium...@chromium.org, kinuko...@chromium.org

commit-bot@chromium.org via codereview.chromium.org

unread,
Oct 3, 2016, 8:32:12 AM10/3/16
to mhara...@opera.com, dgla...@chromium.org, commi...@chromium.org, blink-...@chromium.org, chromium...@chromium.org, kinuko...@chromium.org
Committed patchset #2 (id:20001)

https://codereview.chromium.org/2385643002/

commit-bot@chromium.org via codereview.chromium.org

unread,
Oct 3, 2016, 8:34:37 AM10/3/16
to mhara...@opera.com, dgla...@chromium.org, commi...@chromium.org, blink-...@chromium.org, chromium...@chromium.org, kinuko...@chromium.org
Patchset 2 (id:??) landed as
https://crrev.com/aee6e98a6b9fe3895f9dede7dc9dc858d75a223e
Cr-Commit-Position: refs/heads/master@{#422405}

https://codereview.chromium.org/2385643002/
Reply all
Reply to author
Forward
0 new messages