Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. * Constructor.
  8. *
  9. * @param {string} id RTC id
  10. * @param {boolean} usesUnifiedPlan
  11. */
  12. constructor(id, usesUnifiedPlan) {
  13. this.id = id;
  14. this._usesUnifiedPlan = usesUnifiedPlan;
  15. }
  16. /**
  17. * {@link TraceablePeerConnection.localDescription}.
  18. *
  19. * @returns {Object}
  20. */
  21. get localDescription() {
  22. return {
  23. sdp: ''
  24. };
  25. }
  26. /**
  27. * {@link TraceablePeerConnection.remoteDescription}.
  28. *
  29. * @returns {Object}
  30. */
  31. get remoteDescription() {
  32. return {
  33. sdp: ''
  34. };
  35. }
  36. /**
  37. * {@link TraceablePeerConnection.createAnswer}.
  38. *
  39. * @returns {Promise<Object>}
  40. */
  41. createAnswer() {
  42. return Promise.resolve(/* answer */{});
  43. }
  44. /**
  45. * {@link TraceablePeerConnection.setLocalDescription}.
  46. *
  47. * @returns {Promise<void>}
  48. */
  49. setLocalDescription() {
  50. return Promise.resolve();
  51. }
  52. /**
  53. * {@link TraceablePeerConnection.setRemoteDescription}.
  54. *
  55. * @returns {Promise<void>}
  56. */
  57. setRemoteDescription() {
  58. return Promise.resolve();
  59. }
  60. /**
  61. * {@link TraceablePeerConnection.setSenderVideoConstraints}.
  62. */
  63. setSenderVideoConstraints() {
  64. }
  65. /**
  66. * {@link TraceablePeerConnection.setVideoTransferActive}.
  67. */
  68. setVideoTransferActive() {
  69. return false;
  70. }
  71. /**
  72. * {@link TraceablePeerConnection.usesUnifiedPlan}.
  73. */
  74. usesUnifiedPlan() {
  75. return this._usesUnifiedPlan;
  76. }
  77. }
  78. /**
  79. * Mock {@link RTC} - add things as needed, but only things useful for all tests.
  80. */
  81. export class MockRTC {
  82. /**
  83. * {@link RTC.createPeerConnection}.
  84. *
  85. * @returns {MockPeerConnection}
  86. */
  87. createPeerConnection() {
  88. this.pc = new MockPeerConnection();
  89. return this.pc;
  90. }
  91. }
  92. /* eslint-enable no-empty-function */