2016-08-16 01:19:43 -07:00
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-01-23 04:56:25 -08:00
|
|
|
#ifndef WEBRTC_PC_TEST_MOCK_WEBRTCSESSION_H_
|
|
|
|
|
#define WEBRTC_PC_TEST_MOCK_WEBRTCSESSION_H_
|
2016-08-16 01:19:43 -07:00
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
2017-01-23 04:56:25 -08:00
|
|
|
#include "webrtc/pc/webrtcsession.h"
|
2017-01-09 14:53:41 -08:00
|
|
|
#include "webrtc/media/sctp/sctptransportinternal.h"
|
2016-09-28 17:42:01 -07:00
|
|
|
#include "webrtc/test/gmock.h"
|
2016-08-16 01:19:43 -07:00
|
|
|
|
|
|
|
|
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.
|
2017-05-05 02:23:02 -07:00
|
|
|
explicit MockWebRtcSession(cricket::ChannelManager* channel_manager,
|
|
|
|
|
const cricket::MediaConfig& media_config)
|
|
|
|
|
: WebRtcSession(nullptr /* Call */,
|
|
|
|
|
channel_manager,
|
|
|
|
|
media_config,
|
|
|
|
|
nullptr, // event_log
|
2016-08-16 01:19:43 -07:00
|
|
|
rtc::Thread::Current(),
|
|
|
|
|
rtc::Thread::Current(),
|
|
|
|
|
rtc::Thread::Current(),
|
|
|
|
|
nullptr,
|
|
|
|
|
std::unique_ptr<cricket::TransportController>(
|
Negotiate the same SRTP crypto suites for every DTLS association formed.
Before this CL, we would negotiate:
- No crypto suites for data m= sections.
- A full set for audio m= sections.
- The full set, minus SRTP_AES128_CM_SHA1_32 for video m= sections.
However, this doesn't make sense with BUNDLE, since any DTLS
association could end up being used for any type of media. If
video is "bundled on" the audio transport (which is typical), it
will actually end up using SRTP_AES128_CM_SHA1_32.
So, this CL moves the responsibility of deciding SRTP crypto suites out
of BaseChannel and into DtlsTransport. The only two possibilities are
now "normal set" or "normal set + GCM", if enabled by the PC factory
options.
This fixes an issue (see linked bug) that was occurring when audio/video
were "bundled onto" the data transport. Since the data transport
wasn't negotiating any SRTP crypto suites, none were available to use
for audio/video, so the application would get black video/no audio.
This CL doesn't affect the SDES SRTP crypto suite negotiation;
it only affects the negotiation in the DLTS handshake, through
the use_srtp extension.
BUG=chromium:711243
Review-Url: https://codereview.webrtc.org/2815513012
Cr-Commit-Position: refs/heads/master@{#17810}
2017-04-21 03:23:33 -07:00
|
|
|
new cricket::TransportController(
|
|
|
|
|
rtc::Thread::Current(),
|
|
|
|
|
rtc::Thread::Current(),
|
|
|
|
|
nullptr,
|
|
|
|
|
/*redetermine_role_on_ice_restart=*/true,
|
|
|
|
|
rtc::CryptoOptions())),
|
2017-01-09 14:53:41 -08:00
|
|
|
std::unique_ptr<cricket::SctpTransportInternalFactory>()) {}
|
2016-08-16 01:19:43 -07:00
|
|
|
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*));
|
2017-06-02 06:44:03 -07:00
|
|
|
MOCK_METHOD0(GetCallStats, Call::Stats());
|
2016-12-19 04:58:02 -08:00
|
|
|
MOCK_METHOD1(GetStats,
|
|
|
|
|
std::unique_ptr<SessionStats>(const ChannelNamePairs&));
|
2016-08-16 01:19:43 -07:00
|
|
|
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
|
|
|
|
|
|
2017-01-23 04:56:25 -08:00
|
|
|
#endif // WEBRTC_PC_TEST_MOCK_WEBRTCSESSION_H_
|