OLD | NEW |
1 description("Tests the acceptable types for arguments to navigator.getUserMedia
methods."); | 1 description("Tests the acceptable types for arguments to navigator.getUserMedia
methods."); |
2 | 2 |
3 function test(expression, expressionShouldThrow, expectedException) { | 3 function test(expression, expressionShouldThrow, expectedException) { |
4 if (expressionShouldThrow) { | 4 if (expressionShouldThrow) { |
5 if (expectedException) | 5 if (expectedException) |
6 shouldThrow(expression, '"' + expectedException + '"'); | 6 shouldThrow(expression, '"' + expectedException + '"'); |
7 else | 7 else |
8 shouldThrow(expression, '"TypeError: Not enough arguments"'); | 8 shouldThrow(expression, '"TypeError: Not enough arguments"'); |
9 } else { | 9 } else { |
10 shouldNotThrow(expression); | 10 shouldNotThrow(expression); |
11 } | 11 } |
12 } | 12 } |
13 | 13 |
14 var notSupportedError = new Error('NotSupportedError: DOM Exception 9'); | 14 var notSupportedError = 'NotSupportedError: The implementation did not support t
he requested type of object or operation.'; |
15 var typeError = new TypeError('Type error'); | 15 var typeError = new TypeError('Type error'); |
16 var typeNotAnObjectError = new TypeError('Not an object.'); | 16 var typeNotAnObjectError = new TypeError('Not an object.'); |
17 | 17 |
18 var emptyFunction = function() {}; | 18 var emptyFunction = function() {}; |
19 | 19 |
20 // No arguments | 20 // No arguments |
21 test('navigator.webkitGetUserMedia()', true); | 21 test('navigator.webkitGetUserMedia()', true); |
22 | 22 |
23 // 1 Argument (getUserMedia requires at least 2 arguments). | 23 // 1 Argument (getUserMedia requires at least 2 arguments). |
24 test('navigator.webkitGetUserMedia(undefined)', true); | 24 test('navigator.webkitGetUserMedia(undefined)', true); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 test('navigator.webkitGetUserMedia({audio:true}, emptyFunction, undefined)', fal
se); | 58 test('navigator.webkitGetUserMedia({audio:true}, emptyFunction, undefined)', fal
se); |
59 test('navigator.webkitGetUserMedia({video: true}, emptyFunction, "video")', true
, typeError); | 59 test('navigator.webkitGetUserMedia({video: true}, emptyFunction, "video")', true
, typeError); |
60 test('navigator.webkitGetUserMedia({video: true}, emptyFunction, null)', false )
; | 60 test('navigator.webkitGetUserMedia({video: true}, emptyFunction, null)', false )
; |
61 test('navigator.webkitGetUserMedia({video: true}, emptyFunction, {})', true, typ
eError); | 61 test('navigator.webkitGetUserMedia({video: true}, emptyFunction, {})', true, typ
eError); |
62 test('navigator.webkitGetUserMedia({video: true}, emptyFunction, true)', true, t
ypeError); | 62 test('navigator.webkitGetUserMedia({video: true}, emptyFunction, true)', true, t
ypeError); |
63 test('navigator.webkitGetUserMedia({video: true}, emptyFunction, 42)', true, typ
eError); | 63 test('navigator.webkitGetUserMedia({video: true}, emptyFunction, 42)', true, typ
eError); |
64 test('navigator.webkitGetUserMedia({video: true}, emptyFunction, Infinity)', tru
e, typeError); | 64 test('navigator.webkitGetUserMedia({video: true}, emptyFunction, Infinity)', tru
e, typeError); |
65 test('navigator.webkitGetUserMedia({video: true}, emptyFunction, -Infinity)', tr
ue, typeError); | 65 test('navigator.webkitGetUserMedia({video: true}, emptyFunction, -Infinity)', tr
ue, typeError); |
66 | 66 |
67 window.jsTestIsAsync = false; | 67 window.jsTestIsAsync = false; |
OLD | NEW |