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

Unified Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/custom-elements/v0/custom-element-lifecycle/types-of-callbacks/detached-callback-no-browsing-context-test.html

Issue 1984023002: Move web-platform-tests to wpt (part 1 of 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/imported/web-platform-tests/custom-elements/v0/custom-element-lifecycle/types-of-callbacks/detached-callback-no-browsing-context-test.html
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/custom-elements/v0/custom-element-lifecycle/types-of-callbacks/detached-callback-no-browsing-context-test.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/custom-elements/v0/custom-element-lifecycle/types-of-callbacks/detached-callback-no-browsing-context-test.html
deleted file mode 100644
index 09d3d7690cd5f509080b303498201fca32bd96ec..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/custom-elements/v0/custom-element-lifecycle/types-of-callbacks/detached-callback-no-browsing-context-test.html
+++ /dev/null
@@ -1,147 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title>Detached callback of a custom element should not be called if document has no browsing context</title>
-<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
-<meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
-<meta name="assert" content="detached callback ... must be enqueued whenever custom element is removed from the document and this document has a browsing context.">
-<link rel="help" href="http://www.w3.org/TR/custom-elements/#types-of-callbacks">
-<script src="../../../../../../resources/testharness.js"></script>
-<script src="../../../../../../resources/testharnessreport.js"></script>
-<script src="../../testcommon.js"></script>
-</head>
-<body>
-<div id="log"></div>
-<script>
-test(function() {
- var doc = newHTMLDocument();
- var proto = newHTMLElementPrototype();
- doc.registerElement('x-a', {prototype: proto});
- doc.body.innerHTML = '<x-a id="x-a"></x-a>';
- var customElement = doc.querySelector('#x-a');
- doc.body.removeChild(customElement);
-
- assert_equals(proto.detachedCallbackCalledCounter, 0,
- 'Callback detached should not be called if the document has no browsing context');
-}, 'Test detached callback if custom element is created via innerHTML property. ' +
- 'Document has no browsing context');
-
-
-test(function() {
- var doc = newHTMLDocument();
- var proto = newHTMLElementPrototype();
- doc.body.innerHTML = '<x-b id="x-b"></x-b>';
- doc.registerElement('x-b', {prototype: proto});
- var customElement = doc.querySelector('#x-b');
- doc.body.removeChild(customElement);
-
- assert_equals(proto.detachedCallbackCalledCounter, 0,
- 'Callback detached should not be called if the document has no browsing context');
-}, 'Test detached callback if custom element is via innerHTML property before ' +
- 'registration of a custom element. Document has no browsing context');
-
-
-test(function() {
- var doc = newHTMLDocument();
- doc.body.innerHTML = '<x-c id="x-c"></x-c>';
- var customElement = doc.querySelector('#x-c');
-
- var proto = newHTMLElementPrototype();
- customElement.constructor.prototype = proto;
- doc.body.removeChild(customElement);
-
- assert_equals(proto.detachedCallbackCalledCounter, 0,
- 'Callback detached should not be called if the document has no browsing context');
-}, 'Test detached callback if custom element is unregistered. ' +
- 'Document has no browsing context');
-
-
-test(function() {
- var doc = newHTMLDocument();
- var proto = newHTMLElementPrototype();
-
- doc.registerElement('x-d', {prototype: proto});
- doc.body.innerHTML = '<x-d id="x-d"></x-d>';
- doc.body.innerHTML = '';
-
- assert_equals(proto.detachedCallbackCalledCounter, 0,
- 'Callback detached should not be called if the document has no browsing context');
-}, 'Test detached callback if removing custom element via innerHTML property. ' +
- 'Document has no browsing context');
-
-
-test(function() {
- var doc = newHTMLDocument();
- var proto = newHTMLElementPrototype();
-
- doc.registerElement('x-e', {prototype: proto});
- doc.body.innerHTML = '<div id="customParent"><x-e id="x-e"></x-e></div>';
- var parent = doc.querySelector('#customParent');
- doc.body.removeChild(parent);
-
- assert_equals(proto.detachedCallbackCalledCounter, 0,
- 'Callback detached should not be called if the document has no browsing context');
-}, 'Test detached callback if removing perent of custom element. ' +
- 'Document has no browsing context');
-
-
-test(function() {
- var doc = newHTMLDocument();
- var proto = newHTMLElementPrototype();
-
- doc.registerElement('x-f', {prototype: proto});
- doc.body.innerHTML = '<div><x-f id="x-f"></x-f></div>';
- doc.body.innerHTML = '';
-
- assert_equals(proto.detachedCallbackCalledCounter, 0,
- 'Callback detached should not be called if the document has no browsing context');
-}, 'Test detached callback if removing perent of custom element via innerHTML property. ' +
- 'Document has no browsing context');
-
-
-var loseBrowsingContextTest = async_test('Test detached callback is not called ' +
- 'if document lose browsing context and custom element is removed');
-
-loseBrowsingContextTest.step(function() {
- var iframe = newIFrame('../../resources/x-element.html');
- iframe.onload = loseBrowsingContextTest.step_func(function(){
- var doc = iframe.contentDocument;
- var proto = newHTMLElementPrototype();
- doc.registerElement('x-element', {prototype: proto});
-
- var customElement = doc.querySelector('#x-element');
- iframe.remove();
- customElement.remove();
-
- assert_equals(proto.detachedCallbackCalledCounter, 0,
- 'Callback detached should not be called if the document has no browsing context');
- loseBrowsingContextTest.done();
- });
-});
-
-
-var navigateTest = async_test('Test detached callback is not called, ' +
- 'if document\'s window is navigated to another document and custom element is removed');
-
-navigateTest.step(function() {
- var iframe = newIFrame('../../resources/x-element.html');
- iframe.onload = navigateTest.step_func(function() {
- var doc = iframe.contentDocument;
- var proto = newHTMLElementPrototype();
- doc.registerElement('x-element', {prototype: proto});
- customElement = doc.querySelector('#x-element');
-
- iframe.onload = navigateTest.step_func(function() {
- customElement.remove();
- assert_equals(proto.detachedCallbackCalledCounter, 0,
- 'Callback detached should not be called ' +
- 'if the document has no browsing context');
- navigateTest.done();
- iframe.remove();
- });
- iframe.src = '../../resources/blank.html';
- });
-});
-</script>
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698