1// The increased timeout is especially needed with larger binaries 2// like in the debug/gpu build 3jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000; 4 5describe('Debugger\'s Startup Behavior', function() { 6 let container = document.createElement('div'); 7 document.body.appendChild(container); 8 9 beforeEach(function() { 10 container.innerHTML = `<canvas id=debugger_view width=720 height=1280></canvas>`; 11 }); 12 13 afterEach(function() { 14 container.innerHTML = ''; 15 }); 16 17 it('can load and draw a skp file on an Canvas2D', function(done) { 18 LoadDebugger.then(catchException(done, () => { 19 const surface = Debugger.MakeSWCanvasSurface(document.getElementById('debugger_view')); 20 21 fetch('/debugger/sample.skp').then(function(response) { 22 // Load test file 23 if (!response.ok) { 24 throw new Error("HTTP error, status = " + response.status); 25 } 26 response.arrayBuffer().then(function(buffer) { 27 const fileContents = new Uint8Array(buffer); 28 console.log('fetched /debugger/sample.skp'); 29 const player = Debugger.SkpFilePlayer(fileContents); 30 // Draw picture 31 player.drawTo(surface, 789); // number of commands in sample file 32 surface.flush(); 33 34 console.log('drew picture to canvas element'); 35 surface.dispose(); 36 done(); 37 }); 38 }); 39 })); 40 }); 41 42 it('can load and draw a skp file on a Web GL canvas', function(done) { 43 LoadDebugger.then(catchException(done, () => { 44 const surface = Debugger.MakeWebGLCanvasSurface( 45 document.getElementById('debugger_view')); 46 47 fetch('/debugger/sample.skp').then(function(response) { 48 // Load test file 49 if (!response.ok) { 50 throw new Error("HTTP error, status = " + response.status); 51 } 52 response.arrayBuffer().then(function(buffer) { 53 const fileContents = new Uint8Array(buffer); 54 console.log('fetched /debugger/sample.skp'); 55 const player = Debugger.SkpFilePlayer(fileContents); 56 // Draw picture 57 player.drawTo(surface, 789); // number of commands in sample file 58 surface.flush(); 59 60 console.log('drew picture to canvas element'); 61 surface.dispose(); 62 done(); 63 }); 64 }); 65 })); 66 }); 67}); 68