<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../resources/inspector-test.js"></script>
<script>
function xhrGet(url) {
    let xhr = new XMLHttpRequest;
    xhr.open("GET", url, true);
    xhr.send();
}

function createXHRForText() {
    xhrGet("resources/data.txt");
}

function createXHRForHTML() {
    xhrGet("resources/data.html");
}

function createXHRForJSON() {
    xhrGet("resources/data.json");
}

function createXHRForJSON2() {
    xhrGet(`resources/echo.php?mimetype=application/json&content={"json":true,"value":42}`);
}

function createXHRForJSON3() {
    xhrGet(`resources/echo.php?mimetype=application/vnd.api%2Bjson&content={"json":true,"value":999}`);
}

function createXHRForSVG() {
    xhrGet("resources/data.svg");
}

function createXHRForPNG() {
    xhrGet("/resources/square100.png");
}

function test()
{
    let suite = InspectorTest.createAsyncSuite("Network.getResponseBody.XHR");

    function addTestCase({name, description, expression, contentHandler}) {
        suite.addTestCase({
            name, description,
            test(resolve, reject) {
                InspectorTest.evaluateInPage(expression);
                WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded)
                    .then((event) => {
                        let resource = event.data.resource;
                        InspectorTest.expectEqual(resource.type, WI.Resource.Type.XHR, "Resource should be XHR type.");
                        return resource.requestContent();
                    })
                    .then(contentHandler)
                    .then(resolve, reject);
            }
        });
    }

    addTestCase({
        name: "Network.getResponseBody.XHR.Text",
        description: "Get text/plain content as text.",
        expression: "createXHRForText()",
        contentHandler({error, sourceCode, content}) {
            InspectorTest.expectEqual(sourceCode.mimeType, "text/plain", "MIMEType should be 'text/plain'.");
            InspectorTest.expectEqual(content, "Plain text resource.\n", "Text content should match data.txt.");
        }
    });

    addTestCase({
        name: "Network.getResponseBody.XHR.HTML",
        description: "Get text/html content as text.",
        expression: "createXHRForHTML()",
        contentHandler({error, sourceCode, content}) {
            InspectorTest.expectEqual(sourceCode.mimeType, "text/html", "MIMEType should be 'text/html'.");
            InspectorTest.expectEqual(content, "<span>Hello World</span>\n", "Text content should match data.html.");
        }
    });

    addTestCase({
        name: "Network.getResponseBody.XHR.JSON",
        description: "Get application/octet-stream content as text.",
        expression: "createXHRForJSON()",
        contentHandler({error, sourceCode, content}) {
            InspectorTest.expectEqual(sourceCode.mimeType, "application/octet-stream", "MIMEType should be 'application/octet-stream'.");
            InspectorTest.expectEqual(content, `{"json": true, "value": 42}\n`, "JSON content should match data.json.");
        }
    });

    addTestCase({
        name: "Network.getResponseBody.XHR.JSON2",
        description: "Get application/json content as text.",
        expression: "createXHRForJSON2()",
        contentHandler({error, sourceCode, content}) {
            InspectorTest.expectEqual(sourceCode.mimeType, "application/json", "MIMEType should be 'application/json'.");
            InspectorTest.expectEqual(content, `{"json":true,"value":42}`, "JSON content should match specified content.");
        }
    });

    addTestCase({
        name: "Network.getResponseBody.XHR.JSON3",
        description: "Get arbitrary +json content as text.",
        expression: "createXHRForJSON3()",
        contentHandler({error, sourceCode, content}) {
            InspectorTest.expectEqual(sourceCode.mimeType, "application/vnd.api+json", "MIMEType should be 'application/vnd.api+json'.");
            InspectorTest.expectEqual(content, `{"json":true,"value":999}`, "JSON content should match specified content.");
        }
    });

    addTestCase({
        name: "Network.getResponseBody.XHR.SVG",
        description: "Get image/svg+xml content as text.",
        expression: "createXHRForSVG()",
        contentHandler({error, sourceCode, content}) {
            InspectorTest.expectEqual(sourceCode.mimeType, "image/svg+xml", "MIMEType should be 'image/svg+xml'.");
            InspectorTest.expectEqual(content,
`<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 200">
  <rect width="100%" height="50%" fill="green"/>
</svg>
`, "SVG content should be text.");
        }
    });

    addTestCase({
        name: "Network.getResponseBody.XHR.PNG",
        description: "Get image/png content.",
        expression: "createXHRForPNG()",
        contentHandler({error, sourceCode, content}) {
            // FIXME: <https://webkit.org/b/165495> Web Inspector: XHR / Fetch for non-text content should not show garbled text
            InspectorTest.expectEqual(sourceCode.mimeType, "image/png", "MIMEType should be 'image/png'.");
            InspectorTest.expectEqual(typeof content, "string", "Image content should be text.");
        }
    });

    suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="runTest()">
<p>Tests for getting the content of XHR requests.</p>
</body>
</html>
