Index: third_party/WebKit/LayoutTests/scrollbars/scrollable-iframe-click-gets-focus.html |
diff --git a/third_party/WebKit/LayoutTests/scrollbars/scrollable-iframe-click-gets-focus.html b/third_party/WebKit/LayoutTests/scrollbars/scrollable-iframe-click-gets-focus.html |
index 2b0b595210422fde0ef77881735031f703549e64..211f3879d1ab4be90fe28ef3b3b536ff86b16024 100644 |
--- a/third_party/WebKit/LayoutTests/scrollbars/scrollable-iframe-click-gets-focus.html |
+++ b/third_party/WebKit/LayoutTests/scrollbars/scrollable-iframe-click-gets-focus.html |
@@ -1,33 +1,24 @@ |
<!DOCTYPE html> |
-<input id='textField' type='text' style="position:relative;"> <br> |
-<iframe onload="runTest();" id="anIFrame" style="left:50px;width:200px;height:200px;position:absolute;" src="resources/scrollable-iframe-with-click-strip.html"> </iframe> |
-<script src="../resources/js-test.js"></script> |
+<title>For the bug that click on the green strip in the scrollable iframe will not make the iframe get the focus. crbug.com/531929</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<input type='text' style="position: relative;"> <br> |
+<iframe style="left: 50px; width: 200px; height: 200px; position: absolute;" src="resources/scrollable-iframe-with-click-strip.html"> </iframe> |
<script> |
+async_test(function(t) { |
+ var iframe = document.querySelector("iframe"); |
+ iframe.onload = t.step_func_done(function() { |
+ document.querySelector("input").focus(); |
+ var strip = iframe.contentDocument.getElementById("strip"); |
-setPrintTestResultsLazily(); |
-description("For the bug that click on the green strip in the scrollable iframe will not make the iframe get the focus. crbug.com/531929") |
+ var x = iframe.offsetLeft + strip.offsetLeft + 5; |
+ var y = iframe.offsetTop + 5; |
-window.jsTestIsAsync = true; |
- |
-function runTest() { |
- document.getElementById("textField").focus(); |
- if (window.eventSender) { |
- var frame = document.getElementById("anIFrame"); |
- var frame_doc = window.frames[0].document; |
- var strip = frame_doc.getElementById("strip"); |
- |
- var x = frame.offsetLeft + strip.offsetLeft + 5; |
- var y = frame.offsetTop + 5; |
- |
- // send mouse event to click iframe's green strip; |
- eventSender.mouseMoveTo(x, y); |
- eventSender.mouseDown(); |
- eventSender.mouseUp(); |
- if (window.frames[0].document.hasFocus()) |
- debug("PASS"); |
- else |
- debug("FAIL"); |
- } |
- finishJSTest(); |
-} |
+ // send mouse event to click iframe's green strip; |
+ eventSender.mouseMoveTo(x, y); |
+ eventSender.mouseDown(); |
+ eventSender.mouseUp(); |
+ assert_true(iframe.contentDocument.hasFocus()); |
+ }); |
+}); |
</script> |