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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/inputevents/beforeinput-remove-iframe-crash.html

Issue 2374743002: [InputEvent] Support |deleteByDrag|, |insertFromDrop| and fire in sequential order (Closed)
Patch Set: Yosin's review 2 Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>InputEvent: beforeinput shouldn't crash in removed iframe</title> 4 <title>InputEvent: beforeinput shouldn't crash in removed iframe</title>
5 <script src="../../../resources/testharness.js"></script> 5 <script src="../../../resources/testharness.js"></script>
6 <script src="../../../resources/testharnessreport.js"></script> 6 <script src="../../../resources/testharnessreport.js"></script>
7 </head> 7 </head>
8 <body> 8 <body>
9 <script> 9 <script>
10 test(function() { 10 test(function() {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 testBeforeInputCrash(2, () => { 59 testBeforeInputCrash(2, () => {
60 eventSender.keyDown('a'); 60 eventSender.keyDown('a');
61 testRunner.execCommand('undo'); 61 testRunner.execCommand('undo');
62 }, 'Testing undo'); 62 }, 'Testing undo');
63 testBeforeInputCrash(3, () => { 63 testBeforeInputCrash(3, () => {
64 eventSender.keyDown('a'); 64 eventSender.keyDown('a');
65 testRunner.execCommand('undo'); 65 testRunner.execCommand('undo');
66 testRunner.execCommand('redo'); 66 testRunner.execCommand('redo');
67 }, 'Testing redo'); 67 }, 'Testing redo');
68 }, 'Testing beforeinput in removed iframe'); 68 }, 'Testing beforeinput in removed iframe');
69
70 async_test(function(t) {
71 assert_not_equals(window.eventSender, undefined, 'This test requires eventSe nder.');
72 assert_not_equals(window.testRunner, undefined, 'This test requires testRunn er.');
73
74 function simulateDragDrop(dragElement, dropElement) {
75 eventSender.mouseMoveTo(dragElement.offsetLeft + dragElement.offsetWidth / 2,
76 dragElement.offsetTop + dragElement.offsetHeight / 2);
77 eventSender.mouseDown();
78 eventSender.leapForward(100);
79 eventSender.mouseMoveTo(dropElement.offsetLeft + dropElement.offsetWidth / 2,
80 dropElement.offsetTop + dropElement.offsetHeight / 2);
81 eventSender.mouseUp();
82 }
83
84 function testDragDropCrash(inputTypeToCrash, comments, next) {
85 const iframe = document.createElement('iframe');
86 iframe.src = '../resources/beforeinput-remove-iframe-crash-iframe.html';
87 iframe.onload = t.step_func(() => {
88 var didFireInputTypeToCrash = false;
89 const childDocument = iframe.contentDocument;
90 const editable1 = childDocument.getElementById('editable1');
91 const editable2 = childDocument.getElementById('editable2');
92 childDocument.addEventListener('beforeinput', event => {
93 if (event.inputType == inputTypeToCrash) {
94 didFireInputTypeToCrash = true;
95 if (iframe.parentNode)
96 iframe.remove();
97 }
98 });
99
100 simulateDragDrop(editable1, editable2);
101
102 if (iframe.parentNode)
103 iframe.remove();
104 assert_true(didFireInputTypeToCrash, comments);
105 next();
106 });
107 document.body.appendChild(iframe);
108 }
109
110 // Test Drag&Drop.
111 t.step(() => testDragDropCrash('deleteByDrag', 'Testing deleteByDrag',
112 () => testDragDropCrash('insertFromDrop', 'Testing insertFromDrop',
113 () => t.done())));
114 }, 'Testing beforeinput for Drag&Drop in removed iframe');
69 </script> 115 </script>
70 </body> 116 </body>
71 </html> 117 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698