<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../../resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/setup-file-input-element-for-drag.js"></script>
<script>
description("Test File.lastModifiedDate.");

function onFileDrop(file, filePath)
{
    var xhr = new XMLHttpRequest();
    xhr.open("GET", "http://127.0.0.1:8000/resources/file-last-modified.py?path=../local/fileapi/" + filePath, false);
    xhr.send();
    var expectedDate = new Date(parseInt(xhr.responseText) * 1000);
    var actualDate = file.lastModified;
    if (expectedDate.getTime() == actualDate)
        testPassed("file.lastModified verified");
    else
        testFailed("file.lastModified incorrect");
}

function runTest()
{
    var testFilePath = "../resources/file-for-drag-to-send.txt";
    setFileInputDropCallback(function(file) { onFileDrop(file, testFilePath); });
    eventSender.beginDragWithFiles([testFilePath]);
    moveMouseToCenterOfElement(fileInput);
    eventSender.mouseUp();
}

if (window.eventSender) {
    runTest();
    // Clean up after ourselves
    removeFileInputElement();
} else {
    testFailed("This test is not interactive, please run using DumpRenderTree");
}

var successfullyParsed = true;
</script>
<script src="../../../../resources/js-test-post.js"></script>
</body>
</html>
