Revision 9e8a2af4be1ef619f350af1c73b63922d13a94b7 authored by Michael[tm] Smith on 09 April 2014, 14:23:12 UTC, committed by Michael[tm] Smith on 09 April 2014, 14:23:12 UTC
1 parent a4b8200
Raw File
WorkerGlobalScope_setTimeout.htm
<!DOCTYPE html>
<html>
<head>
<title> WorkerGlobalScope API: setTimeout() </title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id=log></div>
<script>
    
    var FileName = './support/Timer.js';
    var DATA = "TimeoutHandler";
    var ExpectedResult = ["hello", "worker", "worker"];
    var ActualResult = [];
    
    var t = async_test("Test Description: WorkerGlobalScope API: setTimeout().");
                  
    var worker = new Worker(FileName);

    worker.onmessage = t.step_func(function(evt)
    {
        ActualResult.push(evt.data);
        
        if (ActualResult.length == 3)
        {
            setTimeout(t.step_func(VerifyResult), 100);
        }
    });
    
    worker.postMessage(DATA);
    
    function VerifyResult()
    {
        assert_array_equals(ActualResult, ExpectedResult)
        t.done();
    }
</script>
</body>
</html>
back to top