Revision 5e7c87421195305ab688dd53dae61ae131609773 authored by Conley Owens on 04 April 2018, 18:03:08 UTC, committed by Chromium WPT Sync on 04 April 2018, 18:03:08 UTC
This change uses AllResponsesConsumed in the bluetooth Web Platform
Tests in order to make sure we have consumed all the anticipatory
responses that we've set on our fakes.

BUG=569709

Change-Id: I9767792fcd5dda71fabf2f8941638f744aefa2dc
Reviewed-on: https://chromium-review.googlesource.com/988422
Commit-Queue: Conley Owens <cco3@chromium.org>
Reviewed-by: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548125}
1 parent 6a7101f
Raw File
Event-propagation.html
<!doctype html>
<title>Event propagation tests</title>
<link rel=author title="Aryeh Gregor" href=ayg@aryeh.name>
<div id=log></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
"use strict";

function testPropagationFlag(ev, expected, desc) {
  test(function() {
    var called = false;
    var callback = function() { called = true };
    this.add_cleanup(function() {
      document.head.removeEventListener("foo", callback)
    });
    document.head.addEventListener("foo", callback);
    document.head.dispatchEvent(ev);
    assert_equals(called, expected, "Propagation flag");
    // dispatchEvent resets the propagation flags so it will happily dispatch
    // the event the second time around.
    document.head.dispatchEvent(ev);
    assert_equals(called, true, "Propagation flag after first dispatch");
  }, desc);
}

var ev = document.createEvent("Event");
ev.initEvent("foo", true, false);
testPropagationFlag(ev, true, "Newly-created Event");
ev.stopPropagation();
testPropagationFlag(ev, false, "After stopPropagation()");
ev.initEvent("foo", true, false);
testPropagationFlag(ev, true, "Reinitialized after stopPropagation()");

var ev = document.createEvent("Event");
ev.initEvent("foo", true, false);
ev.stopImmediatePropagation();
testPropagationFlag(ev, false, "After stopImmediatePropagation()");
ev.initEvent("foo", true, false);
testPropagationFlag(ev, true, "Reinitialized after stopImmediatePropagation()");

var ev = document.createEvent("Event");
ev.initEvent("foo", true, false);
ev.cancelBubble = true;
testPropagationFlag(ev, false, "After cancelBubble=true");
ev.initEvent("foo", true, false);
testPropagationFlag(ev, true, "Reinitialized after cancelBubble=true");
</script>
back to top