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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/selection/addRange.js

Issue 2700673005: selection: Do not run invalid sub-tests with unselectable Range. (Closed)
Patch Set: . Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/external/wpt/selection/addRange-00-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/external/wpt/selection/addRange.js
diff --git a/third_party/WebKit/LayoutTests/external/wpt/selection/addRange.js b/third_party/WebKit/LayoutTests/external/wpt/selection/addRange.js
index 5b94f86da739f311ce2d65ed59fd6830c0ce3576..855520e538964cade61ee190e5b9a71de84f95cf 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/selection/addRange.js
+++ b/third_party/WebKit/LayoutTests/external/wpt/selection/addRange.js
@@ -1,6 +1,23 @@
"use strict";
function testAddRange(exception, range, endpoints, qualifier, testName) {
+ if (!isSelectableNode(endpoints[0]) || !isSelectableNode(endpoints[2])) {
+ test(function() {
+ assert_equals(exception, null, "Test setup must not throw exceptions");
+
+ assertSelectionNoChange(function() { selection.addRange(range); });
+ assert_equals(range.startContainer, endpoints[0],
+ "addRange() must not modify the startContainer of the Range it's given");
+ assert_equals(range.startOffset, endpoints[1],
+ "addRange() must not modify the startOffset of the Range it's given");
+ assert_equals(range.endContainer, endpoints[2],
+ "addRange() must not modify the endContainer of the Range it's given");
+ assert_equals(range.endOffset, endpoints[3],
+ "addRange() must not modify the endOffset of the Range it's given");
+ }, testName + ": " + qualifier + " addRange() must do nothing");
+ return;
+ }
+
test(function() {
assert_equals(exception, null, "Test setup must not throw exceptions");
@@ -176,7 +193,8 @@ function testAddRangeSubSet(startIndex, optionalEndIndex) {
}
testAddRange(exception, range1, endpoints1, "first", testName);
- testAddRange(exception, range2, endpoints2, "second", testName);
+ if (selection.rangeCount > 0)
+ testAddRange(exception, range2, endpoints2, "second", testName);
}
}
}
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/external/wpt/selection/addRange-00-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698