Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / pasteboard / data-transfer-items-drag-drop-file.html
blobaa62a58b89d54aa386f72e0378e47d8a7b56d7ad
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <div>This tests the basic functionality and properties of DataTransferItems for files with drag and drop. This test requires DRT.</div>
6 <div id="destination" style="min-height:100px; border: solid 1px black">Drop files here if you test this manually</div>
8 <div id="console"></div>
10 <script>
11 var testFiles = [
12 { path: 'resources/mozilla.gif',
13 type: 'image/gif',
14 size: 2593 },
15 { path: 'resources/drop-file-svg.svg',
16 type: 'image/svg+xml',
17 size: 109 },
18 { path: 'resources/copy-backslash-euc.html',
19 type: 'text/html',
20 size: 478 }
23 function log(text)
25 var console = document.getElementById('console');
26 console.appendChild(document.createTextNode(text));
27 console.appendChild(document.createElement('br'));
30 function test(expect, actual)
32 log((expect == actual ? 'PASS' : 'FAIL') + ': "' + expect + '" == "' + actual + '"');
35 function startTest()
37 var destination = document.getElementById('destination');
38 destination.addEventListener('dragover', handleDragOver, false);
39 destination.addEventListener('drop', handleDrop, false);
41 if (!window.testRunner)
42 return;
43 testRunner.waitUntilDone();
44 testRunner.dumpAsText();
46 var files = [];
47 for (var i = 0; i < testFiles.length; ++i) {
48 log('Dragging file: ' + testFiles[i].path);
49 files.push(testFiles[i].path);
52 // Perform drag-and-drop with the testFiles.
53 eventSender.beginDragWithFiles(files);
54 eventSender.leapForward(500);
55 eventSender.mouseMoveTo(destination.offsetLeft + 10, destination.offsetTop + destination.offsetHeight / 2);
56 eventSender.mouseUp();
59 function handleDragOver(e)
61 e.stopPropagation();
62 e.preventDefault();
65 function handleDrop(e)
67 e.stopPropagation();
68 e.preventDefault();
70 log('Verifying contents of DataTransferItems...');
71 var items = e.dataTransfer.items;
72 var files = [];
73 test(testFiles.length, items.length);
74 for (var i = 0; i < items.length; ++i) {
75 // The items should be in the same order as we added.
76 var expected = testFiles[i];
78 var file = items[i].getAsFile();
79 files.push(file);
81 test('file', items[i].kind);
82 test(expected.type, items[i].type);
83 test(expected.type, file.type);
84 test(expected.size, file.size);
86 var components = expected.path.split('/');
87 var name = components[components.length - 1];
88 test(name, file.name);
91 testRunner.notifyDone();
94 startTest();
96 </script>
97 </body>
98 </html>