console-time.html   [plain text]


<script>
function test() {
    // Test 1: call timeEnd before time
    console.log(">>>console.timeEnd(\"1\")");
    console.timeEnd("1");
    // Test 2: call time two times before timeEnd
    console.log(">>>console.time(\"2\")");
    console.time("2");
    setTimeout(function() {
        console.log(">>>console.time(\"2\")");
        console.time("2");
        console.log(">>>console.timeEnd(\"2\")");
        console.timeEnd("2");
        console.log("2: If it says ~1000ms the first time is not overwritten.");
    }, 1000);
    // Test 3: call timeEnd two times
    console.log(">>>console.time(\"3\")");
    console.time("3");
    console.log(">>>console.timeEnd(\"3\")");
    console.timeEnd("3");
    console.log(">>>console.timeEnd(\"3\")");
    console.timeEnd("3");
    // Test 4: call time/timeEnd without title parameter
    console.log(">>>console.time()");
    console.time();
    console.log(">>>console.timeEnd()");
    console.timeEnd();
};

</script>
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=19159">Bug 19159: Inspector should support console.time/console.timeEnd</a>.</p>
<p>Open the Inspector (right-click and choose "Inspect Element"), then click the "Run Tests" button.</p>
<button onclick="test()">Run Tests</button>