Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / bogus-dropEffect-effectAllowed.html
blobcaf183f56be64a9e8e65708deb25fdc4cd7d3735
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 <style>
5 #dropTarget, #dragMe { text-align: center; display: table-cell; vertical-align: middle }
6 #dropTarget {width: 256px; height: 256px; border: 1px dashed}
7 #dragMe {-webkit-user-drag: element; -webkit-user-select: none; background: #ff0000; width: 64px; height: 64px; color: white}
8 </style>
9 <script>
10 var dragMe;
11 var dropTarget;
12 var effectAllowedElem;
13 var dropEffectElem;
14 var consoleElm;
15 var event;
17 window.onload = function()
19 dragMe = document.getElementById("dragMe");
20 dropTarget = document.getElementById("dropTarget");
21 consoleElm = document.getElementById("console");
23 if (!dragMe || !dropTarget || !consoleElm)
24 return;
26 dragMe.ondragstart = dragStart;
27 dragMe.ondragend = dragEnd;
29 dropTarget.ondragenter = dragEntered;
30 dropTarget.ondragover = dragOver;
31 dropTarget.ondrop = drop;
33 runTest();
36 function dragStart(e)
38 var validEffectAllowedList = ["all", "copy", "copyLink", "copyMove", "link", "linkMove", "move", "none", "uninitialized"];
39 var effectAllowedListToTest = ["all", "copy", "bogus", "copyLink", "wrong", "copyMove", "linkCopyMove", "link",
40 "linkMove", "move", "none", "uninitialized", "dummy", "bogus", "fake", "illegal", null, undefined , ""];
42 event = e;
44 for (var i = 0; i < effectAllowedListToTest.length; i++) {
45 var effectAllowedBefore = e.dataTransfer.effectAllowed;
46 e.dataTransfer.effectAllowed = effectAllowedListToTest[i];
47 if (validEffectAllowedList.indexOf(effectAllowedListToTest[i]) != -1)
48 shouldBeEqualToString("event.dataTransfer.effectAllowed", effectAllowedListToTest[i]);
49 else
50 shouldBeEqualToString("event.dataTransfer.effectAllowed", effectAllowedBefore);
53 e.dataTransfer.setData('Text', e.target.textContent);
56 function dragEnd(e)
58 return;
61 function dragEntered(e)
63 dragEnteredAndUpdated(e);
66 function dragOver(e)
68 dragEnteredAndUpdated(e);
71 function dragEnteredAndUpdated(e)
73 var validDropEffectList = ["none", "copy", "link", "move", "link"];
74 var dropEffectListToTest = ["all", "copy", "bogus", "copyLink", "wrong", "copyMove", "linkCopyMove", "link",
75 "linkMove", "move", "none", "uninitialized", "dummy", "bogus", "fake", "illegal", null, undefined , ""];
77 event = e;
79 for (var i = 0; i < dropEffectListToTest.length; i++) {
80 var dropEffectBefore = e.dataTransfer.dropEffect;
81 e.dataTransfer.dropEffect = dropEffectListToTest[i];
83 if (validDropEffectList.indexOf(dropEffectListToTest[i]) != -1)
84 shouldBeEqualToString("event.dataTransfer.dropEffect", dropEffectListToTest[i]);
85 else
86 shouldBeEqualToString("event.dataTransfer.dropEffect", dropEffectBefore);
90 cancelDrag(e);
93 function drop(e)
95 cancelDrag(e);
98 function cancelDrag(e)
100 e.preventDefault();
103 function runTest()
105 if (!window.eventSender)
106 return;
108 if (window.testRunner)
109 testRunner.dumpAsText();
111 var startX = dragMe.offsetLeft + 10;
112 var startY = dragMe.offsetTop + dragMe.offsetHeight / 2;
113 var endX = dropTarget.offsetLeft + 10;
114 var endY = dropTarget.offsetTop + dropTarget.offsetHeight / 2;
116 eventSender.mouseMoveTo(startX, startY);
117 eventSender.mouseDown();
118 eventSender.leapForward(100);
119 eventSender.mouseMoveTo(endX, endY);
120 eventSender.mouseUp();
122 var testContainer = document.getElementById("test-container");
123 if (testContainer)
124 document.body.removeChild(testContainer);
125 debug('<br /><span class="pass">TEST COMPLETE</span>');
127 </script>
128 </head>
129 <body>
130 <p id="description"></p>
131 <div id="test-container">
132 <br/><br/>
133 <div id="dropTarget">Drop the red square onto me.<br/><br/></div>
134 <hr/>
135 <p>Items that can be dragged to the drop target:</p>
136 <div id="dragMe" draggable="true">Square</div>
137 <hr/>
138 </div>
139 <div id="console"></div>
140 <script>
141 description("This test checks that effectAllowed and dropEffect cannot be set to values that aren't defined in the spec");
142 </script>
143 </body>
144 </html>