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

Unified Diff: LayoutTests/fast/frames/sandboxed-iframe-autofocus-denied.html

Issue 314393002: Unflake sandboxed-iframe-autofocus-denied.html. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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: LayoutTests/fast/frames/sandboxed-iframe-autofocus-denied.html
diff --git a/LayoutTests/fast/frames/sandboxed-iframe-autofocus-denied.html b/LayoutTests/fast/frames/sandboxed-iframe-autofocus-denied.html
index 9ffa2e05ee9ab19a2b0ea76f866a4dc9d184573f..282b6057b481c1c2a17c3976f8264d2d2706d1f5 100644
--- a/LayoutTests/fast/frames/sandboxed-iframe-autofocus-denied.html
+++ b/LayoutTests/fast/frames/sandboxed-iframe-autofocus-denied.html
@@ -2,24 +2,42 @@
<html>
<head>
<script>
- if (window.testRunner)
- testRunner.dumpAsText();
+ function fail()
+ {
+ console.log("FAIL: The input element is focused.");
+ }
- function test() {
- activeTag = document.querySelector('iframe').contentWindow.document.activeElement.tagName;
+ function finishTest()
+ {
+ var activeTag = document.querySelector('iframe').contentDocument.activeElement.tagName;
if (activeTag == "INPUT")
console.log("FAIL: The input element is focused.");
else
console.log("PASS: The input element is not focused.");
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+
+ function runTest()
+ {
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+ var frameDocument = document.querySelector('iframe').contentDocument;
+ var autofocusInput = frameDocument.createElement('input');
+ autofocusInput.autofocus = true;
+ autofocusInput.onfocus = fail;
+ frameDocument.body.appendChild(autofocusInput);
+ frameDocument.body.offsetTop;
+ window.setTimeout(finishTest, 0);
}
</script>
</head>
-<body>
+<body onload="runTest()">
<p>This test passes if the input element in the sandboxed frame is not
automatically focused upon, as it should be blocked by the sandboxed
scripts flag. A console warning to that effect should also be present.</p>
- <iframe sandbox="allow-same-origin"
- onload="test()"
- srcdoc="<input autofocus onfocus>"></iframe>
+ <iframe sandbox="allow-same-origin"></iframe>
</body>
</html>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/frames/sandboxed-iframe-autofocus-denied-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698