Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / pasteboard / drag-and-drop-objectimage-contenteditable.html
blob5661733c3204a7529f762d316cac2a722db55898
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <style>
6 #target {
7 height: 200px;
8 width: 220px;
9 border: 5px solid blue;
11 </style>
12 </head>
13 <body onload="runTest()">
14 <p id="description"></p>
15 <div contenteditable=true id="target"></div>
16 <div><object id="source" data="resources/apple.gif" type="image/png" itemprop="somedata" arbitrary="green" draggable=true></object></div>
17 <div id="console"></div>
19 <script>
20 description('This test verifies dropping an image does nothing. To test manually, drag the image and drop it in the rect with a blue border.');
21 var jsTestIsAsync = true;
22 var target = document.getElementById('target');
23 var imageIsInserted = false;
25 function contentInserted() {
26 shouldBe('target.getElementsByTagName("object").length', '1');
27 shouldBe('target.getElementsByTagName("object")[0].attributes.length', '6');
28 shouldBeEqualToString('target.getElementsByTagName("object")[0].id', 'source');
29 shouldBeEqualToString('target.getElementsByTagName("object")[0].type', 'image/png');
30 shouldBeTrue('target.getElementsByTagName("object")[0].draggable');
31 shouldBeEqualToString('target.getElementsByTagName("object")[0].attributes["itemprop"].value', 'somedata');
32 shouldBeEqualToString('target.getElementsByTagName("object")[0].attributes["arbitrary"].value', 'green');
33 imageIsInserted = true;
36 function runTest() {
37 target.addEventListener('DOMNodeInserted', contentInserted, false);
39 document.getElementById('source').addEventListener('dragend', function() {
40 shouldBeFalse('imageIsInserted');
41 finishJSTest();
42 });
44 if (!window.testRunner)
45 return;
47 testRunner.waitUntilDone();
49 e = document.getElementById("source");
50 x = e.offsetLeft + e.offsetWidth / 2;
51 y = e.offsetTop + e.offsetHeight / 2;
53 eventSender.mouseMoveTo(x, y);
54 eventSender.mouseDown();
55 eventSender.leapForward(100);
56 e = document.getElementById("target");
57 x = e.offsetLeft + e.offsetWidth / 2;
58 y = e.offsetTop + e.offsetHeight / 2;
60 eventSender.mouseMoveTo(x, y);
61 eventSender.mouseUp();
63 </script>
64 </body>
65 </html>