Commit c25531b2 authored by Yifan Luo's avatar Yifan Luo Committed by Chromium LUCI CQ

[Sanitizer API] Add test for general customed elements

Bug: 1116418
Change-Id: I4753f5f077a861501088ce6797d99402de4558de
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2574637Reviewed-by: default avatarYifan Luo <lyf@chromium.org>
Reviewed-by: default avatarDaniel Vogelheim <vogelheim@chromium.org>
Commit-Queue: Yifan Luo <lyf@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833766}
parent 05af4c5a
This is a testharness.js-based test.
Found 106 tests; 103 PASS, 3 FAIL, 0 TIMEOUT, 0 NOTRUN.
Found 109 tests; 106 PASS, 3 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS SanitizerAPI sanitize function without argument should throw an error.
PASS SanitizerAPI sanitize function for null.
PASS SanitizerAPI with config: string, sanitize from string function for string
......@@ -18,6 +18,7 @@ PASS SanitizerAPI with config: onclick scripts, sanitize from string function fo
PASS SanitizerAPI with config: invalid config_input, sanitize from string function for invalid config_input
PASS SanitizerAPI with config: empty dropElements list, sanitize from string function for empty dropElements list
PASS SanitizerAPI with config: test html without close tag with dropElements list ['div'], sanitize from string function for test html without close tag with dropElements list ['div']
PASS SanitizerAPI with config: test custom element with dropElements list ['div'], sanitize from string function for test custom element with dropElements list ['div']
PASS SanitizerAPI with config: test script with ["script"] as dropElements list, sanitize from string function for test script with ["script"] as dropElements list
PASS SanitizerAPI with config: dropElements list ["test", "i"]}, sanitize from string function for dropElements list ["test", "i"]}
PASS SanitizerAPI with config: dropElements list ["I", "AM"]}, sanitize from string function for dropElements list ["I", "AM"]}
......@@ -52,6 +53,7 @@ PASS SanitizerAPI with config: onclick scripts, sanitize from document function
PASS SanitizerAPI with config: invalid config_input, sanitize from document function for invalid config_input
PASS SanitizerAPI with config: empty dropElements list, sanitize from document function for empty dropElements list
PASS SanitizerAPI with config: test html without close tag with dropElements list ['div'], sanitize from document function for test html without close tag with dropElements list ['div']
PASS SanitizerAPI with config: test custom element with dropElements list ['div'], sanitize from document function for test custom element with dropElements list ['div']
PASS SanitizerAPI with config: test script with ["script"] as dropElements list, sanitize from document function for test script with ["script"] as dropElements list
PASS SanitizerAPI with config: dropElements list ["test", "i"]}, sanitize from document function for dropElements list ["test", "i"]}
PASS SanitizerAPI with config: dropElements list ["I", "AM"]}, sanitize from document function for dropElements list ["I", "AM"]}
......@@ -86,6 +88,7 @@ PASS SanitizerAPI with config: onclick scripts, sanitize from document fragment
PASS SanitizerAPI with config: invalid config_input, sanitize from document fragment function for invalid config_input
PASS SanitizerAPI with config: empty dropElements list, sanitize from document fragment function for empty dropElements list
PASS SanitizerAPI with config: test html without close tag with dropElements list ['div'], sanitize from document fragment function for test html without close tag with dropElements list ['div']
PASS SanitizerAPI with config: test custom element with dropElements list ['div'], sanitize from document fragment function for test custom element with dropElements list ['div']
PASS SanitizerAPI with config: test script with ["script"] as dropElements list, sanitize from document fragment function for test script with ["script"] as dropElements list
PASS SanitizerAPI with config: dropElements list ["test", "i"]}, sanitize from document fragment function for dropElements list ["test", "i"]}
PASS SanitizerAPI with config: dropElements list ["I", "AM"]}, sanitize from document fragment function for dropElements list ["I", "AM"]}
......
This is a testharness.js-based test.
Found 104 tests; 101 PASS, 3 FAIL, 0 TIMEOUT, 0 NOTRUN.
Found 107 tests; 104 PASS, 3 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS SanitizerAPI sanitize function without argument should throw an error.
PASS SanitizerAPI sanitizeToString function for null.
PASS SanitizerAPI config: string, sanitizeToString from string function for string
......@@ -18,6 +18,7 @@ PASS SanitizerAPI config: onclick scripts, sanitizeToString from string function
PASS SanitizerAPI config: invalid config_input, sanitizeToString from string function for invalid config_input
PASS SanitizerAPI config: empty dropElements list, sanitizeToString from string function for empty dropElements list
PASS SanitizerAPI config: test html without close tag with dropElements list ['div'], sanitizeToString from string function for test html without close tag with dropElements list ['div']
PASS SanitizerAPI config: test custom element with dropElements list ['div'], sanitizeToString from string function for test custom element with dropElements list ['div']
PASS SanitizerAPI config: test script with ["script"] as dropElements list, sanitizeToString from string function for test script with ["script"] as dropElements list
PASS SanitizerAPI config: dropElements list ["test", "i"]}, sanitizeToString from string function for dropElements list ["test", "i"]}
PASS SanitizerAPI config: dropElements list ["I", "AM"]}, sanitizeToString from string function for dropElements list ["I", "AM"]}
......@@ -52,6 +53,7 @@ PASS SanitizerAPI with config: onclick scripts, sanitizeToString from document f
PASS SanitizerAPI with config: invalid config_input, sanitizeToString from document function for invalid config_input
PASS SanitizerAPI with config: empty dropElements list, sanitizeToString from document function for empty dropElements list
PASS SanitizerAPI with config: test html without close tag with dropElements list ['div'], sanitizeToString from document function for test html without close tag with dropElements list ['div']
PASS SanitizerAPI with config: test custom element with dropElements list ['div'], sanitizeToString from document function for test custom element with dropElements list ['div']
PASS SanitizerAPI with config: test script with ["script"] as dropElements list, sanitizeToString from document function for test script with ["script"] as dropElements list
PASS SanitizerAPI with config: dropElements list ["test", "i"]}, sanitizeToString from document function for dropElements list ["test", "i"]}
PASS SanitizerAPI with config: dropElements list ["I", "AM"]}, sanitizeToString from document function for dropElements list ["I", "AM"]}
......@@ -86,6 +88,7 @@ PASS SanitizerAPI with config: onclick scripts, sanitizeToString from document f
PASS SanitizerAPI with config: invalid config_input, sanitizeToString from document fragment function for invalid config_input
PASS SanitizerAPI with config: empty dropElements list, sanitizeToString from document fragment function for empty dropElements list
PASS SanitizerAPI with config: test html without close tag with dropElements list ['div'], sanitizeToString from document fragment function for test html without close tag with dropElements list ['div']
PASS SanitizerAPI with config: test custom element with dropElements list ['div'], sanitizeToString from document fragment function for test custom element with dropElements list ['div']
PASS SanitizerAPI with config: test script with ["script"] as dropElements list, sanitizeToString from document fragment function for test script with ["script"] as dropElements list
PASS SanitizerAPI with config: dropElements list ["test", "i"]}, sanitizeToString from document fragment function for dropElements list ["test", "i"]}
PASS SanitizerAPI with config: dropElements list ["I", "AM"]}, sanitizeToString from document fragment function for dropElements list ["I", "AM"]}
......
......@@ -15,6 +15,7 @@ const testcases = [
{config_input: {test: 123}, value: "test", result: "test", message: "invalid config_input"},
{config_input: {dropElements: []}, value: "test", result: "test", message: "empty dropElements list"},
{config_input: {dropElements: ["div"]}, value: "<div>test</div><c>bla", result: "<c>bla</c>", message: "test html without close tag with dropElements list ['div']"},
{config_input: {dropElements: ["customElement"]}, value: "<customElement>test</customElement>bla", result: "bla", message: "test custom element with dropElements list ['div']"},
{config_input: {dropElements: ["script"]}, value: "<script>alert('i am a test')<\/script>", result: "", message: "test script with [\"script\"] as dropElements list"},
{config_input: {dropElements: ["test", "i"]}, value: "<div>balabala<i>test</i></div><test>t</test>", result: "<div>balabala</div>", message: "dropElements list [\"test\", \"i\"]}"},
{config_input: {dropElements: ["I", "AM"]}, value: "<div>balabala<am>test</am></div>", result: "<div>balabala</div>", message: "dropElements list [\"I\", \"AM\"]}"},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment