<body>
<script src=resources/subresource-test.js></script>
<script>

tests = [
    {
        testHeaders: {
            'Cache-control': 'max-age=10, no-store',
        },
        expectedResult: 'Uncached',
    },
    {
        testHeaders: {
            'Cache-control': 'max-age=10, no-cache="Set-Cookie"',
        },
        expectedResult: 'Cached',
    },
    {
        testHeaders: {
            'Cache-control': 'max-age=10, must-revalidate',
        },
        expectedResult: 'Cached',
    },
    {
        testHeaders: {
            'Age': '100',
            'Cache-control': 'max-age=10',
        },
        expectedResult: 'Uncached',
    },
    {
        testHeaders: {
            'Age': '1',
            'Cache-control': 'max-age=10',
        },
        expectedResult: 'Cached',
    },
    {
        testHeaders: {
            'Cache-control': 'max-age=10',
            'Pragma': 'no-cache',
        },
        expectedResult: 'Uncached',
    },
    {
        testHeaders: {
            'Cache-control': 'max-age=0, private, must-revalidate, max-age=60',
        },
        expectedResult: 'Uncached',
    },
    {
        testHeaders: {
            'Cache-control': 'max-age=60, private, must-revalidate, max-age=0',
        },
        expectedResult: 'Cached',
    },
    {
        testHeaders: {
            'Expires': '[now-10s]',
            'Cache-control': 'max-age=10'
        },
        expectedResult: 'Cached',
    },
    {
        testHeaders: {
            'Expires': '[now+10s]',
            'Cache-control': 'max-age=0'
        },
        expectedResult: 'Uncached',
    },
    {
        testHeaders: {
            'Last-modified': '[now-3600s]',
        },
        delay: 1.5,
        expectedResult: 'Cached',
    },
    {
        testHeaders: {
            'Last-modified': '[now-10s]',
        },
        delay: 1.5,
        expectedResult: 'Uncached',
    },
    {
        testHeaders: {
            'Last-modified': '[now+10s]',
        },
        expectedResult: 'Uncached',
    },
];

runTests();

</script>
