api/test: Add Create() method to MockPeerConnectionInterface

Bug: webrtc:9620
Change-Id: Id389e433cceed6435f6d07c1eae70c2d582c617f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226323
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34491}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index a5e7d91..b80e500 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -949,6 +949,8 @@
 
     deps = [
       ":libjingle_peerconnection_api",
+      "../api:scoped_refptr",
+      "../rtc_base:refcount",
       "../test:test_support",
     ]
   }
diff --git a/api/DEPS b/api/DEPS
index cdd17e9..e912cd4 100644
--- a/api/DEPS
+++ b/api/DEPS
@@ -271,6 +271,10 @@
     "+test/gmock.h",
   ],
 
+  "mock_peerconnectioninterface\.h": [
+    "+rtc_base/ref_counted_object.h",
+  ],
+
   "simulated_network\.h": [
     "+rtc_base/random.h",
     "+rtc_base/thread_annotations.h",
diff --git a/api/test/mock_peerconnectioninterface.h b/api/test/mock_peerconnectioninterface.h
index b5d9423..cd67d32 100644
--- a/api/test/mock_peerconnectioninterface.h
+++ b/api/test/mock_peerconnectioninterface.h
@@ -18,7 +18,9 @@
 #include <vector>
 
 #include "api/peer_connection_interface.h"
+#include "api/scoped_refptr.h"
 #include "api/sctp_transport_interface.h"
+#include "rtc_base/ref_counted_object.h"
 #include "test/gmock.h"
 
 namespace webrtc {
@@ -26,6 +28,10 @@
 class MockPeerConnectionInterface
     : public rtc::RefCountedObject<webrtc::PeerConnectionInterface> {
  public:
+  static rtc::scoped_refptr<MockPeerConnectionInterface> Create() {
+    return new MockPeerConnectionInterface();
+  }
+
   // PeerConnectionInterface
   MOCK_METHOD(rtc::scoped_refptr<StreamCollectionInterface>,
               local_streams,