Chromium Code Reviews| Index: content/test/data/android/input/input_forms.html |
| diff --git a/content/test/data/android/input/input_forms.html b/content/test/data/android/input/input_forms.html |
| index 797a393be5191197e5297d323627aa962d26f12b..8f35138950196b6aa85e4fb8fd6264eb5ac13bd0 100644 |
| --- a/content/test/data/android/input/input_forms.html |
| +++ b/content/test/data/android/input/input_forms.html |
| @@ -25,7 +25,8 @@ |
| <a id="link" href="about:blank">hello</a> |
| <script> |
| -var log = ""; |
| +var selectionChangeEventLog = ""; |
| +var otherEventLog = ""; |
| var mutationObserver = new MutationObserver(function(mutations) { |
| mutations.forEach(function(mutation) { |
| addEventLog(mutation.type, mutation.detail); |
| @@ -34,36 +35,52 @@ var mutationObserver = new MutationObserver(function(mutations) { |
| var mutationConfig = { attributes: false, childList: false, characterData: true }; |
| -function addEventLog(type, detail) { |
| - if (log.length > 0) { |
| - log += ','; |
| +function addOtherEventLog(type, detail) { |
| + if (otherEventLog.length > 0) { |
| + otherEventLog += ','; |
| } |
| if (detail == null) { |
| - log += type; |
| + otherEventLog += type; |
| } else { |
| - log += type + '(' + detail + ')'; |
| + otherEventLog += type + '(' + detail + ')'; |
| } |
| } |
| +function addSelectionChangeEventLog(type, detail) { |
| + if (selectionChangeEventLog.length > 0) { |
| + selectionChangeEventLog += ','; |
| + } |
| + if (detail == null) { |
| + selectionChangeEventLog += type; |
| + } else { |
| + selectionChangeEventLog += type + '(' + detail + ')'; |
| + } |
| +} |
| + |
| +// selectionchange event is queued, so it's delayed and comes after other events incorrectly. |
|
aelias_OOO_until_Jul13
2016/11/04 03:40:07
I'd rephrase this "so it races with the other even
yabinh
2016/11/04 03:49:09
Done.
|
| +// crbug.com/628964 |
| function getEventLogs() { |
| - return log; |
| + if (otherEventLog.length > 0 && selectionChangeEventLog.length > 0) |
| + return otherEventLog + ',' + selectionChangeEventLog; |
| + return otherEventLog + selectionChangeEventLog; |
| } |
| function clearEventLogs() { |
| - log = ''; |
| + selectionChangeEventLog = ''; |
| + otherEventLog = ''; |
| } |
| function addEventListener(element, event_name) { |
| - element.addEventListener(event_name, function (e) { addEventLog(event_name, e.data); }); |
| + element.addEventListener(event_name, function (e) { addOtherEventLog(event_name, e.data); }); |
| } |
| function addKeyEventListener(element, event_name) { |
| - element.addEventListener(event_name, function (e) { addEventLog(event_name, e.keyCode); }); |
| + element.addEventListener(event_name, function (e) { addOtherEventLog(event_name, e.keyCode); }); |
| } |
| function addSelectionEventListener(event_name) { |
| // Note that listeners added to the element are not effective for now. |
| - document.addEventListener(event_name, function (e) { addEventLog(event_name, e.data); }); |
| + document.addEventListener(event_name, function (e) { addSelectionChangeEventLog(event_name, e.data); }); |
| } |
| function registerListenersAndObserver(element) { |