Commit ae6a05c5 authored by Philipp Hancke's avatar Philipp Hancke Committed by Commit Bot

webrtc wpt: pass test in promise_test and async_test

passes the test argument in promise_test and async_test
so it can be used to add cleanup.
Change done with a jscodeshift codemod that detects
there were no arguments to promise_test (or async_test):

export default function transformer(file, api) {
  const j = api.jscodeshift;
  return j(file.source)
    // .find(j.CallExpression)
    .find(j.CallExpression, {callee: {type: 'Identifier', name: 'promise_test'}})
    .forEach(path => {
        if (path.value.arguments[0].params.length === 0) {
          path.value.arguments[0].params.push(j.identifier('t'));
        }
    })
    .toSource();
};

BUG=836871

Change-Id: Ie7dd7fb0dd8a4da6c4c00f3616fd41d1d47854ef
Reviewed-on: https://chromium-review.googlesource.com/1047674Reviewed-by: default avatarHarald Alvestrand <hta@chromium.org>
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556711}
parent 38ffe94e
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
DOMString peerIdentity; DOMString peerIdentity;
}; };
*/ */
promise_test(() => { promise_test(t => {
const pc = new RTCPeerConnection(); const pc = new RTCPeerConnection();
const port = window.location.port; const port = window.location.port;
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
// When generating assertion, the RTCPeerConnection doesn't care if the returned assertion // When generating assertion, the RTCPeerConnection doesn't care if the returned assertion
// represents identity of different domain // represents identity of different domain
promise_test(() => { promise_test(t => {
const pc = new RTCPeerConnection(); const pc = new RTCPeerConnection();
const port = window.location.port; const port = window.location.port;
...@@ -278,7 +278,7 @@ ...@@ -278,7 +278,7 @@
value is provided for the peerIdentity member of RTCConfiguration, the value from value is provided for the peerIdentity member of RTCConfiguration, the value from
RTCConfiguration is used. RTCConfiguration is used.
*/ */
promise_test(() => { promise_test(t => {
const pc = new RTCPeerConnection({ const pc = new RTCPeerConnection({
peerIdentity: 'bob@example.net' peerIdentity: 'bob@example.net'
}); });
...@@ -302,7 +302,7 @@ ...@@ -302,7 +302,7 @@
9.6. setIdentityProvider 9.6. setIdentityProvider
3. If any identity provider value has changed, discard any stored identity assertion. 3. If any identity provider value has changed, discard any stored identity assertion.
*/ */
promise_test(() => { promise_test(t => {
const pc = new RTCPeerConnection(); const pc = new RTCPeerConnection();
const port = window.location.port; const port = window.location.port;
const [idpDomain] = getIdpDomains(); const [idpDomain] = getIdpDomains();
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
possibly encode, and 127 represents silence. possibly encode, and 127 represents silence.
*/ */
promise_test(() => { promise_test(t => {
const pc1 = new RTCPeerConnection(); const pc1 = new RTCPeerConnection();
const pc2 = new RTCPeerConnection(); const pc2 = new RTCPeerConnection();
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
added. added.
*/ */
promise_test(async () => { promise_test(async t => {
const caller = new RTCPeerConnection(); const caller = new RTCPeerConnection();
const callee = new RTCPeerConnection(); const callee = new RTCPeerConnection();
const { receiver } = caller.addTransceiver('audio'); const { receiver } = caller.addTransceiver('audio');
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
assert_stats_report_has_stats(statsReport, ['inbound-rtp']); assert_stats_report_has_stats(statsReport, ['inbound-rtp']);
}, 'receiver.getStats() via addTransceiver should return stats report containing inbound-rtp stats'); }, 'receiver.getStats() via addTransceiver should return stats report containing inbound-rtp stats');
promise_test(async () => { promise_test(async t => {
const caller = new RTCPeerConnection(); const caller = new RTCPeerConnection();
const callee = new RTCPeerConnection(); const callee = new RTCPeerConnection();
const stream = await navigator.mediaDevices.getUserMedia({audio:true}); const stream = await navigator.mediaDevices.getUserMedia({audio:true});
......
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