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

Unified Diff: LayoutTests/fast/dom/XMLSerializer-doctype2.html

Issue 22880019: [DOM4] Doctypes now always have a node document and can be moved across document boundaries (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Improve tests Created 7 years, 4 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: LayoutTests/fast/dom/XMLSerializer-doctype2.html
diff --git a/LayoutTests/fast/dom/XMLSerializer-doctype2.html b/LayoutTests/fast/dom/XMLSerializer-doctype2.html
index 78da090c22a76f51424ac17ba4faa6907c4bcf1f..304b1053dbe8eb7819c54dbbe1e85022df59ebe5 100644
--- a/LayoutTests/fast/dom/XMLSerializer-doctype2.html
+++ b/LayoutTests/fast/dom/XMLSerializer-doctype2.html
@@ -1,37 +1,18 @@
<html>
<head>
- <script>
- function debug(str) {
- li = document.createElement('li');
- li.appendChild(document.createTextNode(str));
- document.getElementById('console').appendChild(li);
- }
-
- function runTests() {
- if (window.testRunner)
- testRunner.dumpAsText();
-
- var docType = window.document.implementation.createDocumentType("aDocTypeName", "aPublicID", "aSystemID");
-
- var serializer = new XMLSerializer();
-
- try {
- var text = serializer.serializeToString(docType);
- debug("FAIL: XMLSerializer.serializeToString() should throw an exception if it tries to serialize a documentless DocumentType node.");
- } catch (e) {
- if (e == "InvalidAccessError: A parameter or an operation was not supported by the underlying object.")
- debug("PASS: an " + e + " was thrown as expected.")
- else
- debug("FAIL: XMLSerializer.serializeToString() should throw an InvalidAccessError DOMExeption if it tries to serialize a documentless DocumentType node.");
- }
- }
- </script>
+<script src="../js/resources/js-test-pre.js"></script>
</head>
-<body onload="runTests()">
-This tests XMLSerializer.serializeToString() on a DocumentType node that does not have a document associated
-with it. It should throw an INVALID_ACCESS_ERR DOMException.
+<body>
+<script>
+description("This tests XMLSerializer.serializeToString() on a newly created DocumentType node does not throw since the node has an associated document.");
+
+var docType = window.document.implementation.createDocumentType("aDocTypeName", "aPublicID", "aSystemID");
+var serializer = new XMLSerializer();
-<ul id="console">
-</ul>
+var text;
+shouldNotThrow("text = serializer.serializeToString(docType)");
+shouldBeEqualToString("text", "<!DOCTYPE aDocTypeName PUBLIC \"aPublicID\" \"aSystemID\">");
+</script>
+<script src="../js/resources/js-test-pre.js"></script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698