You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* eslint-disable no-empty-function */
  2. /**
  3. * Mock {@link TraceablePeerConnection} - add things as needed, but only things useful for all tests.
  4. */
  5. export class MockPeerConnection {
  6. /**
  7. * {@link TraceablePeerConnection.localDescription}.
  8. *
  9. * @returns {Object}
  10. */
  11. get localDescription() {
  12. return {
  13. sdp: ''
  14. };
  15. }
  16. /**
  17. * {@link TraceablePeerConnection.remoteDescription}.
  18. *
  19. * @returns {Object}
  20. */
  21. get remoteDescription() {
  22. return {
  23. sdp: ''
  24. };
  25. }
  26. /**
  27. * {@link TraceablePeerConnection.createAnswer}.
  28. *
  29. * @returns {Promise<Object>}
  30. */
  31. createAnswer() {
  32. return Promise.resolve(/* answer */{});
  33. }
  34. /**
  35. * {@link TraceablePeerConnection.setLocalDescription}.
  36. *
  37. * @returns {Promise<void>}
  38. */
  39. setLocalDescription() {
  40. return Promise.resolve();
  41. }
  42. /**
  43. * {@link TraceablePeerConnection.setRemoteDescription}.
  44. *
  45. * @returns {Promise<void>}
  46. */
  47. setRemoteDescription() {
  48. return Promise.resolve();
  49. }
  50. /**
  51. * {@link TraceablePeerConnection.setSenderVideoConstraint}.
  52. */
  53. setSenderVideoConstraint() {
  54. }
  55. /**
  56. * {@link TraceablePeerConnection.setVideoTransferActive}.
  57. */
  58. setVideoTransferActive() {
  59. return false;
  60. }
  61. }
  62. /**
  63. * Mock {@link RTC} - add things as needed, but only things useful for all tests.
  64. */
  65. export class MockRTC {
  66. /**
  67. * {@link RTC.createPeerConnection}.
  68. *
  69. * @returns {MockPeerConnection}
  70. */
  71. createPeerConnection() {
  72. this.pc = new MockPeerConnection();
  73. return this.pc;
  74. }
  75. }
  76. /* eslint-enable no-empty-function */