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

Unified Diff: LayoutTests/fast/dom/Document/script-tests/createAttributeNS-namespace-err.js

Issue 158593003: Remove Unused measure DocumentCreateAttributeNS (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
Index: LayoutTests/fast/dom/Document/script-tests/createAttributeNS-namespace-err.js
diff --git a/LayoutTests/fast/dom/Document/script-tests/createAttributeNS-namespace-err.js b/LayoutTests/fast/dom/Document/script-tests/createAttributeNS-namespace-err.js
deleted file mode 100644
index 18d2332cea1647134920af60b74d2199e35c93ee..0000000000000000000000000000000000000000
--- a/LayoutTests/fast/dom/Document/script-tests/createAttributeNS-namespace-err.js
+++ /dev/null
@@ -1,131 +0,0 @@
-description("createAttirbuteNS tests adapted from createElementNS tests attached to webkit bug 16833");
-
-function assert(c, m)
-{
- if (!c)
- testFailed(m);
- else
- testPassed(m);
-}
-
-function stringForExceptionCode(c)
-{
- var exceptionName;
- switch(c) {
- case DOMException.INVALID_CHARACTER_ERR:
- exceptionName = "INVALID_CHARACTER_ERR";
- break;
- case DOMException.NAMESPACE_ERR:
- exceptionName = "NAMESPACE_ERR";
- }
- if (exceptionName)
- return exceptionName; // + "(" + c + ")";
- return c;
-}
-
-function assertExceptionCode(exception, expect, m)
-{
- var actual = exception.code;
- if (actual !== expect) {
- m += "; expected " + stringForExceptionCode(expect) + ", threw " + stringForExceptionCode(actual);
- testFailed(m);
- } else {
- m += "; threw " + exception.toString();
- testPassed(m);
- }
-}
-
-var allNSTests = [
- { args: [undefined, undefined] },
- { args: [null, undefined] },
- { args: [undefined, null], code: 5 },
- { args: [null, null], code: 5 },
- { args: [null, ""], code: 5 },
- { args: ["", null], code: 5 },
- { args: ["", ""], code: 5 },
- { args: [null, "<div>"], code: 5 },
- { args: [null, "0div"], code: 5 },
- { args: [null, "di v"], code: 5 },
- { args: [null, "di<v"], code: 5 },
- { args: [null, "-div"], code: 5 },
- { args: [null, ".div"], code: 5 },
- { args: ["http://example.com/", "<div>"], code: 5 },
- { args: ["http://example.com/", "0div"], code: 5 },
- { args: ["http://example.com/", "di<v"], code: 5 },
- { args: ["http://example.com/", "-div"], code: 5 },
- { args: ["http://example.com/", ".div"], code: 5 },
- { args: [null, ":div"], code: 14 },
- { args: [null, "div:"], code: 14 },
- { args: ["http://example.com/", ":div"], code: 14 },
- { args: ["http://example.com/", "div:"], code: 14 },
- { args: [null, "d:iv"], code: 14 },
- { args: [null, "a:b:c"], code: 14, message: "valid XML name, invalid QName" },
- { args: ["http://example.com/", "a:b:c"], code: 14, message: "valid XML name, invalid QName" },
- { args: [null, "a::c"], code: 14, message: "valid XML name, invalid QName" },
- { args: ["http://example.com/", "a::c"], code: 14, message: "valid XML name, invalid QName" },
- { args: ["http://example.com/", "a:0"], code: 5, message: "valid XML name, not a valid QName" },
- { args: ["http://example.com/", "0:a"], code: 5, message: "0 at start makes it not a valid XML name" },
- { args: ["http://example.com/", "a:_"] },
- { args: ["http://example.com/", "a:\u0BC6"], code: 14,
- message: "non-ASCII character after colon is CombiningChar, which is " +
- "NCNameChar but not (Letter | \"_\") so invalid at start of " +
- "NCName (but still a valid XML name, hence not INVALID_CHARACTER_ERR)" },
- { args: ["http://example.com/", "\u0BC6:a"], code: 5,
- message: "non-ASCII character after colon is CombiningChar, which is " +
- "NCNameChar but not (Letter | \"_\") so invalid at start of " +
- "NCName (Gecko chooses to throw NAMESPACE_ERR here, but either is valid " +
- "as this is both an invalid XML name and an invalid QName)" },
- { args: ["http://example.com/", "a:a\u0BC6"] },
- { args: ["http://example.com/", "a\u0BC6:a"] },
- { args: ["http://example.com/", "xml:test"], code: 14, message: "binding xml prefix wrong" },
- { args: ["http://example.com/", "xmlns:test"], code: 14, message: "binding xmlns prefix wrong" },
- { args: ["http://www.w3.org/2000/xmlns/", "x:test"], code: 14, message: "binding namespace namespace to wrong prefix" },
- { args: ["http://www.w3.org/2000/xmlns/", "xmlns:test"] },
- { args: ["http://www.w3.org/XML/1998/namespace", "xml:test"] },
- { args: ["http://www.w3.org/XML/1998/namespace", "x:test"] },
- { args: ["http://www.w3.org/2000/xmlns/", "xmlns"] }, // See http://www.w3.org/2000/xmlns/
- { args: ["http://example.com/", "xmlns"], code: 14 }, // from the createAttributeNS section
-];
-
-function sourceify(v)
-{
- switch (typeof v) {
- case "undefined":
- return v;
-
- case "string":
- return '"' + v.replace('"', '\\"') + '"';
-
- default:
- return String(v);
- }
-}
-
-function runNSTests()
-{
- var createFunction = document.createAttributeNS;
- var createFunctionName = "createAttributeNS";
- var doc = document;
-
- for (var i = 0, sz = allNSTests.length; i < sz; i++) {
- var test = allNSTests[i];
-
- var code = -1;
- var argStr = sourceify(test.args[0]) + ", " + sourceify(test.args[1]);
- var msg = createFunctionName + "(" + argStr + ")";
- if ("message" in test)
- msg += "; " + test.message;
- try {
- createFunction.apply(doc, test.args);
- assert(!("code" in test), msg);
- } catch (e) {
- assertExceptionCode(e, test.code || "expected no exception", msg);
- }
- }
-}
-
-// Moz throws a "Not enough arguments" exception in these, we don't:
-shouldBeEqualToString("document.createAttributeNS().toString()", "[object Attr]");
-shouldBeEqualToString("document.createAttributeNS(\"http://www.example.com\").toString()", "[object Attr]");
-
-runNSTests();

Powered by Google App Engine
This is Rietveld 408576698