Index: remoting/protocol/jingle_session_unittest.cc |
diff --git a/remoting/protocol/jingle_session_unittest.cc b/remoting/protocol/jingle_session_unittest.cc |
index d36dac1cbfd60431b77a241b080dd70857661469..297d995437bd4ead7268b3e5cf048d5f1997892d 100644 |
--- a/remoting/protocol/jingle_session_unittest.cc |
+++ b/remoting/protocol/jingle_session_unittest.cc |
@@ -185,6 +185,9 @@ 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)) |
@@ -192,9 +195,6 @@ class JingleSessionTest : public testing::Test { |
.WillOnce(QuitThreadOnCounter(¬_connected_peers)); |
} else { |
EXPECT_CALL(host_connection_callback_, |
- OnStateChange(Session::CONNECTED)) |
- .Times(1); |
- EXPECT_CALL(host_connection_callback_, |
OnStateChange(Session::AUTHENTICATED)) |
.Times(1) |
.WillOnce(QuitThreadOnCounter(¬_connected_peers)); |
@@ -211,11 +211,11 @@ 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::CONNECTED)) |
- .Times(1); |
- EXPECT_CALL(client_connection_callback_, |
OnStateChange(Session::AUTHENTICATED)) |
.Times(1) |
.WillOnce(QuitThreadOnCounter(¬_connected_peers)); |
@@ -350,12 +350,25 @@ TEST_F(JingleSessionTest, Connect) { |
ASSERT_TRUE(InitiateConnection(FakeAuthenticator::ACCEPT, 1, false)); |
} |
-// Verify that we can't connect two endpoints with mismatched secrets. |
+// Verify that we can connect two endpoints with multi-step |
+// authentication. |
Wez
2011/12/03 00:21:05
nit: premature line-wrap?
Sergey Ulanov
2011/12/06 19:37:07
Done.
|
+TEST_F(JingleSessionTest, ConnectMultistep) { |
+ CreateServerPair(FakeAuthenticator::ACCEPT, 3); |
+ ASSERT_TRUE(InitiateConnection(FakeAuthenticator::ACCEPT, 3, false)); |
+} |
+ |
+// Verify that connection is terminted when auth fails. |
TEST_F(JingleSessionTest, ConnectBadAuth) { |
CreateServerPair(FakeAuthenticator::REJECT, 1); |
ASSERT_TRUE(InitiateConnection(FakeAuthenticator::ACCEPT, 1, true)); |
} |
+// Verify that connection is terminted when multi-step auth fails. |
Wez
2011/12/03 00:21:05
nit: terminated
Sergey Ulanov
2011/12/06 19:37:07
Done.
|
+TEST_F(JingleSessionTest, ConnectBadMultistepAuth) { |
+ CreateServerPair(FakeAuthenticator::REJECT, 3); |
+ ASSERT_TRUE(InitiateConnection(FakeAuthenticator::ACCEPT, 3, true)); |
+} |
+ |
TEST_F(JingleSessionTest, ConnectBadChannelAuth) { |
CreateServerPair(FakeAuthenticator::REJECT_CHANNEL, 1); |
ASSERT_TRUE(InitiateConnection(FakeAuthenticator::ACCEPT, 1, false)); |
@@ -396,6 +409,20 @@ TEST_F(JingleSessionTest, TestTcpChannel) { |
tester.CheckResults(); |
} |
+// Verify that we can connect channgels with multistep auth. |
Wez
2011/12/03 00:21:05
nit: channels
Sergey Ulanov
2011/12/06 19:37:07
Done.
|
+TEST_F(JingleSessionTest, TestMultistepAuthTcpChannel) { |
+ CreateServerPair(FakeAuthenticator::ACCEPT, 3); |
+ ASSERT_TRUE(InitiateConnection(FakeAuthenticator::ACCEPT, 3, false)); |
+ |
+ ASSERT_TRUE(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(FakeAuthenticator::ACCEPT, 1); |