Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Unified Diff: third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer.html

Issue 1713953002: Report errors in RTCPeerConnection legacy functions via the the failure callback instead of excepti… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix expected Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer.html
diff --git a/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer.html b/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer.html
index 38258b1a0c1aab202739a0d98d9485db2f783aaa..e34dc4039db8fefd51dbb3b6d80f3e9832eac49e 100644
--- a/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer.html
+++ b/third_party/WebKit/LayoutTests/fast/mediastream/RTCPeerConnection-createOffer.html
@@ -13,53 +13,98 @@ description("Tests RTCPeerConnection createOffer.");
var pc = null;
-function dummy() {}
+function unexpectedCallback()
+{
+ testFailed('unexpectedCallback was called')
+ finishJSTest();
+}
-function requestFailed2(reason)
+function expectedInvalidOfferToReceiveAudio(reason)
{
- testPassed('requestFailed was called.');
+ testPassed('expectedInvalidOfferToReceiveVideo called.');
+ window.error = reason;
+ shouldBe('error', '"Invalid offerToReceiveAudio"');
+ finishJSTest();
+}
- errorReason = reason;
- shouldBe('errorReason', '"TEST_ERROR"');
+function expectedInvalidOfferToReceiveVideo(reason)
+{
+ testPassed('expectedInvalidOfferToReceiveVideo called.');
+ window.error = reason;
+ shouldBe('error', '"Invalid offerToReceiveVideo"');
+ shouldNotThrow("pc.createOffer(unexpectedCallback, expectedInvalidOfferToReceiveAudio, {offerToReceiveVideo:0, offerToReceiveAudio:-1});");
+}
+
+function expectedCreateOfferFailed5(reason) {
+ testPassed('expectedCreateOfferFailed5 was called.');
+ window.error = reason;
+ shouldBe('error', '"TEST_ERROR"');
+ shouldNotThrow("pc.createOffer(unexpectedCallback, expectedInvalidOfferToReceiveVideo, {offerToReceiveVideo:-1, offerToReceiveAudio:0});");
+}
- shouldNotThrow("pc.createOffer(dummy, dummy);");
- shouldNotThrow("pc.createOffer(dummy, dummy, {});");
- shouldNotThrow("pc.createOffer(dummy, dummy, {voiceActivityDetection:false});");
- shouldNotThrow("pc.createOffer(dummy, dummy, {iceRestart:true});");
- shouldNotThrow("pc.createOffer(dummy, dummy, {voiceActivityDetection:false, iceRestart:true});");
+function createOfferSucceeded2() {
+ testPassed('createOfferSucceeded2 was called.');
+ shouldNotThrow("pc.createOffer(unexpectedCallback, expectedCreateOfferFailed5, {offerToReceiveVideo:1, offerToReceiveAudio:0, voiceActivityDetection:false, iceRestart:true});");
+}
- // Deprecated.
- shouldThrow("pc.createOffer(dummy, dummy, {offerToReceiveVideo:-1, offerToReceiveAudio:0});");
- shouldThrow("pc.createOffer(dummy, dummy, {offerToReceiveVideo:0, offerToReceiveAudio:-1});");
- shouldNotThrow("pc.createOffer(dummy, dummy, {offerToReceiveVideo:1, offerToReceiveAudio:0, voiceActivityDetection:false, iceRestart:true});");
+function expectedCreateOfferFailed4(reason) {
+ testPassed('expectedCreateOfferFailed4 was called.');
+ window.error = reason;
+ shouldBe('error', '"TEST_ERROR"');
+ shouldNotThrow("pc.createOffer(createOfferSucceeded2, unexpectedCallback, {iceRestart:true});");
+}
- finishJSTest();
+function expectedCreateOfferFailed3(reason) {
+ testPassed('expectedCreateOfferFailed3 was called.');
+ window.error = reason;
+ shouldBe('error', '"TEST_ERROR"');
+ shouldNotThrow("pc.createOffer(unexpectedCallback, expectedCreateOfferFailed4, {voiceActivityDetection:false});");
}
-function requestSucceeded2(sd)
-{
- testFailed('requestSucceeded was called.');
- finishJSTest();
+function expectedCreateOfferFailed2(reason) {
+ testPassed('expectedCreateOfferFailed2 was called.');
+ window.error = reason;
+ shouldBe('error', '"TEST_ERROR"');
+ shouldNotThrow("pc.createOffer(unexpectedCallback, expectedCreateOfferFailed3, {});");
}
-function requestFailed1()
+function expectedCreateOfferFailed1(reason)
{
- testFailed('requestFailed was called.');
- finishJSTest();
+ testPassed('expectedCreateOfferFailed1 was called.');
+ window.error = reason;
+ shouldBe('error', '"TEST_ERROR"');
+ shouldNotThrow("pc.createOffer(unexpectedCallback, expectedCreateOfferFailed2);");
}
-function requestSucceeded1(sd)
+function createOfferSucceeded1(sessionDescription)
{
- testPassed('requestSucceeded was called.');
-
- sessionDescription = sd;
+ testPassed('createOfferSucceeded1 was called.');
+ window.sessionDescription = sessionDescription;
shouldBe('sessionDescription.type', '"offer"');
+ shouldNotThrow('pc.createOffer(unexpectedCallback, expectedCreateOfferFailed1);');
+}
- pc.createOffer(requestSucceeded2, requestFailed2);
+function testExecutionOrderClosedConnection()
+{
+ var localPeerConnection = new webkitRTCPeerConnection(null, null);
+ localPeerConnection.close();
+ var counter = 0;
+ window.events = [];
+ Promise.resolve().then(_ => window.events[counter++] = 1);
+ localPeerConnection.createOffer(unexpectedCallback, (reason) => {
+ window.error = reason;
+ shouldBe('error', '"The RTCPeerConnection\'s signalingState is \'closed\'."');
+ window.events[counter++] = 2;
+ });
+ Promise.resolve().then(_ => {
+ window.events[counter++] = 3;
+ shouldBe('events', '[1,2,3]');
+ });
}
+shouldNotThrow('testExecutionOrderClosedConnection()');
pc = new webkitRTCPeerConnection(null);
-pc.createOffer(requestSucceeded1, requestFailed1, {voiceActivityDetection:true, iceRestart:true});
+shouldNotThrow('pc.createOffer(createOfferSucceeded1, unexpectedCallback, {voiceActivityDetection:true, iceRestart:true});');
window.jsTestIsAsync = true;
window.successfullyParsed = true;

Powered by Google App Engine
This is Rietveld 408576698