chromium/third_party/blink/web_tests/shadow-dom/event-composed-ua.html

<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../resources/gesture-util.js"></script>
<script src="../resources/testdriver.js"></script>
<script src="../resources/testdriver-actions.js"></script>
<script src="../resources/testdriver-vendor.js"></script>

<form>
  <input id="input" type="text">
  <input id="input2">
</form>

<script>
const input = document.querySelector('#input');
const input2 = document.querySelector('#input2');

const composedEventTypes = [
  // UI Events
  'blur', 'focus', 'focusin', 'focusout',
  'dblclick',
  'wheel',
  'beforeinput', 'input',
  'keydown', 'keyup',
  'compositionstart', 'compositionupdate', 'compositionend',
  // Legacy UI Events
  'DOMActivate', 'DOMFocusIn', 'DOMFocusOut', 'keypress',
  // The following events are covered elsewhere in web_tests:
  // - Mouse Events: wpt/uievents/mouse/attributes.html
  // - Pointer Events: wpt/pointerevents/pointerevent_*_is_a_pointerevent.html
  //       and wpt/pointerevents/pointerevent_attributes_*hover*_pointers.html
  // - Touch Events: fast/events/touch/basic-single-touch-events.html
];

promise_test( async (t) => {

  let received_events = new Set();

  for (const eventType of composedEventTypes) {
    input.addEventListener(eventType, t.step_func((e) => {
      received_events.add(eventType);
      assert_true(e.composed, `A ${eventType} event should be a composed event`);
    }));
  }

  await mouseClickOn(input.offsetLeft, input.offsetTop);
  await mouseDoubleClickOn(input.offsetLeft, input.offsetTop);

  input.blur();
  input.focus();
  input.blur();

  // For keypress
  input.focus();
  await new test_driver.send_keys(input, ' ');

  // For wheel event
  await smoothScrollWithXY(1, 2, input.offsetLeft + 5, input.offsetTop +5, GestureSourceType.MOUSE_INPUT);

  // For composition
  input.focus();
  textInputController.setMarkedText('1', 0, 1);
  textInputController.insertText('1');

  await waitUntil( () => {return received_events.size == composedEventTypes.length;} );

}, "Checked composed bit for events");

</script>