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

Unified Diff: webrtc/p2p/base/mockicetransport.h

Issue 2610663003: Create the MockIceTransport (Closed)
Patch Set: Merge Created 3 years, 11 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/p2p/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/mockicetransport.h
diff --git a/webrtc/p2p/base/mockicetransport.h b/webrtc/p2p/base/mockicetransport.h
new file mode 100644
index 0000000000000000000000000000000000000000..6b8b2375296baad21145814d2f49fe8f4c79f3e9
--- /dev/null
+++ b/webrtc/p2p/base/mockicetransport.h
@@ -0,0 +1,70 @@
+/*
+ * 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_P2P_BASE_MOCKICETRANSPORT_H_
+#define WEBRTC_P2P_BASE_MOCKICETRANSPORT_H_
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "webrtc/base/gunit.h"
+#include "webrtc/p2p/base/icetransportinternal.h"
+#include "webrtc/test/gmock.h"
+
+using testing::_;
+using testing::Return;
+
+namespace cricket {
+
+// Used in Chromium/remoting/protocol/channel_socket_adapter_unittest.cc
+class MockIceTransport : public cricket::TransportChannel {
+ public:
+ MockIceTransport() : cricket::TransportChannel(std::string(), 0) {
+ set_writable(true);
+ }
+
+ MOCK_METHOD4(SendPacket,
+ int(const char* data,
+ size_t len,
+ const rtc::PacketOptions& options,
+ int flags));
+ MOCK_METHOD2(SetOption, int(rtc::Socket::Option opt, int value));
+ MOCK_METHOD0(GetError, int());
+ MOCK_CONST_METHOD0(GetIceRole, cricket::IceRole());
+ MOCK_METHOD1(GetStats, bool(cricket::ConnectionInfos* infos));
+ MOCK_CONST_METHOD0(IsDtlsActive, bool());
+ MOCK_CONST_METHOD1(GetSslRole, bool(rtc::SSLRole* role));
+ MOCK_METHOD1(SetSrtpCiphers, bool(const std::vector<std::string>& ciphers));
+ MOCK_METHOD1(GetSrtpCipher, bool(std::string* cipher));
+ MOCK_METHOD1(GetSslCipher, bool(std::string* cipher));
+ MOCK_CONST_METHOD0(GetLocalCertificate,
+ rtc::scoped_refptr<rtc::RTCCertificate>());
+
+ // This can't be a real mock method because gmock doesn't support move-only
+ // return values.
+ std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate()
+ const override {
+ EXPECT_TRUE(false); // Never called.
+ return nullptr;
+ }
+
+ MOCK_METHOD6(ExportKeyingMaterial,
+ bool(const std::string& label,
+ const uint8_t* context,
+ size_t context_len,
+ bool use_context,
+ uint8_t* result,
+ size_t result_len));
+};
+
+} // namespace cricket
+
+#endif // WEBRTC_P2P_BASE_MOCKICETRANSPORT_H_
« no previous file with comments | « webrtc/p2p/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698