Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / event-trusted.html
blobccc0fdcf37b5a0faec077877f2ccfdb82c4332db
1 <input id="clitty-click" type="checkbox"/>
2 <div id="console"/>
3 <script src="../../resources/js-test.js"></script>
4 <script>
5 description("This tests that isTrusted returns the correct value under certain situations.")
7 var redispatched = false;
9 function createAndInitEvent() {
10 var e = document.createEvent('Event');
11 e.initEvent(false, false, false);
12 return e;
15 shouldBeFalse("document.createEvent('Event').isTrusted");
16 shouldBeFalse("createAndInitEvent().isTrusted");
18 function originalDispatch(e) {
19 originalEvent = e;
22 function redispatch(e) {
23 redispatched = true;
26 var element = document.getElementById("clitty-click");
27 if (window.eventSender) {
28 element.addEventListener('click', originalDispatch);
29 element.addEventListener('focus', function (e) {
30 event = e;
31 shouldBeTrue("event.isTrusted");
32 });
33 eventSender.mouseMoveTo(element.offsetLeft, element.offsetTop);
34 eventSender.mouseDown();
35 eventSender.mouseUp();
37 shouldBeTrue("originalEvent.isTrusted");
38 element.removeEventListener('click', originalDispatch);
39 element.addEventListener('click', redispatch);
41 element.dispatchEvent(originalEvent);
42 shouldBeTrue("redispatched");
43 shouldBeFalse("originalEvent.isTrusted");
45 originalEvent = null;
46 element.removeEventListener('click', redispatch);
47 element.addEventListener('click', originalDispatch);
48 element.click();
49 shouldBeFalse("originalEvent.isTrusted");
52 </script>