| 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: Failed to execute \'webkitGetUs
erMedia\' on \'Navigator\': 2 arguments required, but only 1 present."'); |
| 9 } else { | 9 } else { |
| 10 shouldNotThrow(expression); | 10 shouldNotThrow(expression); |
| 11 } | 11 } |
| 12 } | 12 } |
| 13 | 13 |
| 14 var notSupportedError = 'NotSupportedError: The implementation did not support t
he requested type of object or operation.'; | 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, 'TypeError: Failed to execute \'web
kitGetUserMedia\' on \'Navigator\': 2 arguments required, but only 0 present.'); |
| 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); |
| 25 test('navigator.webkitGetUserMedia(null)', true); | 25 test('navigator.webkitGetUserMedia(null)', true); |
| 26 test('navigator.webkitGetUserMedia({ })', true); | 26 test('navigator.webkitGetUserMedia({ })', true); |
| 27 test('navigator.webkitGetUserMedia({video: true})', true); | 27 test('navigator.webkitGetUserMedia({video: true})', true); |
| 28 test('navigator.webkitGetUserMedia(true)', true); | 28 test('navigator.webkitGetUserMedia(true)', true); |
| 29 test('navigator.webkitGetUserMedia(42)', true); | 29 test('navigator.webkitGetUserMedia(42)', true); |
| 30 test('navigator.webkitGetUserMedia(Infinity)', true); | 30 test('navigator.webkitGetUserMedia(Infinity)', true); |
| 31 test('navigator.webkitGetUserMedia(-Infinity)', true); | 31 test('navigator.webkitGetUserMedia(-Infinity)', true); |
| (...skipping 26 matching lines...) Expand all 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 |