Index: remoting/protocol/jingle_session_unittest.cc |
diff --git a/remoting/protocol/jingle_session_unittest.cc b/remoting/protocol/jingle_session_unittest.cc |
index 95a1de50a6e0b23a7a9f945bcc776ad60965e7b9..872de6f1201fb8eb0ee6864d345095f418b1433f 100644 |
--- a/remoting/protocol/jingle_session_unittest.cc |
+++ b/remoting/protocol/jingle_session_unittest.cc |
@@ -23,6 +23,7 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
using testing::_; |
+using testing::AtLeast; |
using testing::AtMost; |
using testing::DeleteArg; |
using testing::DoAll; |
@@ -170,7 +171,7 @@ class JingleSessionTest : public testing::Test { |
void InitiateConnection(int auth_round_trips, |
FakeAuthenticator::Action auth_action, |
- bool expect_fail) { |
+ bool expect_fail, bool expect_session_route_change) { |
EXPECT_CALL(host_server_listener_, OnIncomingSession(_, _)) |
.WillOnce(DoAll( |
WithArg<0>(Invoke(this, &JingleSessionTest::SetHostSession)), |
@@ -196,6 +197,11 @@ class JingleSessionTest : public testing::Test { |
.Times(AtMost(1)); |
} |
} |
+ if (expect_session_route_change) { |
Sergey Ulanov
2012/07/23 22:05:37
It's better to put this in CreateChannel() as we e
simonmorris
2012/07/23 22:21:25
Done.
|
+ EXPECT_CALL(host_session_event_handler_, |
+ OnSessionRouteChange(kChannelName, _)) |
+ .Times(AtLeast(1)); |
+ } |
{ |
InSequence dummy; |
@@ -217,6 +223,11 @@ class JingleSessionTest : public testing::Test { |
.Times(AtMost(1)); |
} |
} |
+ if (expect_session_route_change) { |
+ EXPECT_CALL(client_session_event_handler_, |
+ OnSessionRouteChange(kChannelName, _)) |
+ .Times(AtLeast(1)); |
+ } |
scoped_ptr<Authenticator> authenticator(new FakeAuthenticator( |
FakeAuthenticator::CLIENT, auth_round_trips, auth_action, true)); |
@@ -303,7 +314,7 @@ TEST_F(JingleSessionTest, RejectConnection) { |
// Verify that we can connect two endpoints with single-step authentication. |
TEST_F(JingleSessionTest, Connect) { |
CreateSessionManagers(1, FakeAuthenticator::ACCEPT); |
- InitiateConnection(1, FakeAuthenticator::ACCEPT, false); |
+ InitiateConnection(1, FakeAuthenticator::ACCEPT, false, false); |
// Verify that the client specified correct initiator value. |
ASSERT_GT(host_signal_strategy_->received_messages().size(), 0U); |
@@ -319,26 +330,26 @@ TEST_F(JingleSessionTest, Connect) { |
// Verify that we can connect two endpoints with multi-step authentication. |
TEST_F(JingleSessionTest, ConnectWithMultistep) { |
CreateSessionManagers(3, FakeAuthenticator::ACCEPT); |
- InitiateConnection(3, FakeAuthenticator::ACCEPT, false); |
+ InitiateConnection(3, FakeAuthenticator::ACCEPT, false, false); |
} |
// Verify that connection is terminated when single-step auth fails. |
TEST_F(JingleSessionTest, ConnectWithBadAuth) { |
CreateSessionManagers(1, FakeAuthenticator::REJECT); |
- InitiateConnection(1, FakeAuthenticator::ACCEPT, true); |
+ InitiateConnection(1, FakeAuthenticator::ACCEPT, true, false); |
} |
// Verify that connection is terminated when multi-step auth fails. |
TEST_F(JingleSessionTest, ConnectWithBadMultistepAuth) { |
CreateSessionManagers(3, FakeAuthenticator::REJECT); |
- InitiateConnection(3, FakeAuthenticator::ACCEPT, true); |
+ InitiateConnection(3, FakeAuthenticator::ACCEPT, true, false); |
} |
// Verify that data can be sent over stream channel. |
TEST_F(JingleSessionTest, TestStreamChannel) { |
CreateSessionManagers(1, FakeAuthenticator::ACCEPT); |
ASSERT_NO_FATAL_FAILURE( |
- InitiateConnection(1, FakeAuthenticator::ACCEPT, false)); |
+ InitiateConnection(1, FakeAuthenticator::ACCEPT, false, true)); |
ASSERT_NO_FATAL_FAILURE(CreateChannel()); |
@@ -353,7 +364,7 @@ TEST_F(JingleSessionTest, TestStreamChannel) { |
TEST_F(JingleSessionTest, TestMultistepAuthStreamChannel) { |
CreateSessionManagers(3, FakeAuthenticator::ACCEPT); |
ASSERT_NO_FATAL_FAILURE( |
- InitiateConnection(3, FakeAuthenticator::ACCEPT, false)); |
+ InitiateConnection(3, FakeAuthenticator::ACCEPT, false, true)); |
ASSERT_NO_FATAL_FAILURE(CreateChannel()); |
@@ -368,7 +379,7 @@ TEST_F(JingleSessionTest, TestMultistepAuthStreamChannel) { |
TEST_F(JingleSessionTest, TestFailedChannelAuth) { |
CreateSessionManagers(1, FakeAuthenticator::REJECT_CHANNEL); |
ASSERT_NO_FATAL_FAILURE( |
- InitiateConnection(1, FakeAuthenticator::ACCEPT, false)); |
+ InitiateConnection(1, FakeAuthenticator::ACCEPT, false, true)); |
client_session_->CreateStreamChannel(kChannelName, base::Bind( |
&JingleSessionTest::OnClientChannelCreated, base::Unretained(this))); |