Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-close-event.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-close-event.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-close-event.html |
| index def58eae81d3b9014b3394cf7bd6f5188c5c3c31..ca843ec67b452fb5b481c37d6563050e4da9e451 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-close-event.html |
| +++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-close-event.html |
| @@ -7,6 +7,7 @@ |
| <dialog></dialog> |
| <script> |
| description("Test that dialog receives a close event upon closing."); |
| +jsTestIsAsync = true; |
| document.addEventListener('close', function(event) { |
| testFailed("The 'close' event unexpectedly bubbled."); |
| @@ -16,16 +17,20 @@ closedCount = 0; |
| dialog = document.querySelector('dialog'); |
| dialog.addEventListener('close', function(event) { |
| closedCount++; |
| - self = this; |
| - shouldBe('self', 'dialog'); |
| + selfDialog = this; |
|
hiroshige
2016/09/29 10:46:00
|self| is renamed because it conflicts with js-tes
|
| + shouldBe('selfDialog', 'dialog'); |
| shouldBeFalse('dialog.open'); |
| shouldBeFalse('event.cancelable'); |
| event.preventDefault(); |
| - if (closedCount < 2) { |
| + if (closedCount == 1) { |
| dialog.show(); |
| dialog.close(); |
| - }; |
| + // dialog's close event handler shouldn't be called synchronously. |
| + shouldBe('closedCount', '1'); |
| + } else if (closedCount == 2) { |
| + finishJSTest(); |
| + } |
| }); |
| dialog.show(); |
| @@ -33,8 +38,9 @@ dialog.close(); |
| // Verify that preventDefault() didn't cancel closing. |
| shouldBeFalse('dialog.open'); |
| -// FIXME: This should be removed. |
| -// shouldBe('closedCount', '2'); |
| + |
| +// dialog's close event handler shouldn't be called synchronously. |
| +shouldBe('closedCount', '0'); |
| </script> |
| </body> |
| </html> |