Index: remoting/protocol/jingle_session_unittest.cc |
diff --git a/remoting/protocol/jingle_session_unittest.cc b/remoting/protocol/jingle_session_unittest.cc |
index 8ca7dcf133b483635e76a7104672928ef9c9af19..6c1fdfb8d281b0485309d2fbfce9d12c036aac8e 100644 |
--- a/remoting/protocol/jingle_session_unittest.cc |
+++ b/remoting/protocol/jingle_session_unittest.cc |
@@ -171,15 +171,15 @@ class JingleSessionTest : public testing::Test { |
{ |
InSequence dummy; |
+ EXPECT_CALL(host_connection_callback_, |
+ OnStateChange(Session::CONNECTED)) |
+ .Times(AtMost(1)); |
if (expect_fail) { |
EXPECT_CALL(host_connection_callback_, |
OnStateChange(Session::FAILED)) |
.Times(1); |
} else { |
EXPECT_CALL(host_connection_callback_, |
- OnStateChange(Session::CONNECTED)) |
- .Times(1); |
- EXPECT_CALL(host_connection_callback_, |
OnStateChange(Session::AUTHENTICATED)) |
.Times(1); |
} |
@@ -191,15 +191,15 @@ class JingleSessionTest : public testing::Test { |
EXPECT_CALL(client_connection_callback_, |
OnStateChange(Session::CONNECTING)) |
.Times(1); |
+ EXPECT_CALL(client_connection_callback_, |
+ OnStateChange(Session::CONNECTED)) |
+ .Times(AtMost(1)); |
if (expect_fail) { |
EXPECT_CALL(client_connection_callback_, |
OnStateChange(Session::FAILED)) |
.Times(1); |
} else { |
EXPECT_CALL(client_connection_callback_, |
- OnStateChange(Session::CONNECTED)) |
- .Times(1); |
- EXPECT_CALL(client_connection_callback_, |
OnStateChange(Session::AUTHENTICATED)) |
.Times(1); |
} |
@@ -326,12 +326,24 @@ TEST_F(JingleSessionTest, Connect) { |
InitiateConnection(1, FakeAuthenticator::ACCEPT, false); |
} |
-// Verify that we can't connect two endpoints with mismatched secrets. |
+// Verify that we can connect two endpoints with multi-step authentication. |
+TEST_F(JingleSessionTest, ConnectMultistep) { |
+ CreateServerPair(3, FakeAuthenticator::ACCEPT); |
+ InitiateConnection(3, FakeAuthenticator::ACCEPT, false); |
+} |
+ |
+// Verify that connection is terminated when auth fails. |
TEST_F(JingleSessionTest, ConnectBadAuth) { |
CreateServerPair(1, FakeAuthenticator::REJECT); |
InitiateConnection(1, FakeAuthenticator::ACCEPT, true); |
} |
+// Verify that connection is terminted when multi-step auth fails. |
+TEST_F(JingleSessionTest, ConnectBadMultistepAuth) { |
+ CreateServerPair(3, FakeAuthenticator::REJECT); |
+ InitiateConnection(3, FakeAuthenticator::ACCEPT, true); |
+} |
+ |
TEST_F(JingleSessionTest, ConnectBadChannelAuth) { |
CreateServerPair(1, FakeAuthenticator::REJECT_CHANNEL); |
ASSERT_NO_FATAL_FAILURE( |
@@ -374,6 +386,21 @@ TEST_F(JingleSessionTest, TestTcpChannel) { |
tester.CheckResults(); |
} |
+// Verify that we can connect channels with multistep auth. |
+TEST_F(JingleSessionTest, TestMultistepAuthTcpChannel) { |
+ CreateServerPair(3, FakeAuthenticator::ACCEPT); |
+ ASSERT_NO_FATAL_FAILURE( |
+ InitiateConnection(3, FakeAuthenticator::ACCEPT, false)); |
+ |
+ ASSERT_NO_FATAL_FAILURE(CreateChannel()); |
+ |
+ StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), |
+ kMessageSize, kMessages); |
+ tester.Start(); |
+ message_loop_.Run(); |
+ tester.CheckResults(); |
+} |
+ |
// Verify that data can be transmitted over the video RTP channel. |
TEST_F(JingleSessionTest, TestUdpChannel) { |
CreateServerPair(1, FakeAuthenticator::ACCEPT); |