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

Unified Diff: webrtc/pc/channelmanager_unittest.cc

Issue 2685093002: Switching some interfaces to use std::unique_ptr<>. (Closed)
Patch Set: Rebase onto master Created 3 years, 10 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
Index: webrtc/pc/channelmanager_unittest.cc
diff --git a/webrtc/pc/channelmanager_unittest.cc b/webrtc/pc/channelmanager_unittest.cc
index 74c359012c188a2405b1154c2700e44180ce84a3..deba6a11554f2046770dbbfcf5c5c0e8cc9adeaf 100644
--- a/webrtc/pc/channelmanager_unittest.cc
+++ b/webrtc/pc/channelmanager_unittest.cc
@@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <memory>
+
#include "webrtc/base/gunit.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/thread.h"
@@ -40,34 +42,28 @@ class ChannelManagerTest : public testing::Test {
ChannelManagerTest()
: fme_(new cricket::FakeMediaEngine()),
fdme_(new cricket::FakeDataEngine()),
- cm_(new cricket::ChannelManager(fme_, fdme_, rtc::Thread::Current())),
+ cm_(new cricket::ChannelManager(
+ std::unique_ptr<MediaEngineInterface>(fme_),
+ std::unique_ptr<DataEngineInterface>(fdme_),
+ rtc::Thread::Current())),
fake_call_(webrtc::Call::Config(&event_log_)),
- fake_mc_(cm_, &fake_call_),
+ fake_mc_(cm_.get(), &fake_call_),
transport_controller_(
- new cricket::FakeTransportController(ICEROLE_CONTROLLING)) {}
-
- virtual void SetUp() {
+ new cricket::FakeTransportController(ICEROLE_CONTROLLING)) {
fme_->SetAudioCodecs(MAKE_VECTOR(kAudioCodecs));
fme_->SetVideoCodecs(MAKE_VECTOR(kVideoCodecs));
}
- virtual void TearDown() {
- delete transport_controller_;
- delete cm_;
- cm_ = NULL;
- fdme_ = NULL;
- fme_ = NULL;
- }
-
webrtc::RtcEventLogNullImpl event_log_;
rtc::Thread network_;
rtc::Thread worker_;
+ // |fme_| and |fdme_| are actually owned by |cm_|.
cricket::FakeMediaEngine* fme_;
cricket::FakeDataEngine* fdme_;
- cricket::ChannelManager* cm_;
+ std::unique_ptr<cricket::ChannelManager> cm_;
cricket::FakeCall fake_call_;
cricket::FakeMediaController fake_mc_;
- cricket::FakeTransportController* transport_controller_;
+ std::unique_ptr<cricket::FakeTransportController> transport_controller_;
};
// Test that we startup/shutdown properly.
@@ -133,9 +129,8 @@ TEST_F(ChannelManagerTest, CreateDestroyChannelsOnThread) {
EXPECT_TRUE(cm_->set_worker_thread(&worker_));
EXPECT_TRUE(cm_->set_network_thread(&network_));
EXPECT_TRUE(cm_->Init());
- delete transport_controller_;
- transport_controller_ =
- new cricket::FakeTransportController(&network_, ICEROLE_CONTROLLING);
+ transport_controller_.reset(
+ new cricket::FakeTransportController(&network_, ICEROLE_CONTROLLING));
cricket::DtlsTransportInternal* rtp_transport =
transport_controller_->CreateDtlsTransport(
cricket::CN_AUDIO, cricket::ICE_CANDIDATE_COMPONENT_RTP);

Powered by Google App Engine
This is Rietveld 408576698