Index: third_party/WebKit/LayoutTests/fast/dom/inert/inert-focus-in-frames.html |
diff --git a/third_party/WebKit/LayoutTests/fast/dom/inert/inert-focus-in-frames.html b/third_party/WebKit/LayoutTests/fast/dom/inert/inert-focus-in-frames.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..01b9271b03eff1a6c7e8c62ae1744d1ccda07b23 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/dom/inert/inert-focus-in-frames.html |
@@ -0,0 +1,55 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+</head> |
+<body> |
+ |
+<div inert> |
+<iframe height=400 width=600 id="main-iframe"> |
+<frameset rows="*" cols="50,50"> |
+ <frame src="resources/inert-focus-in-frames-frame1.html"> |
+ <frame src='data:text/html,<div id="frame2-div" class="target" tabindex="0">Hello</div>'> |
+</frameset> |
+</iframe> |
+</div> |
+ |
+<script> |
+setup({ explicit_done: true }); |
+ |
+framesLoaded = 0; |
+numFrames = 4; |
+var mainIframe = document.getElementById('main-iframe'); |
+ |
+function frameLoaded() { |
+ framesLoaded++; |
+ if (framesLoaded == numFrames) { |
+ test(function() { |
+ var frame1 = mainIframe.contentWindow.frames[0].document; |
+ var target1 = frame1.querySelector('.target'); |
+ testCantFocus(target1); |
+ var iframe = frame1.querySelector('iframe').contentDocument; |
+ testCantFocus(iframe.querySelector('.target')); |
+ }, "Focus can't go into frames or iframes in inert subtree"); |
+ done(); |
+ } |
+} |
+ |
+function testCantFocus(element) { |
+ focusedElement = null; |
+ element.addEventListener('focus', function() { focusedElement = element; }, false); |
+ element.focus(); |
+ theElement = element; |
+ assert_false(focusedElement === theElement); |
+} |
+ |
+mainIframe.contentDocument.write(mainIframe.textContent); |
+mainIframe.contentDocument.close(); |
+ |
+mainIframe.contentWindow.frames[1].window.onload = frameLoaded; |
+ |
+window.onload = frameLoaded; |
+</script> |
+</body> |
+</html> |