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

Unified Diff: remoting/protocol/jingle_session_unittest.cc

Issue 1530523002: More cleanups in JingleSessionManager interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@transport_context
Patch Set: Created 5 years 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 | « remoting/protocol/jingle_session_manager.cc ('k') | remoting/protocol/protocol_mock_objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/jingle_session_unittest.cc
diff --git a/remoting/protocol/jingle_session_unittest.cc b/remoting/protocol/jingle_session_unittest.cc
index 03cb5339ccab3a24fe6cbc989c6d0f50ee20cf5f..8ffd4dd8f10082517f74a1e566c372b96fa78dc9 100644
--- a/remoting/protocol/jingle_session_unittest.cc
+++ b/remoting/protocol/jingle_session_unittest.cc
@@ -48,7 +48,7 @@ namespace {
const char kHostJid[] = "host1@gmail.com/123";
const char kClientJid[] = "host2@gmail.com/321";
-class MockSessionManagerListener : public SessionManager::Listener {
+class MockSessionManagerListener {
public:
MOCK_METHOD2(OnIncomingSession,
void(Session*,
@@ -106,8 +106,11 @@ class JingleSessionTest : public testing::Test {
host_server_.reset(new JingleSessionManager(
make_scoped_ptr(new IceTransportFactory(new TransportContext(
nullptr, make_scoped_ptr(new ChromiumPortAllocatorFactory(nullptr)),
- network_settings_, TransportRole::SERVER)))));
- host_server_->Init(host_signal_strategy_.get(), &host_server_listener_);
+ network_settings_, TransportRole::SERVER))),
+ host_signal_strategy_.get()));
+ host_server_->AcceptIncoming(
+ base::Bind(&MockSessionManagerListener::OnIncomingSession,
+ base::Unretained(&host_server_listener_)));
scoped_ptr<AuthenticatorFactory> factory(
new FakeHostAuthenticatorFactory(auth_round_trips,
@@ -117,9 +120,8 @@ class JingleSessionTest : public testing::Test {
client_server_.reset(new JingleSessionManager(
make_scoped_ptr(new IceTransportFactory(new TransportContext(
nullptr, make_scoped_ptr(new ChromiumPortAllocatorFactory(nullptr)),
- network_settings_, TransportRole::CLIENT)))));
- client_server_->Init(client_signal_strategy_.get(),
- &client_server_listener_);
+ network_settings_, TransportRole::CLIENT))),
+ client_signal_strategy_.get()));
}
void CreateSessionManagers(int auth_round_trips,
@@ -128,14 +130,8 @@ class JingleSessionTest : public testing::Test {
}
void CloseSessionManager() {
- if (host_server_.get()) {
- host_server_->Close();
- host_server_.reset();
- }
- if (client_server_.get()) {
- client_server_->Close();
- client_server_.reset();
- }
+ host_server_.reset();
+ client_server_.reset();
host_signal_strategy_.reset();
client_signal_strategy_.reset();
}
@@ -224,7 +220,6 @@ class JingleSessionTest : public testing::Test {
scoped_ptr<JingleSessionManager> host_server_;
MockSessionManagerListener host_server_listener_;
scoped_ptr<JingleSessionManager> client_server_;
- MockSessionManagerListener client_server_listener_;
scoped_ptr<Session> host_session_;
MockSessionEventHandler host_session_event_handler_;
« no previous file with comments | « remoting/protocol/jingle_session_manager.cc ('k') | remoting/protocol/protocol_mock_objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698