|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=940424 |
|
5 --> |
|
6 <head> |
|
7 <title>Bug 940424 - Test camera hardware init failure handling</title> |
|
8 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script> |
|
9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
10 <script type="text/javascript" src="camera_common.js"></script> |
|
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
12 </head> |
|
13 <body> |
|
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=940424">Mozilla Bug 940424</a> |
|
15 <video id="viewfinder" width="200" height="200" autoplay></video> |
|
16 <img src="#" alt="This image is going to load" id="testimage"/> |
|
17 |
|
18 <script class="testbody" type="text/javascript;version=1.7"> |
|
19 |
|
20 var whichCamera = navigator.mozCameras.getListOfCameras()[0]; |
|
21 var initialConfig = { |
|
22 mode: 'picture', |
|
23 recorderProfile: 'cif', |
|
24 previewSize: { |
|
25 width: 352, |
|
26 height: 288 |
|
27 } |
|
28 }; |
|
29 |
|
30 function end() { |
|
31 CameraTest.end(); |
|
32 } |
|
33 |
|
34 CameraTest.begin("hardware", function(test) { |
|
35 test.set("init-failure", function(type) { |
|
36 function onSuccess(camera, config) { |
|
37 ok(false, "onSuccess called incorrectly"); |
|
38 camera.release(); |
|
39 test.done(end); |
|
40 } |
|
41 function onError(error) { |
|
42 ok(true, "onError called correctly on init failure"); |
|
43 test.done(end); |
|
44 } |
|
45 info("Running test: " + type); |
|
46 navigator.mozCameras.getCamera(whichCamera, initialConfig, onSuccess, onError); |
|
47 }); |
|
48 }); |
|
49 |
|
50 </script> |
|
51 </body> |
|
52 |
|
53 </html> |