Commit 5862cd8f authored by Harald Alvestrand's avatar Harald Alvestrand Committed by Chromium LUCI CQ

Move OAuth ICE server configuration tests to new file

Since oauth is now part of webrtc-extensions, the test for it
should be in that directory.
This is preparatory to reviewing the rest of the iceServer tests.

Bug: chromium:1044901
Change-Id: I588a3469ab62c6c7866c4fc80a654bcd155f8661
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2567872Reviewed-by: default avatarHenrik Boström <hbos@chromium.org>
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832351}
parent 7a8981e3
This is a testharness.js-based test.
FAIL new RTCPeerConnection(config) - with turns server, credentialType oauth, and string credential should throw InvalidAccessError assert_throws_dom: function "() =>
makePc({ iceServers: [{
urls: 'turns:turn.example.org',
credentialType: 'oauth',
username: 'user',
credential: 'cred'
}] })" did not throw
FAIL setConfiguration(config) - with turns server, credentialType oauth, and string credential should throw InvalidAccessError assert_throws_dom: function "() =>
makePc({ iceServers: [{
urls: 'turns:turn.example.org',
credentialType: 'oauth',
username: 'user',
credential: 'cred'
}] })" did not throw
FAIL new RTCPeerConnection(config) - with turns server, credential type and credential from spec should not throw assert_equals: expected (string) "oauth" but got (undefined) undefined
FAIL setConfiguration(config) - with turns server, credential type and credential from spec should not throw assert_equals: expected (string) "oauth" but got (undefined) undefined
Harness: the test ran to completion.
<!doctype html>
<meta charset=utf-8>
<title>RTCConfiguration iceServers with OAuth credentials</title>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<script src='../webrtc/RTCConfiguration-helper.js'></script>
<script>
'use strict';
// These tests are based on
// https://w3c.github.io/webrtc-extensions/#rtcoauthcredential-dictionary
/*
4.3.2. To set a configuration
11.6. If scheme name is turn or turns, and server.credentialType is "oauth",
and server.credential is not an RTCOAuthCredential, then throw an
InvalidAccessError and abort these steps.
*/
config_test(makePc => {
assert_throws_dom('InvalidAccessError', () =>
makePc({ iceServers: [{
urls: 'turns:turn.example.org',
credentialType: 'oauth',
username: 'user',
credential: 'cred'
}] }));
}, 'with turns server, credentialType oauth, and string credential should throw InvalidAccessError');
config_test(makePc => {
const pc = makePc({ iceServers: [{
urls: 'turns:turn2.example.net',
username: '22BIjxU93h/IgwEb',
credential: {
macKey: 'WmtzanB3ZW9peFhtdm42NzUzNG0=',
accessToken: 'AAwg3kPHWPfvk9bDFL936wYvkoctMADzQ5VhNDgeMR3+ZlZ35byg972fW8QjpEl7bx91YLBPFsIhsxloWcXPhA=='
},
credentialType: 'oauth'
}]});
const { iceServers } = pc.getConfiguration();
const server = iceServers[0];
assert_equals(server.credentialType, 'oauth');
}, 'with turns server, credential type and credential from spec should not throw');
</script>
This is a testharness.js-based test.
Found 67 tests; 33 PASS, 34 FAIL, 0 TIMEOUT, 0 NOTRUN.
Found 65 tests; 33 PASS, 32 FAIL, 0 TIMEOUT, 0 NOTRUN.
FAIL new RTCPeerConnection() should have default configuration.iceServers of undefined assert_equals: expected (undefined) undefined but got (object) []
PASS new RTCPeerConnection(config) - {} should succeed
PASS setConfiguration(config) - {} should succeed
......@@ -120,19 +120,5 @@ FAIL setConfiguration(config) - with turns server, credentialType password, and
accessToken: ''
}
}] })" did not throw
FAIL new RTCPeerConnection(config) - with turns server, credentialType oauth, and string credential should throw InvalidAccessError assert_throws_dom: function "() =>
makePc({ iceServers: [{
urls: 'turns:turn.example.org',
credentialType: 'oauth',
username: 'user',
credential: 'cred'
}] })" did not throw
FAIL setConfiguration(config) - with turns server, credentialType oauth, and string credential should throw InvalidAccessError assert_throws_dom: function "() =>
makePc({ iceServers: [{
urls: 'turns:turn.example.org',
credentialType: 'oauth',
username: 'user',
credential: 'cred'
}] })" did not throw
Harness: the test ran to completion.
......@@ -370,36 +370,4 @@
}] }));
}, 'with turns server, credentialType password, and object credential should throw InvalidAccessError');
/*
4.3.2. To set a configuration
11.6. If scheme name is turn or turns, and server.credentialType is "oauth",
and server.credential is not an RTCOAuthCredential, then throw an
InvalidAccessError and abort these steps.
*/
config_test(makePc => {
assert_throws_dom('InvalidAccessError', () =>
makePc({ iceServers: [{
urls: 'turns:turn.example.org',
credentialType: 'oauth',
username: 'user',
credential: 'cred'
}] }));
}, 'with turns server, credentialType oauth, and string credential should throw InvalidAccessError');
/*
Tested
4.3.2. To set a configuration
11.1-6.
Untestable
4.3.2. To set a configuration
11.7. Append server to validatedServers.
Coverage Report
Tested 9
Not Tested 0
Untestable 1
Total 10
*/
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment