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

Unified Diff: LayoutTests/fast/events/event-trusted.html

Issue 1233233003: Add Event.isTrusted support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master_event_trusted_main2
Patch Set: Fix nits Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/events/event-trusted-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/events/event-trusted.html
diff --git a/LayoutTests/fast/events/event-trusted.html b/LayoutTests/fast/events/event-trusted.html
new file mode 100644
index 0000000000000000000000000000000000000000..2dc9f116271e40aaac765ff0a18fb238cba8c76f
--- /dev/null
+++ b/LayoutTests/fast/events/event-trusted.html
@@ -0,0 +1,46 @@
+<input id="clitty-click" type="checkbox"/>
+<div id="console"/>
+<script src="../../resources/js-test.js"></script>
+<script>
+description("This tests that isTrusted returns the correct value under certain situations.")
+
+var redispatched = false;
+
+function createAndInitEvent() {
+ var e = document.createEvent('Event');
+ e.initEvent(false, false, false);
+ return e;
+}
+
+shouldBeFalse("document.createEvent('Event').isTrusted");
+shouldBeFalse("createAndInitEvent().isTrusted");
+
+function originalDispatch(e) {
+ originalEvent = e;
+}
+
+function redispatch(e) {
+ redispatched = true;
+}
+
+var element = document.getElementById("clitty-click");
+if (window.eventSender) {
+ element.addEventListener('click', originalDispatch);
+ element.addEventListener('focus', function (e) {
+ event = e;
+ shouldBeTrue("event.isTrusted");
+ });
+ eventSender.mouseMoveTo(element.offsetLeft, element.offsetTop);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+
+ shouldBeTrue("originalEvent.isTrusted");
+ element.removeEventListener('click', originalDispatch);
+ element.addEventListener('click', redispatch);
+
+ element.dispatchEvent(originalEvent);
+ shouldBeTrue("redispatched");
+ shouldBeFalse("originalEvent.isTrusted");
+}
+
+</script>
« no previous file with comments | « no previous file | LayoutTests/fast/events/event-trusted-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698