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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/TreeWalker/filter-throw.html

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/dom/TreeWalker/filter-throw.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/TreeWalker/filter-throw.html b/third_party/WebKit/LayoutTests/fast/dom/TreeWalker/filter-throw.html
index 607be7d629043ee4a4954fe06f83656a1728ff0d..ea8744e853e21b53602c2407046fa4403bc5112f 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/TreeWalker/filter-throw.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/TreeWalker/filter-throw.html
@@ -1,9 +1,40 @@
-<!DOCTYPE html>
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/filter-throw.js"></script>
+<script>
+description('Test JS objects as NodeFilters.');
+
+var walker;
+var testElement = document.createElement("div");
+testElement.id = 'root';
+testElement.innerHTML='<div id="A1"><div id="B1"></div><div id="B2"></div></div>';
+debug("Testing with object filter");
+walker = document.createTreeWalker(testElement, NodeFilter.SHOW_ELEMENT, function(node) {
+ throw('filter exception');
+ return NodeFilter.FILTER_ACCEPT;
+}, false);
+
+debug("Test with filter function");
+shouldThrow("walker.firstChild();");
+shouldBe("walker.currentNode.id", "'root'")
+shouldThrow("walker.nextNode();walker.currentNode.id");
+shouldBe("walker.currentNode.id", "'root'")
+
+walker = document.createTreeWalker(testElement, NodeFilter.SHOW_ELEMENT, {
+ acceptNode : function(node) {
+ throw('filter exception');
+ return NodeFilter.FILTER_ACCEPT;
+ }
+ }, false);
+
+debug("<br>Test with filter object");
+shouldThrow("walker.firstChild();");
+shouldBe("walker.currentNode.id", "'root'")
+shouldThrow("walker.nextNode();walker.currentNode.id");
+shouldBe("walker.currentNode.id", "'root'")
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698