<!DOCTYPE html><!-- webkit-test-runner [ WebAPIStatisticsEnabled=true ] -->
<head>
    <meta charset="UTF-8">
    <title>Test for navigator functions accessed data collection in resource load statistics</title>
</head>
<script>
    internals.setResourceLoadStatisticsEnabled(false);
</script>
<body>
<p> Tests for navigator functions accessed data collection in ResourceLoadStatistics plist by querying for all the navigator properties and dumping the entire resource load statistics map. </p>
<script>
    const hostUnderTest = "127.0.0.1:8000";
    const statisticsUrl = "http://" + hostUnderTest + "/temp";

    function completeTest() {
        testRunner.statisticsResetToConsistentState(function() {
            testRunner.notifyDone();
        });
    }

    function runTestRunnerTest() {
        testRunner.installStatisticsDidScanDataRecordsCallback(completeTest);
    
        var useragent = navigator.userAgent;
        var javaenabled = navigator.javaEnabled();
        var cookieEnabled = navigator.cookieEnabled;
        var mimetypes = navigator.mimeTypes;
        var plugins = navigator.plugins;
        var appversion = navigator.appVersion;
        testRunner.statisticsNotifyObserver();
    }

    if (document.location.host === hostUnderTest && window.testRunner && window.internals) {
        testRunner.dumpAsText();
        testRunner.dumpResourceLoadStatistics();
        testRunner.waitUntilDone();
        internals.setResourceLoadStatisticsEnabled(true);
        runTestRunnerTest();
    }
</script>
</body>
</html>