Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: webrtc/api/test/mock_webrtcsession.h

Issue 2238933002: Moving mock classes around so that they may be reused in other unittests (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Underscore in filenames Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/api/test/mock_peerconnection.h ('k') | webrtc/media/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/test/mock_webrtcsession.h
diff --git a/webrtc/api/test/mock_webrtcsession.h b/webrtc/api/test/mock_webrtcsession.h
new file mode 100644
index 0000000000000000000000000000000000000000..459e3490db2c94769d0dac0c6dade6e962d801a7
--- /dev/null
+++ b/webrtc/api/test/mock_webrtcsession.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2016 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_API_TEST_MOCK_WEBRTCSESSION_H_
+#define WEBRTC_API_TEST_MOCK_WEBRTCSESSION_H_
+
+#include <memory>
+#include <string>
+
+#include "webrtc/api/webrtcsession.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+namespace webrtc {
+
+class MockWebRtcSession : public webrtc::WebRtcSession {
+ public:
+ // TODO(nisse): Valid overrides commented out, because the gmock
+ // methods don't use any override declarations, and we want to avoid
+ // warnings from -Winconsistent-missing-override. See
+ // http://crbug.com/428099.
+ explicit MockWebRtcSession(MediaControllerInterface* media_controller)
+ : WebRtcSession(
+ media_controller,
+ rtc::Thread::Current(),
+ rtc::Thread::Current(),
+ rtc::Thread::Current(),
+ nullptr,
+ std::unique_ptr<cricket::TransportController>(
+ new cricket::TransportController(rtc::Thread::Current(),
+ rtc::Thread::Current(),
+ nullptr))) {}
+ MOCK_METHOD0(voice_channel, cricket::VoiceChannel*());
+ MOCK_METHOD0(video_channel, cricket::VideoChannel*());
+ // Libjingle uses "local" for a outgoing track, and "remote" for a incoming
+ // track.
+ MOCK_METHOD2(GetLocalTrackIdBySsrc, bool(uint32_t, std::string*));
+ MOCK_METHOD2(GetRemoteTrackIdBySsrc, bool(uint32_t, std::string*));
+ MOCK_METHOD1(GetTransportStats, bool(SessionStats*));
+ MOCK_METHOD2(GetLocalCertificate,
+ bool(const std::string& transport_name,
+ rtc::scoped_refptr<rtc::RTCCertificate>* certificate));
+
+ // Workaround for gmock's inability to cope with move-only return values.
+ std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate(
+ const std::string& transport_name) /* override */ {
+ return std::unique_ptr<rtc::SSLCertificate>(
+ GetRemoteSSLCertificate_ReturnsRawPointer(transport_name));
+ }
+ MOCK_METHOD1(GetRemoteSSLCertificate_ReturnsRawPointer,
+ rtc::SSLCertificate*(const std::string& transport_name));
+};
+
+} // namespace webrtc
+
+#endif // WEBRTC_API_TEST_MOCK_WEBRTCSESSION_H_
« no previous file with comments | « webrtc/api/test/mock_peerconnection.h ('k') | webrtc/media/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698