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

Unified Diff: third_party/WebKit/LayoutTests/fast/events/page-visibility-iframe-unload.html

Issue 1778753003: Fire visibilitychange event on unload (behind the flag) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 4 years, 9 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/fast/events/page-visibility-iframe-unload.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/page-visibility-iframe-unload.html b/third_party/WebKit/LayoutTests/fast/events/page-visibility-iframe-unload.html
new file mode 100644
index 0000000000000000000000000000000000000000..d709bbee224c3c70d366f185b599aac1fc4540e4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/page-visibility-iframe-unload.html
@@ -0,0 +1,40 @@
+<html>
+<body>
+<script src="../../resources/js-test.js"></script>
+<script>
+description("This test checks that the page visibility event is fired when frame is unloaded.");
+
+var jsTestIsAsync = true;
+var frameDocs = [];
+var docsLoaded = 0;
+var numFrames = 3;
+
+function startTest() {
+ if (++docsLoaded < numFrames)
+ return;
+
+ debug("Loaded all frames.");
+
+ frameDocs.push(window[0].document);
+ frameDocs.push(window[0][0].document);
+ frameDocs.push(window[0][1].document);
+
+ for (var i = 0; i < frameDocs.length; ++i) {
+ frameDocs[i].addEventListener(
+ "visibilitychange",
+ onVisibilityChange.bind(null, i), false);
+ }
+
+ document.body.removeChild(document.getElementById("frame1"));
+
+ finishJSTest();
+}
+
+function onVisibilityChange(i) {
+ shouldBe('frameDocs[' + i + '].visibilityState', '"hidden"');
+}
+
+</script>
+<iframe id="frame1" src="resources/page-visibility-iframe-with-subframes.html"></iframe>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698