webrtc_m130/test/pc/e2e/test_peer.h
Artem Titov b907f1f9f8 Extract test peer creation into separate file
Extract test peer creation into separate file to simplify code and
increase readability. Also it is 1st step in bigger refactoring of PC
level test fixture implementation to make it more granular and reusable.

Change-Id: I687a17bda33a8eebc1ef0ddc0d54572e095fd709
Bug: webrtc:11479
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172628
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30980}
2020-04-02 12:44:05 +00:00

64 lines
2.1 KiB
C++

/*
* Copyright (c) 2019 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 TEST_PC_E2E_TEST_PEER_H_
#define TEST_PC_E2E_TEST_PEER_H_
#include <memory>
#include <vector>
#include "absl/memory/memory.h"
#include "api/test/frame_generator_interface.h"
#include "pc/peer_connection_wrapper.h"
#include "test/pc/e2e/peer_connection_quality_test_params.h"
namespace webrtc {
namespace webrtc_pc_e2e {
// Describes a single participant in the call.
class TestPeer final : public PeerConnectionWrapper {
public:
using PeerConnectionWrapper::PeerConnectionWrapper;
Params* params() const { return params_.get(); }
std::unique_ptr<test::FrameGeneratorInterface> ReleaseVideoGenerator(
size_t i) {
return std::move(video_generators_[i]);
}
void DetachAecDump() { audio_processing_->DetachAecDump(); }
// Adds provided |candidates| to the owned peer connection.
bool AddIceCandidates(
std::vector<std::unique_ptr<IceCandidateInterface>> candidates);
protected:
friend class TestPeerFactory;
TestPeer(rtc::scoped_refptr<PeerConnectionFactoryInterface> pc_factory,
rtc::scoped_refptr<PeerConnectionInterface> pc,
std::unique_ptr<MockPeerConnectionObserver> observer,
std::unique_ptr<Params> params,
std::vector<std::unique_ptr<test::FrameGeneratorInterface>>
video_generators,
rtc::scoped_refptr<AudioProcessing> audio_processing);
private:
std::unique_ptr<Params> params_;
std::vector<std::unique_ptr<test::FrameGeneratorInterface>> video_generators_;
rtc::scoped_refptr<AudioProcessing> audio_processing_;
std::vector<std::unique_ptr<IceCandidateInterface>> remote_ice_candidates_;
};
} // namespace webrtc_pc_e2e
} // namespace webrtc
#endif // TEST_PC_E2E_TEST_PEER_H_