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..2f148ab5f9c1c2559648508add39cc2c721d2faf |
--- /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 frames = []; |
+var docsLoaded = 0, visibilityChanged = 0; |
+var numFrames = 3; |
+ |
+function startTest() { |
+ if (++docsLoaded < numFrames) |
+ return; |
+ |
+ debug("Loaded all frames."); |
+ |
+ frames.push(document.getElementById("frame1")); |
+ frames.push(frame1.contentDocument.getElementById("subIframe1")); |
+ frames.push(frame1.contentDocument.getElementById("subIframe2")); |
+ |
+ for (var i = 0; i < frames.length; ++i) { |
+ frames[i].contentDocument.addEventListener( |
+ "visibilitychange", |
+ onVisibilityChange.bind(null, i), false); |
+ } |
+ |
+ document.body.removeChild(frames[0]); |
+} |
+ |
+function onVisibilityChange(i) { |
+ shouldBe('frames[' + i + '].contentDocument.visibilityState', '"hidden"'); |
+ if (++visibilityChanged == numFrames) |
+ finishJSTest(); |
+} |
+ |
+</script> |
+<iframe id="frame1" src="resources/page-visibility-iframe-with-subframes.html"></iframe> |
+</body> |
+</html> |