1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/camera/test/test_camera_hardware_init_failure.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,53 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=940424 1.8 +--> 1.9 +<head> 1.10 + <title>Bug 940424 - Test camera hardware init failure handling</title> 1.11 + <script type="text/javascript" src="/MochiKit/MochiKit.js"></script> 1.12 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <script type="text/javascript" src="camera_common.js"></script> 1.14 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.15 +</head> 1.16 +<body> 1.17 + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=940424">Mozilla Bug 940424</a> 1.18 + <video id="viewfinder" width="200" height="200" autoplay></video> 1.19 + <img src="#" alt="This image is going to load" id="testimage"/> 1.20 + 1.21 +<script class="testbody" type="text/javascript;version=1.7"> 1.22 + 1.23 +var whichCamera = navigator.mozCameras.getListOfCameras()[0]; 1.24 +var initialConfig = { 1.25 + mode: 'picture', 1.26 + recorderProfile: 'cif', 1.27 + previewSize: { 1.28 + width: 352, 1.29 + height: 288 1.30 + } 1.31 +}; 1.32 + 1.33 +function end() { 1.34 + CameraTest.end(); 1.35 +} 1.36 + 1.37 +CameraTest.begin("hardware", function(test) { 1.38 + test.set("init-failure", function(type) { 1.39 + function onSuccess(camera, config) { 1.40 + ok(false, "onSuccess called incorrectly"); 1.41 + camera.release(); 1.42 + test.done(end); 1.43 + } 1.44 + function onError(error) { 1.45 + ok(true, "onError called correctly on init failure"); 1.46 + test.done(end); 1.47 + } 1.48 + info("Running test: " + type); 1.49 + navigator.mozCameras.getCamera(whichCamera, initialConfig, onSuccess, onError); 1.50 + }); 1.51 +}); 1.52 + 1.53 +</script> 1.54 +</body> 1.55 + 1.56 +</html>