Changeset 7890

Show
Ignore:
Timestamp:
04/01/07 02:10:53 (22 months ago)
Author:
alex
Message:

ensure that we actually play the "woohoo!" sound if it all goes well. Rate limits sounds. Refs #2550

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dojo/trunk/tests/_browserRunner.js

    r7887 r7890  
    213213                } 
    214214 
     215                var _nameTimes = {}; 
    215216                var _playSound = function(name){ 
    216                         byId("hiddenAudio").innerHTML = '<embed src="_sounds/'+name+'.wav" autostart="true" loop="false" hidden="true" width="1" height="1"></embed>'; 
     217                        var nt = _nameTimes[name]; 
     218                        if((!nt)||(((new Date)-nt) > 700)){ 
     219                                _nameTimes[name] = new Date(); 
     220                                var tc = document.createElement("span"); 
     221                                byId("hiddenAudio").appendChild(tc); 
     222                                tc.innerHTML = '<embed src="_sounds/'+name+'.wav" autostart="true" loop="false" hidden="true" width="1" height="1"></embed>'; 
     223                        } 
    217224                } 
    218225 
     
    334341                _addOnEvt("load",  
    335342                        function(){ 
    336                                 if(loaded){ return; } 
     343                                tests._onEnd = function(){ 
     344                                        if(tests._failureCount == 0){ 
     345                                                tests.debug("WOOHOO!!"); 
     346                                                _playSound("woohoo"); 
     347                                        }else{ 
     348                                                console.debug("tests._failureCount:", tests._failureCount); 
     349                                        } 
     350                                        toggleRunning(); 
     351                                } 
    337352                                if(!byId("play")){  
    338353                                        // make sure we've got an ammenable DOM structure 
     
    352367                                        } 
    353368                                } 
    354                                 tests._onEnd = function(){ 
    355                                         toggleRunning(); 
    356                                         if(tests._failureCount == 0){ 
    357                                                 alert("WOOHOO!!"); 
    358                                                 tests.debug("WOOHOO!!"); 
    359                                                 _playSound("woohoo"); 
    360                                         } 
    361                                 } 
    362369                                tests.run = (function(oldRun){ 
    363370                                        return function(){