| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> | 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> |
| 4 <script type="text/javascript"> | 4 <script type="text/javascript"> |
| 5 $ = function(id) { | 5 $ = function(id) { |
| 6 return document.getElementById(id); | 6 return document.getElementById(id); |
| 7 }; | 7 }; |
| 8 | 8 |
| 9 setAllEventsOccuredHandler(function() { | 9 setAllEventsOccuredHandler(function() { |
| 10 reportTestSuccess(); | 10 reportTestSuccess(); |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 | 453 |
| 454 var maxLightGreenPixelsX = 0; | 454 var maxLightGreenPixelsX = 0; |
| 455 var maxLightGreenPixelsY = 0; | 455 var maxLightGreenPixelsY = 0; |
| 456 | 456 |
| 457 var attempt = 0; | 457 var attempt = 0; |
| 458 var maxAttempts = 10; | 458 var maxAttempts = 10; |
| 459 | 459 |
| 460 var detectorFunction = function() { | 460 var detectorFunction = function() { |
| 461 var width = videoElement.videoWidth; | 461 var width = videoElement.videoWidth; |
| 462 var height = videoElement.videoHeight; | 462 var height = videoElement.videoHeight; |
| 463 if (width == 0 || height == 0) { | 463 if (width == 0 || height == 0) |
| 464 if (++attempt > maxAttempts) { | 464 failTest("VideoElement width and height set to 0."); |
| 465 clearInterval(detectorInterval); | |
| 466 failTest("VideoElement width or height set to 0."); | |
| 467 } | |
| 468 else { | |
| 469 // We have zero size now; give a chance to shape up. | |
| 470 return; | |
| 471 } | |
| 472 } | |
| 473 | 465 |
| 474 canvas.width = width; | 466 canvas.width = width; |
| 475 canvas.height = height; | 467 canvas.height = height; |
| 476 var aperture = Math.min(width, height) / 2; | 468 var aperture = Math.min(width, height) / 2; |
| 477 var context = canvas.getContext('2d'); | 469 var context = canvas.getContext('2d'); |
| 478 context.drawImage(videoElement, 0, 0, width, height); | 470 context.drawImage(videoElement, 0, 0, width, height); |
| 479 | 471 |
| 480 // We are interested in a window starting from the center of the image | 472 // We are interested in a window starting from the center of the image |
| 481 // where we expect the circle from the fake video capture to be rolling. | 473 // where we expect the circle from the fake video capture to be rolling. |
| 482 var pixels = context.getImageData(width / 2, height / 2, | 474 var pixels = context.getImageData(width / 2, height / 2, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 </tr> | 530 </tr> |
| 539 <tr> | 531 <tr> |
| 540 <td><video id="local-view-2" width="320" height="240" autoplay | 532 <td><video id="local-view-2" width="320" height="240" autoplay |
| 541 style="display:none"></video></td> | 533 style="display:none"></video></td> |
| 542 <td><canvas id="local-view-2-canvas" width="320" height="240" | 534 <td><canvas id="local-view-2-canvas" width="320" height="240" |
| 543 style="display:none"></canvas></td> | 535 style="display:none"></canvas></td> |
| 544 </tr> | 536 </tr> |
| 545 </table> | 537 </table> |
| 546 </body> | 538 </body> |
| 547 </html> | 539 </html> |
| OLD | NEW |