| Index: third_party/WebKit/LayoutTests/intersection-observer/observer-exceptions.html
|
| diff --git a/third_party/WebKit/LayoutTests/intersection-observer/observer-exceptions.html b/third_party/WebKit/LayoutTests/intersection-observer/observer-exceptions.html
|
| index e41569c531b0ee0c02ff8dc3ede9abad1291e2cc..d5d95e3b59e3010fc90766a888d7a7e90c7728f3 100644
|
| --- a/third_party/WebKit/LayoutTests/intersection-observer/observer-exceptions.html
|
| +++ b/third_party/WebKit/LayoutTests/intersection-observer/observer-exceptions.html
|
| @@ -1,87 +1,48 @@
|
| <!DOCTYPE html>
|
| -<div id="root"></div>
|
| -<div id="target"></div>
|
| -<script src="../resources/js-test.js"></script>
|
| -<script src="../resources/gc.js"></script>
|
| -<script>
|
| - description("Test for observer exceptions.");
|
| - var exc;
|
| -
|
| - try {
|
| - new IntersectionObserver(e => {}, {threshold: [1.1]});
|
| - testFailed("IntersectionObserver constructor did not throw due to invalid threshold.");
|
| - } catch(e) {
|
| - exc = e;
|
| - shouldBeType("exc", "RangeError");
|
| - }
|
| -
|
| - try {
|
| - new IntersectionObserver(e => {}, {threshold: ["foo"]});
|
| - testFailed("IntersectionObserver constructor did not throw due to invalid threshold.");
|
| - } catch(e) {
|
| - exc = e;
|
| - shouldBeType("exc", "RangeError");
|
| - }
|
| -
|
| - try {
|
| - new IntersectionObserver(e => {}, {rootMargin: "1"});
|
| - testFailed("IntersectionObserver constructor did not throw due to invalid rootMargin.");
|
| - } catch(e) {
|
| - exc = e;
|
| - shouldBeType("exc", "DOMException");
|
| - shouldBe("exc.code", "DOMException.SYNTAX_ERR");
|
| - }
|
| -
|
| - try {
|
| - new IntersectionObserver(e => {}, {rootMargin: "2em"});
|
| - testFailed("IntersectionObserver constructor did not throw due to invalid rootMargin.");
|
| - } catch(e) {
|
| - exc = e;
|
| - shouldBeType("exc", "DOMException");
|
| - shouldBe("exc.code", "DOMException.SYNTAX_ERR");
|
| - }
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
|
|
| - try {
|
| - new IntersectionObserver(e => {}, {rootMargin: "auto"});
|
| - testFailed("IntersectionObserver constructor did not throw due to invalid rootMargin.");
|
| - } catch(e) {
|
| - exc = e;
|
| - shouldBeType("exc", "DOMException");
|
| - shouldBe("exc.code", "DOMException.SYNTAX_ERR");
|
| - }
|
| -
|
| - try {
|
| - new IntersectionObserver(e => {}, {rootMargin: "1px 1px 1px 1px 1px"});
|
| - testFailed("IntersectionObserver constructor did not throw due to too many rootMargin value.");
|
| - } catch(e) {
|
| - exc = e;
|
| - shouldBeType("exc", "DOMException");
|
| - shouldBe("exc.code", "DOMException.SYNTAX_ERR");
|
| - }
|
| -
|
| - let observer = new IntersectionObserver(c => {}, {});
|
| - try {
|
| +<script>
|
| +test(function () {
|
| + assert_throws(RangeError(), function() {
|
| + new IntersectionObserver(e => {}, {threshold: [1.1]})
|
| + })
|
| +}, "IntersectionObserver constructor with { threshold: [1.1] }");
|
| +
|
| +test(function () {
|
| + assert_throws(RangeError(), function() {
|
| + new IntersectionObserver(e => {}, {threshold: ["foo"]})
|
| + })
|
| +}, 'IntersectionObserver constructor with { threshold: ["foo"] }');
|
| +
|
| +test(function () {
|
| + assert_throws("SYNTAX_ERR", function() {
|
| + new IntersectionObserver(e => {}, {rootMargin: "1"})
|
| + })
|
| +}, 'IntersectionObserver constructor witth { rootMargin: "1" }');
|
| +
|
| +test(function () {
|
| + assert_throws("SYNTAX_ERR", function() {
|
| + new IntersectionObserver(e => {}, {rootMargin: "2em"})
|
| + })
|
| +}, 'IntersectionObserver constructor with { rootMargin: "2em" }');
|
| +
|
| +test(function () {
|
| + assert_throws("SYNTAX_ERR", function() {
|
| + new IntersectionObserver(e => {}, {rootMargin: "auto"})
|
| + })
|
| +}, 'IntersectionObserver constructor width { rootMargin: "auto" }');
|
| +
|
| +test(function () {
|
| + assert_throws("SYNTAX_ERR", function() {
|
| + new IntersectionObserver(e => {}, {rootMargin: "1px 1px 1px 1px 1px"})
|
| + })
|
| +}, 'IntersectionObserver constructor with { rootMargin: "1px 1px 1px 1px 1px" }');
|
| +
|
| +test(function () {
|
| + assert_throws(TypeError(), function() {
|
| + let observer = new IntersectionObserver(c => {}, {});
|
| observer.observe("foo");
|
| - testFailed("IntersectionObserver.observe with a bad target argument did not throw.");
|
| - } catch(e) {
|
| - exc = e;
|
| - shouldBeType("exc", "TypeError");
|
| - }
|
| -
|
| - // Initialize observer and remove root in an inner function to avoid
|
| - // references to rootDiv remaining live on this function's stack frame
|
| - // (http://crbug.com/595672/).
|
| - function initializeObserverThenRemoveRootDiv() {
|
| - let rootDiv = document.getElementById("root");
|
| - let observer = new IntersectionObserver(c => {}, {root: rootDiv});
|
| - rootDiv.parentNode.removeChild(rootDiv);
|
| - return observer;
|
| - }
|
| -
|
| - observer = initializeObserverThenRemoveRootDiv();
|
| - gc();
|
| - observer.observe(target);
|
| - observer.unobserve(target);
|
| - observer.disconnect();
|
| - shouldBeEqualToNumber("0", observer.takeRecords().length);
|
| + })
|
| +}, 'IntersectionObserver.observe("foo")');
|
| </script>
|
|
|