dom/camera/test/test_camera_hardware_init_failure.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial