Chromium Code Reviews| 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"> |
|
esprehn
2017/02/07 23:50:59
iframe doesn't accept children, I'm not sure I und
aboxhall
2017/02/08 05:26:01
Copied from the more or less identical dialog test
|
| +<frameset rows="*" cols="50,50"> |
|
esprehn
2017/02/07 23:50:59
frameset isn't valid here, what are you testing?
aboxhall
2017/02/08 05:26:01
See previous comment.
|
| + <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> |