Diff
Modified: trunk/LayoutTests/ChangeLog (115809 => 115810)
--- trunk/LayoutTests/ChangeLog 2012-05-02 10:14:59 UTC (rev 115809)
+++ trunk/LayoutTests/ChangeLog 2012-05-02 10:31:53 UTC (rev 115810)
@@ -1,3 +1,20 @@
+2012-05-02 Tommy Widenflycht <[email protected]>
+
+ MediaStream API: Changing webkitGetUserMedia to take an object instead of a string
+ https://bugs.webkit.org/show_bug.cgi?id=84850
+
+ Reviewed by Dimitri Glazkov.
+
+ Also took the opportunity to update the peerconnection-Attributes test
+ to test PeerConnection00 instead.
+
+ * fast/mediastream/argument-types-expected.txt:
+ * fast/mediastream/peerconnection-Attributes-expected.txt:
+ * fast/mediastream/script-tests/argument-types.js:
+ (emptyFunction):
+ * fast/mediastream/script-tests/peerconnection-Attributes.js:
+ * platform/chromium/media/video-capture-preview.html:
+
2012-05-02 Thiago Marcos P. Santos <[email protected]>
[EFL] CSS tests needs rebaselining
Modified: trunk/LayoutTests/fast/mediastream/argument-types-expected.txt (115809 => 115810)
--- trunk/LayoutTests/fast/mediastream/argument-types-expected.txt 2012-05-02 10:14:59 UTC (rev 115809)
+++ trunk/LayoutTests/fast/mediastream/argument-types-expected.txt 2012-05-02 10:31:53 UTC (rev 115810)
@@ -6,47 +6,42 @@
PASS navigator.webkitGetUserMedia() threw exception TypeError: Not enough arguments.
PASS navigator.webkitGetUserMedia(undefined) threw exception TypeError: Not enough arguments.
PASS navigator.webkitGetUserMedia(null) threw exception TypeError: Not enough arguments.
-PASS navigator.webkitGetUserMedia({}) threw exception TypeError: Not enough arguments.
-PASS navigator.webkitGetUserMedia(objectThrowingException) threw exception TypeError: Not enough arguments.
-PASS navigator.webkitGetUserMedia("video") threw exception TypeError: Not enough arguments.
+PASS navigator.webkitGetUserMedia({ }) threw exception TypeError: Not enough arguments.
+PASS navigator.webkitGetUserMedia({video: true}) threw exception TypeError: Not enough arguments.
PASS navigator.webkitGetUserMedia(true) threw exception TypeError: Not enough arguments.
PASS navigator.webkitGetUserMedia(42) threw exception TypeError: Not enough arguments.
PASS navigator.webkitGetUserMedia(Infinity) threw exception TypeError: Not enough arguments.
PASS navigator.webkitGetUserMedia(-Infinity) threw exception TypeError: Not enough arguments.
PASS navigator.webkitGetUserMedia(emptyFunction) threw exception TypeError: Not enough arguments.
-PASS navigator.webkitGetUserMedia("video", emptyFunction) did not throw exception.
+PASS navigator.webkitGetUserMedia({video: true}, emptyFunction) did not throw exception.
PASS navigator.webkitGetUserMedia(undefined, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
PASS navigator.webkitGetUserMedia(null, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
-PASS navigator.webkitGetUserMedia({}, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
-PASS navigator.webkitGetUserMedia(objectThrowingException, emptyFunction) threw exception Error: toString threw exception.
-PASS navigator.webkitGetUserMedia(true, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
-PASS navigator.webkitGetUserMedia(42, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
-PASS navigator.webkitGetUserMedia(Infinity, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
-PASS navigator.webkitGetUserMedia(-Infinity, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+PASS navigator.webkitGetUserMedia({ }, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+PASS navigator.webkitGetUserMedia(true, emptyFunction) threw exception TypeError: Not an object..
+PASS navigator.webkitGetUserMedia(42, emptyFunction) threw exception TypeError: Not an object..
+PASS navigator.webkitGetUserMedia(Infinity, emptyFunction) threw exception TypeError: Not an object..
+PASS navigator.webkitGetUserMedia(-Infinity, emptyFunction) threw exception TypeError: Not an object..
PASS navigator.webkitGetUserMedia(emptyFunction, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
-PASS navigator.webkitGetUserMedia("video", "video") threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia("video", undefined) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia("video", null) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia("video", {}) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia("video", objectThrowingException) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia("video", true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia("video", 42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia("video", Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia("video", -Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia("video", emptyFunction, emptyFunction) did not throw exception.
-PASS navigator.webkitGetUserMedia("video", emptyFunction, undefined) did not throw exception.
-PASS navigator.webkitGetUserMedia("audio, video", emptyFunction, undefined) did not throw exception.
-PASS navigator.webkitGetUserMedia("audio, somethingelse,,video", emptyFunction, undefined) did not throw exception.
-PASS navigator.webkitGetUserMedia("audio, video user", emptyFunction, undefined) did not throw exception.
-PASS navigator.webkitGetUserMedia("audio, video environment", emptyFunction, undefined) did not throw exception.
-PASS navigator.webkitGetUserMedia("video", emptyFunction, "video") threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia("video", emptyFunction, null) did not throw exception.
-PASS navigator.webkitGetUserMedia("video", emptyFunction, {}) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia("video", emptyFunction, objectThrowingException) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia("video", emptyFunction, true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia("video", emptyFunction, 42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia("video", emptyFunction, Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
-PASS navigator.webkitGetUserMedia("video", emptyFunction, -Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({video: true}, "foobar") threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({video: true}, undefined) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({video: true}, null) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({video: true}, {}) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({video: true}, true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({video: true}, 42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({video: true}, Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({video: true}, -Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({ }, emptyFunction, emptyFunction) threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, emptyFunction) did not throw exception.
+PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, undefined) did not throw exception.
+PASS navigator.webkitGetUserMedia({audio:true, video:true}, emptyFunction, undefined) did not throw exception.
+PASS navigator.webkitGetUserMedia({audio:true}, emptyFunction, undefined) did not throw exception.
+PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, "video") threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, null) did not throw exception.
+PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, {}) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, true) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, 42) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
+PASS navigator.webkitGetUserMedia({video: true}, emptyFunction, -Infinity) threw exception Error: TYPE_MISMATCH_ERR: DOM Exception 17.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/mediastream/peerconnection-Attributes-expected.txt (115809 => 115810)
--- trunk/LayoutTests/fast/mediastream/peerconnection-Attributes-expected.txt 2012-05-02 10:14:59 UTC (rev 115809)
+++ trunk/LayoutTests/fast/mediastream/peerconnection-Attributes-expected.txt 2012-05-02 10:31:53 UTC (rev 115810)
@@ -1,31 +1,31 @@
-Tests DeprecatedPeerConnection related Attributes according to http://www.w3.org/TR/webrtc/
+Tests PeerConnection00 related attributes according to http://www.w3.org/TR/webrtc/
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS typeof pc.addStream == 'function' is true
-PASS typeof pc.removeStream == 'function' is true
-PASS typeof pc.close == 'function' is true
-PASS pc.NEW ==0 is true
-PASS pc.NEGOTIATING == 1 is true
-PASS pc.ACTIVE == 2 is true
-PASS pc.CLOSED == 3 is true
-FAIL pc.ICE_GATHERING == 0x100 should be true. Was false.
-FAIL pc.ICE_WAITING == 0x200 should be true. Was false.
-FAIL pc.ICE_CHECKING == 0x300 should be true. Was false.
-FAIL pc.ICE_CONNECTED == 0x400 should be true. Was false.
-FAIL pc.ICE_COMPLETED == 0x500 should be true. Was false.
-FAIL pc.ICE_FAILED == 0x600 should be true. Was false.
-FAIL pc.ICE_CLOSED == 0x700 should be true. Was false.
-FAIL pc.SDP_IDLE == 0x1000 should be true. Was false.
-FAIL pc.SDP_WAITING == 0x2000 should be true. Was false.
-FAIL pc.SDP_GLARE ==0x3000 should be true. Was false.
-PASS typeof pc.localStreams == 'object' is true
-PASS typeof pc.remoteStreams == 'object' is true
-PASS typeof pc._onaddstream_ == 'object' is true
-PASS typeof pc._onremovestream_ == 'object' is true
-PASS typeof pc._onconnecting_ == 'object' is true
-PASS typeof pc._onopen_ == 'object' is true
+PASS typeof pc.addStream === 'function' is true
+PASS typeof pc.removeStream === 'function' is true
+PASS typeof pc.close === 'function' is true
+PASS pc.NEW === 0 is true
+FAIL pc.OPENING === 1 should be true. Was false.
+PASS pc.ACTIVE === 2 is true
+PASS pc.CLOSED === 3 is true
+PASS pc.ICE_GATHERING === 0x100 is true
+PASS pc.ICE_WAITING === 0x200 is true
+PASS pc.ICE_CHECKING === 0x300 is true
+PASS pc.ICE_CONNECTED === 0x400 is true
+PASS pc.ICE_COMPLETED === 0x500 is true
+PASS pc.ICE_FAILED === 0x600 is true
+PASS pc.ICE_CLOSED === 0x700 is true
+PASS pc.SDP_OFFER === 0x100 is true
+PASS pc.SDP_PRANSWER === 0x200 is true
+PASS pc.SDP_ANSWER === 0x300 is true
+PASS typeof pc.localStreams === 'object' is true
+PASS typeof pc.remoteStreams === 'object' is true
+PASS typeof pc._onaddstream_ === 'object' is true
+PASS typeof pc._onremovestream_ === 'object' is true
+PASS typeof pc._onconnecting_ === 'object' is true
+PASS typeof pc._onopen_ === 'object' is true
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/mediastream/script-tests/argument-types.js (115809 => 115810)
--- trunk/LayoutTests/fast/mediastream/script-tests/argument-types.js 2012-05-02 10:14:59 UTC (rev 115809)
+++ trunk/LayoutTests/fast/mediastream/script-tests/argument-types.js 2012-05-02 10:31:53 UTC (rev 115810)
@@ -21,26 +21,20 @@
}
}
-var toStringError = new Error('toString threw exception');
var notSupportedError = new Error('NOT_SUPPORTED_ERR: DOM Exception 9');
var typeMismatchError = new Error('TYPE_MISMATCH_ERR: DOM Exception 17');
+var typeNotAnObjectError = new TypeError('Not an object.');
+
var emptyFunction = function() {};
-function ObjectThrowingException() {};
-ObjectThrowingException.prototype.toString = function() {
- throw toStringError;
-}
-var objectThrowingException = new ObjectThrowingException();
-
// No arguments
test('navigator.webkitGetUserMedia()', true);
// 1 Argument (getUserMedia requires at least 2 arguments).
test('navigator.webkitGetUserMedia(undefined)', true);
test('navigator.webkitGetUserMedia(null)', true);
-test('navigator.webkitGetUserMedia({})', true);
-test('navigator.webkitGetUserMedia(objectThrowingException)', true);
-test('navigator.webkitGetUserMedia("video")', true);
+test('navigator.webkitGetUserMedia({ })', true);
+test('navigator.webkitGetUserMedia({video: true})', true);
test('navigator.webkitGetUserMedia(true)', true);
test('navigator.webkitGetUserMedia(42)', true);
test('navigator.webkitGetUserMedia(Infinity)', true);
@@ -48,41 +42,36 @@
test('navigator.webkitGetUserMedia(emptyFunction)', true);
// 2 Arguments.
-test('navigator.webkitGetUserMedia("video", emptyFunction)', false);
+test('navigator.webkitGetUserMedia({video: true}, emptyFunction)', false);
test('navigator.webkitGetUserMedia(undefined, emptyFunction)', true, notSupportedError);
test('navigator.webkitGetUserMedia(null, emptyFunction)', true, notSupportedError);
-test('navigator.webkitGetUserMedia({}, emptyFunction)', true, notSupportedError);
-test('navigator.webkitGetUserMedia(objectThrowingException, emptyFunction)', true, toStringError);
-test('navigator.webkitGetUserMedia(true, emptyFunction)', true, notSupportedError);
-test('navigator.webkitGetUserMedia(42, emptyFunction)', true, notSupportedError);
-test('navigator.webkitGetUserMedia(Infinity, emptyFunction)', true, notSupportedError);
-test('navigator.webkitGetUserMedia(-Infinity, emptyFunction)', true, notSupportedError);
+test('navigator.webkitGetUserMedia({ }, emptyFunction)', true, notSupportedError);
+test('navigator.webkitGetUserMedia(true, emptyFunction)', true, typeNotAnObjectError);
+test('navigator.webkitGetUserMedia(42, emptyFunction)', true, typeNotAnObjectError);
+test('navigator.webkitGetUserMedia(Infinity, emptyFunction)', true, typeNotAnObjectError);
+test('navigator.webkitGetUserMedia(-Infinity, emptyFunction)', true, typeNotAnObjectError);
test('navigator.webkitGetUserMedia(emptyFunction, emptyFunction)', true, notSupportedError);
+test('navigator.webkitGetUserMedia({video: true}, "foobar")', true, typeMismatchError);
+test('navigator.webkitGetUserMedia({video: true}, undefined)', true, typeMismatchError);
+test('navigator.webkitGetUserMedia({video: true}, null)', true, typeMismatchError);
+test('navigator.webkitGetUserMedia({video: true}, {})', true, typeMismatchError);
+test('navigator.webkitGetUserMedia({video: true}, true)', true, typeMismatchError);
+test('navigator.webkitGetUserMedia({video: true}, 42)', true, typeMismatchError);
+test('navigator.webkitGetUserMedia({video: true}, Infinity)', true, typeMismatchError);
+test('navigator.webkitGetUserMedia({video: true}, -Infinity)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia("video", "video")', true, typeMismatchError);
-test('navigator.webkitGetUserMedia("video", undefined)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia("video", null)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia("video", {})', true, typeMismatchError);
-test('navigator.webkitGetUserMedia("video", objectThrowingException)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia("video", true)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia("video", 42)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia("video", Infinity)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia("video", -Infinity)', true, typeMismatchError);
-
// 3 Arguments.
-test('navigator.webkitGetUserMedia("video", emptyFunction, emptyFunction)', false);
-test('navigator.webkitGetUserMedia("video", emptyFunction, undefined)', false);
-test('navigator.webkitGetUserMedia("audio, video", emptyFunction, undefined)', false);
-test('navigator.webkitGetUserMedia("audio, somethingelse,,video", emptyFunction, undefined)', false);
-test('navigator.webkitGetUserMedia("audio, video user", emptyFunction, undefined)', false);
-test('navigator.webkitGetUserMedia("audio, video environment", emptyFunction, undefined)', false);
-test('navigator.webkitGetUserMedia("video", emptyFunction, "video")', true, typeMismatchError);
-test('navigator.webkitGetUserMedia("video", emptyFunction, null)', false );
-test('navigator.webkitGetUserMedia("video", emptyFunction, {})', true, typeMismatchError);
-test('navigator.webkitGetUserMedia("video", emptyFunction, objectThrowingException)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia("video", emptyFunction, true)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia("video", emptyFunction, 42)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia("video", emptyFunction, Infinity)', true, typeMismatchError);
-test('navigator.webkitGetUserMedia("video", emptyFunction, -Infinity)', true, typeMismatchError);
+test('navigator.webkitGetUserMedia({ }, emptyFunction, emptyFunction)', true, notSupportedError);
+test('navigator.webkitGetUserMedia({video: true}, emptyFunction, emptyFunction)', false);
+test('navigator.webkitGetUserMedia({video: true}, emptyFunction, undefined)', false);
+test('navigator.webkitGetUserMedia({audio:true, video:true}, emptyFunction, undefined)', false);
+test('navigator.webkitGetUserMedia({audio:true}, emptyFunction, undefined)', false);
+test('navigator.webkitGetUserMedia({video: true}, emptyFunction, "video")', true, typeMismatchError);
+test('navigator.webkitGetUserMedia({video: true}, emptyFunction, null)', false );
+test('navigator.webkitGetUserMedia({video: true}, emptyFunction, {})', true, typeMismatchError);
+test('navigator.webkitGetUserMedia({video: true}, emptyFunction, true)', true, typeMismatchError);
+test('navigator.webkitGetUserMedia({video: true}, emptyFunction, 42)', true, typeMismatchError);
+test('navigator.webkitGetUserMedia({video: true}, emptyFunction, Infinity)', true, typeMismatchError);
+test('navigator.webkitGetUserMedia({video: true}, emptyFunction, -Infinity)', true, typeMismatchError);
window.jsTestIsAsync = false;
Modified: trunk/LayoutTests/fast/mediastream/script-tests/peerconnection-Attributes.js (115809 => 115810)
--- trunk/LayoutTests/fast/mediastream/script-tests/peerconnection-Attributes.js 2012-05-02 10:14:59 UTC (rev 115809)
+++ trunk/LayoutTests/fast/mediastream/script-tests/peerconnection-Attributes.js 2012-05-02 10:31:53 UTC (rev 115810)
@@ -1,106 +1,40 @@
-description("Tests DeprecatedPeerConnection related Attributes according to http://www.w3.org/TR/webrtc/");
-var stream;
-function shouldNotThrow(_expression_)
-{
- try {
- eval(_expression_);
- testPassed(_expression_ + " did not throw exception.");
- } catch(e) {
- testFailed(_expression_ + " should not throw exception. Threw exception " + e);
- }
-}
+description("Tests PeerConnection00 related attributes according to http://www.w3.org/TR/webrtc/");
-function test(_expression_, expressionShouldThrow, expectedException) {
- if (expressionShouldThrow) {
- if (expectedException)
- shouldThrow(_expression_, '(function() { return "' + expectedException + '"; })();');
- else
- shouldThrow(_expression_, '(function() { return "TypeError: Type error"; })();');
- } else {
- shouldNotThrow(_expression_);
- }
-}
-function shouldBeA(_a, _b, quiet)
-{
- if (typeof _a != "string" || typeof _b != "string")
- debug("WARN: shouldBe() expects string arguments");
- var exception;
- var _av;
- try {
- _av = eval(_a);
- } catch (e) {
- exception = e;
- }
- var _bv = eval(_b);
+pc = new webkitPeerConnection00("STUN NONE", function() {});
- if (exception)
- testFailed(_a + " should be " + _bv + ". Threw exception " + exception);
- else if (isResultCorrect(_av, _bv)) {
- if (!quiet) {
- testPassed(_a + " is " + _b);
- }
- } else if (typeof(_av) == typeof(_bv))
- testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + ".");
- else
- testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ").");
-}
+// Methods
+shouldBeTrue("typeof pc.addStream === 'function'");
+shouldBeTrue("typeof pc.removeStream === 'function'");
+shouldBeTrue("typeof pc.close === 'function'");
-function shouldBeTrueA(_a) { shouldBeA(_a, "true"); }
+// PeerConnection readyState
+shouldBeTrue("pc.NEW === 0");
+shouldBeTrue("pc.OPENING === 1");
+shouldBeTrue("pc.ACTIVE === 2");
+shouldBeTrue("pc.CLOSED === 3");
-var toStringError = new Error('toString threw exception');
-var notSupportedError = new Error('NOT_SUPPORTED_ERR: DOM Exception 9');
-var emptyFunction = function() {};
+// IceState
+shouldBeTrue("pc.ICE_GATHERING === 0x100");
+shouldBeTrue("pc.ICE_WAITING === 0x200");
+shouldBeTrue("pc.ICE_CHECKING === 0x300");
+shouldBeTrue("pc.ICE_CONNECTED === 0x400");
+shouldBeTrue("pc.ICE_COMPLETED === 0x500");
+shouldBeTrue("pc.ICE_FAILED === 0x600");
+shouldBeTrue("pc.ICE_CLOSED === 0x700");
+// SDP state
+shouldBeTrue("pc.SDP_OFFER === 0x100");
+shouldBeTrue("pc.SDP_PRANSWER === 0x200");
+shouldBeTrue("pc.SDP_ANSWER === 0x300");
-function ObjectThrowingException() {};
-ObjectThrowingException.prototype.toString = function() {
- throw toStringError;
-}
-var objectThrowingException = new ObjectThrowingException();
-
-
-navigator.webkitGetUserMedia("video", gotStream, gotStreamFailed);
-function gotStream(s) {
-stream = s;
-}
-
-function gotStreamFailed(error) {
- alert("Failed to get access to webcam. Error code was " + error.code);
-}
-
-
-var pc=new webkitDeprecatedPeerConnection("STUN NONE", emptyFunction);
-//method
-shouldBeTrueA("typeof pc.addStream == 'function'");
-shouldBeTrueA("typeof pc.removeStream == 'function'");
-shouldBeTrueA("typeof pc.close == 'function'");
-
-//peerconnection readyState
-shouldBeTrueA("pc.NEW ==0");
-shouldBeTrueA("pc.NEGOTIATING == 1");
-shouldBeTrueA("pc.ACTIVE == 2");
-shouldBeTrueA("pc.CLOSED == 3");
-
-//iceState and SDP state
-shouldBeTrueA("pc.ICE_GATHERING == 0x100 ");
-shouldBeTrueA("pc.ICE_WAITING == 0x200");
-shouldBeTrueA("pc.ICE_CHECKING == 0x300");
-shouldBeTrueA("pc.ICE_CONNECTED == 0x400");
-shouldBeTrueA("pc.ICE_COMPLETED == 0x500");
-shouldBeTrueA("pc.ICE_FAILED == 0x600");
-shouldBeTrueA("pc.ICE_CLOSED == 0x700");
-shouldBeTrueA("pc.SDP_IDLE == 0x1000");
-shouldBeTrueA("pc.SDP_WAITING == 0x2000");
-shouldBeTrueA("pc.SDP_GLARE ==0x3000");
-
//MediaStream[] attribute
-shouldBeTrueA("typeof pc.localStreams == 'object'");
-shouldBeTrueA("typeof pc.remoteStreams == 'object'");
+shouldBeTrue("typeof pc.localStreams === 'object'");
+shouldBeTrue("typeof pc.remoteStreams === 'object'");
-//callback function definition
-shouldBeTrueA("typeof pc._onaddstream_ == 'object'");
-shouldBeTrueA("typeof pc._onremovestream_ == 'object'");
-shouldBeTrueA("typeof pc._onconnecting_ == 'object'");
-shouldBeTrueA("typeof pc._onopen_ == 'object'");
+//callback function definition
+shouldBeTrue("typeof pc._onaddstream_ === 'object'");
+shouldBeTrue("typeof pc._onremovestream_ === 'object'");
+shouldBeTrue("typeof pc._onconnecting_ === 'object'");
+shouldBeTrue("typeof pc._onopen_ === 'object'");
window.jsTestIsAsync = false;
Modified: trunk/LayoutTests/platform/chromium/media/video-capture-preview.html (115809 => 115810)
--- trunk/LayoutTests/platform/chromium/media/video-capture-preview.html 2012-05-02 10:14:59 UTC (rev 115809)
+++ trunk/LayoutTests/platform/chromium/media/video-capture-preview.html 2012-05-02 10:31:53 UTC (rev 115810)
@@ -43,7 +43,7 @@
findMediaElement();
try {
consoleWrite("request access to local media");
- navigator.webkitGetUserMedia("video", gotStream, gotStreamFailed);
+ navigator.webkitGetUserMedia({video:true}, gotStream, gotStreamFailed);
} catch (e) {
consoleWrite("getUserMedia error " + "(" + e.name + " / " + e.message + ")");
}
Modified: trunk/Source/WebCore/ChangeLog (115809 => 115810)
--- trunk/Source/WebCore/ChangeLog 2012-05-02 10:14:59 UTC (rev 115809)
+++ trunk/Source/WebCore/ChangeLog 2012-05-02 10:31:53 UTC (rev 115810)
@@ -1,3 +1,30 @@
+2012-05-02 Tommy Widenflycht <[email protected]>
+
+ MediaStream API: Changing webkitGetUserMedia to take an object instead of a string
+ https://bugs.webkit.org/show_bug.cgi?id=84850
+
+ Reviewed by Dimitri Glazkov.
+
+ The standard changed a while back to use an object as a dictionary but since JSC
+ didn't support the Dictionary class until just recently we have not updated the API until now.
+
+ Change covered by existing, and edited, tests.
+
+ * Modules/mediastream/NavigatorMediaStream.cpp:
+ (WebCore::NavigatorMediaStream::webkitGetUserMedia):
+ * Modules/mediastream/NavigatorMediaStream.h:
+ (WebCore):
+ (NavigatorMediaStream):
+ * Modules/mediastream/NavigatorMediaStream.idl:
+ * Modules/mediastream/UserMediaRequest.cpp:
+ (WebCore::UserMediaRequest::create):
+ (WebCore::UserMediaRequest::UserMediaRequest):
+ * Modules/mediastream/UserMediaRequest.h:
+ (WebCore):
+ (UserMediaRequest):
+ * platform/mediastream/MediaStreamSourcesQueryClient.h:
+ (MediaStreamSourcesQueryClient):
+
2012-05-02 Antti Koivisto <[email protected]>
StyleSheetInternal::parseUserStyleSheet() should be called parseAuthorStyleSheet().
Modified: trunk/Source/WebCore/Modules/mediastream/NavigatorMediaStream.cpp (115809 => 115810)
--- trunk/Source/WebCore/Modules/mediastream/NavigatorMediaStream.cpp 2012-05-02 10:14:59 UTC (rev 115809)
+++ trunk/Source/WebCore/Modules/mediastream/NavigatorMediaStream.cpp 2012-05-02 10:31:53 UTC (rev 115810)
@@ -25,6 +25,7 @@
#if ENABLE(MEDIA_STREAM)
+#include "Dictionary.h"
#include "Document.h"
#include "ExceptionCode.h"
#include "Frame.h"
@@ -45,7 +46,7 @@
{
}
-void NavigatorMediaStream::webkitGetUserMedia(Navigator* navigator, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback, ExceptionCode& ec)
+void NavigatorMediaStream::webkitGetUserMedia(Navigator* navigator, const Dictionary& options, PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback, ExceptionCode& ec)
{
if (!successCallback)
return;
Modified: trunk/Source/WebCore/Modules/mediastream/NavigatorMediaStream.h (115809 => 115810)
--- trunk/Source/WebCore/Modules/mediastream/NavigatorMediaStream.h 2012-05-02 10:14:59 UTC (rev 115809)
+++ trunk/Source/WebCore/Modules/mediastream/NavigatorMediaStream.h 2012-05-02 10:31:53 UTC (rev 115810)
@@ -27,6 +27,7 @@
namespace WebCore {
+class Dictionary;
class Navigator;
class NavigatorUserMediaErrorCallback;
class NavigatorUserMediaSuccessCallback;
@@ -35,7 +36,7 @@
class NavigatorMediaStream {
public:
- static void webkitGetUserMedia(Navigator*, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>, ExceptionCode&);
+ static void webkitGetUserMedia(Navigator*, const Dictionary&, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>, ExceptionCode&);
private:
NavigatorMediaStream();
Modified: trunk/Source/WebCore/Modules/mediastream/NavigatorMediaStream.idl (115809 => 115810)
--- trunk/Source/WebCore/Modules/mediastream/NavigatorMediaStream.idl 2012-05-02 10:14:59 UTC (rev 115809)
+++ trunk/Source/WebCore/Modules/mediastream/NavigatorMediaStream.idl 2012-05-02 10:31:53 UTC (rev 115810)
@@ -23,7 +23,7 @@
Conditional=MEDIA_STREAM,
Supplemental=Navigator
] NavigatorMediaStream {
- [V8EnabledAtRuntime] void webkitGetUserMedia(in DOMString options,
+ [V8EnabledAtRuntime] void webkitGetUserMedia(in Dictionary options,
in [Callback] NavigatorUserMediaSuccessCallback successCallback,
in [Callback, Optional] NavigatorUserMediaErrorCallback errorCallback)
raises(DOMException);
Modified: trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp (115809 => 115810)
--- trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp 2012-05-02 10:14:59 UTC (rev 115809)
+++ trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp 2012-05-02 10:31:53 UTC (rev 115810)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 Ericsson AB. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -34,6 +35,7 @@
#include "UserMediaRequest.h"
+#include "Dictionary.h"
#include "LocalMediaStream.h"
#include "MediaStreamCenter.h"
#include "SpaceSplitString.h"
@@ -41,7 +43,7 @@
namespace WebCore {
-PassRefPtr<UserMediaRequest> UserMediaRequest::create(ScriptExecutionContext* context, UserMediaController* controller, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback)
+PassRefPtr<UserMediaRequest> UserMediaRequest::create(ScriptExecutionContext* context, UserMediaController* controller, const Dictionary& options, PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback)
{
RefPtr<UserMediaRequest> request = adoptRef(new UserMediaRequest(context, controller, options, successCallback, errorCallback));
if (!request->audio() && !request->video())
@@ -50,17 +52,16 @@
return request.release();
}
-UserMediaRequest::UserMediaRequest(ScriptExecutionContext* context, UserMediaController* controller, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback)
+UserMediaRequest::UserMediaRequest(ScriptExecutionContext* context, UserMediaController* controller, const Dictionary& options, PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback)
: ContextDestructionObserver(context)
, m_audio(false)
, m_video(false)
- , m_cameraPreferenceUser(false)
- , m_cameraPreferenceEnvironment(false)
, m_controller(controller)
, m_successCallback(successCallback)
, m_errorCallback(errorCallback)
{
- parseOptions(options);
+ options.get("audio", m_audio);
+ options.get("video", m_video);
}
UserMediaRequest::~UserMediaRequest()
@@ -108,26 +109,6 @@
ContextDestructionObserver::contextDestroyed();
}
-void UserMediaRequest::parseOptions(const String& options)
-{
- Vector<String> optionsList;
- options.split(",", optionsList);
-
- for (size_t i = 0; i < optionsList.size(); ++i) {
- SpaceSplitString subOptions(optionsList[i], false);
-
- if (subOptions[0] == "audio")
- m_audio = true;
- else if (subOptions[0] == "video") {
- m_video = true;
- if (subOptions.contains("user"))
- m_cameraPreferenceUser = true;
- if (subOptions.contains("environment"))
- m_cameraPreferenceEnvironment = true;
- }
- }
-}
-
} // namespace WebCore
#endif // ENABLE(MEDIA_STREAM)
Modified: trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h (115809 => 115810)
--- trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h 2012-05-02 10:14:59 UTC (rev 115809)
+++ trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h 2012-05-02 10:31:53 UTC (rev 115810)
@@ -44,11 +44,12 @@
namespace WebCore {
+class Dictionary;
class UserMediaController;
class UserMediaRequest : public MediaStreamSourcesQueryClient, public ContextDestructionObserver {
public:
- static PassRefPtr<UserMediaRequest> create(ScriptExecutionContext*, UserMediaController*, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>);
+ static PassRefPtr<UserMediaRequest> create(ScriptExecutionContext*, UserMediaController*, const Dictionary& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>);
~UserMediaRequest();
NavigatorUserMediaSuccessCallback* successCallback() const { return m_successCallback.get(); }
@@ -62,24 +63,17 @@
// MediaStreamSourcesQueryClient
virtual bool audio() const { return m_audio; }
virtual bool video() const { return m_video; }
- virtual bool cameraPreferenceUser() const { return m_cameraPreferenceUser; }
- virtual bool cameraPreferenceEnvironment() const { return m_cameraPreferenceEnvironment; }
virtual void didCompleteQuery(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources);
// ContextDestructionObserver
virtual void contextDestroyed();
private:
- UserMediaRequest(ScriptExecutionContext*, UserMediaController*, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>);
+ UserMediaRequest(ScriptExecutionContext*, UserMediaController*, const Dictionary& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>);
- void parseOptions(const String& options);
-
bool m_audio;
bool m_video;
- bool m_cameraPreferenceUser;
- bool m_cameraPreferenceEnvironment;
-
UserMediaController* m_controller;
RefPtr<NavigatorUserMediaSuccessCallback> m_successCallback;
Modified: trunk/Source/WebCore/platform/mediastream/MediaStreamSourcesQueryClient.h (115809 => 115810)
--- trunk/Source/WebCore/platform/mediastream/MediaStreamSourcesQueryClient.h 2012-05-02 10:14:59 UTC (rev 115809)
+++ trunk/Source/WebCore/platform/mediastream/MediaStreamSourcesQueryClient.h 2012-05-02 10:31:53 UTC (rev 115810)
@@ -44,8 +44,6 @@
virtual bool audio() const = 0;
virtual bool video() const = 0;
- virtual bool cameraPreferenceUser() const = 0;
- virtual bool cameraPreferenceEnvironment() const = 0;
virtual void didCompleteQuery(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) = 0;
};
Modified: trunk/Source/WebKit/chromium/ChangeLog (115809 => 115810)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-05-02 10:14:59 UTC (rev 115809)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-05-02 10:31:53 UTC (rev 115810)
@@ -1,3 +1,14 @@
+2012-05-02 Tommy Widenflycht <[email protected]>
+
+ MediaStream API: Changing webkitGetUserMedia to take an object instead of a string
+ https://bugs.webkit.org/show_bug.cgi?id=84850
+
+ Reviewed by Dimitri Glazkov.
+
+ * public/WebUserMediaRequest.h:
+ (WebUserMediaRequest):
+ * src/WebUserMediaRequest.cpp:
+
2012-05-01 Mark Pilgrim <[email protected]>
[Chromium] Additional instances of calling histogramCustomCounts directly
Modified: trunk/Source/WebKit/chromium/public/WebUserMediaRequest.h (115809 => 115810)
--- trunk/Source/WebKit/chromium/public/WebUserMediaRequest.h 2012-05-02 10:14:59 UTC (rev 115809)
+++ trunk/Source/WebKit/chromium/public/WebUserMediaRequest.h 2012-05-02 10:31:53 UTC (rev 115810)
@@ -64,8 +64,7 @@
WEBKIT_EXPORT bool audio() const;
WEBKIT_EXPORT bool video() const;
- WEBKIT_EXPORT bool cameraPreferenceUser() const;
- WEBKIT_EXPORT bool cameraPreferenceEnvironment() const;
+
WEBKIT_EXPORT WebSecurityOrigin securityOrigin() const;
WEBKIT_EXPORT void requestSucceeded(const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources);
Modified: trunk/Source/WebKit/chromium/src/WebUserMediaRequest.cpp (115809 => 115810)
--- trunk/Source/WebKit/chromium/src/WebUserMediaRequest.cpp 2012-05-02 10:14:59 UTC (rev 115809)
+++ trunk/Source/WebKit/chromium/src/WebUserMediaRequest.cpp 2012-05-02 10:31:53 UTC (rev 115810)
@@ -70,16 +70,6 @@
return m_private->video();
}
-bool WebUserMediaRequest::cameraPreferenceUser() const
-{
- return m_private->cameraPreferenceUser();
-}
-
-bool WebUserMediaRequest::cameraPreferenceEnvironment() const
-{
- return m_private->cameraPreferenceEnvironment();
-}
-
WebSecurityOrigin WebUserMediaRequest::securityOrigin() const
{
ASSERT(m_private->scriptExecutionContext());