<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true, shouldHandleRunOpenPanel=false, shouldPresentPopovers=false ] -->
<html>
<head>
<meta name="viewport" content="width=device-width">
<script src="../../../resources/js-test.js"></script>
<script src="../../../resources/ui-helper.js"></script>
</head>
<body>
<div id="description"></div>
<input id="testInput" type="file">
<div id="console"></div>
<script>
description("Basic testing for the File Upload Panel on iOS.");
jsTestIsAsync = true;

function getFileUploadPickerMenuItemsScript()
{ 
    return `
    (function() {
        return JSON.stringify(uiController.contentsOfUserInterfaceItem('fileUploadPanelMenu'));
    })();`
}

function dismissFilePickerScript()
{
    return `
    (function() {
        uiController.dismissFilePicker(function() {
            uiController.uiScriptComplete();
        });
    })();`
}

function getFileUploadPickerMenuItems()
{
    return new Promise((resolve) => {
        testRunner.runUIScript(getFileUploadPickerMenuItemsScript(), function(result) {
            resolve(JSON.parse(result).fileUploadPanelMenu);
        });
    });
}

function dismissFilePicker()
{
    const uiScript = `uiController.dismissFilePicker(() => uiController.uiScriptComplete())`;
    return new Promise(resolve => testRunner.runUIScript(uiScript, resolve));
}

function runAcceptTest(accept, expectedMenuItems)
{
    return new Promise((resolve) => {
        debug("* accept = " + accept);
        testInput.accept = accept;

        UIHelper.activateElement(testInput).then(() => {
            getFileUploadPickerMenuItems().then((_items) => {
                items = _items;
                shouldBeTrue("areArraysEqual(items, " + expectedMenuItems + ")");
                debug("");
                dismissFilePicker().then(() => { resolve(); });
            });
        });
    });
}

async function runTests()
{
    document.getElementById("console").style = "display: none";

    await runAcceptTest("", '["Photo Library", "Take Photo or Video", "Browse"]');
    await runAcceptTest("image/*", '["Photo Library", "Take Photo", "Browse"]');
    await runAcceptTest("video/*", '["Photo Library", "Take Video", "Browse"]');
    await runAcceptTest("image/*, video/*", '["Photo Library", "Take Photo or Video", "Browse"]');
    await runAcceptTest(".PNG, .GIF", '["Photo Library", "Take Photo", "Browse"]');
    await runAcceptTest(".PNG, .GIF, .MOV", '["Photo Library", "Take Photo or Video", "Browse"]');
    await runAcceptTest("audio/*", '["Browse"]');
    await runAcceptTest(".TXT", '["Browse"]');
    await runAcceptTest(".PDF", '["Browse"]');
    await runAcceptTest(".PDF, .TXT", '["Browse"]');

    document.getElementById("console").style = "";
    finishJSTest();
}


onload = runTests;

</script>
</body>
</html>
