summaryrefslogtreecommitdiffstats
path: root/remoting/protocol/jingle_session_unittest.cc
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-13 06:28:49 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-13 06:28:49 +0000
commitbc407e962efd421576e6dad7cefde22ef0439f38 (patch)
tree267bea43b45377b65f4128a73c1488f8165b8de7 /remoting/protocol/jingle_session_unittest.cc
parent76e68448d44901e32e2166cb53677f132b7f2bd6 (diff)
downloadchromium_src-bc407e962efd421576e6dad7cefde22ef0439f38.zip
chromium_src-bc407e962efd421576e6dad7cefde22ef0439f38.tar.gz
chromium_src-bc407e962efd421576e6dad7cefde22ef0439f38.tar.bz2
Multi-step authentication support in JingleSession.
BUG=105214 Review URL: http://codereview.chromium.org/8774031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114187 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol/jingle_session_unittest.cc')
-rw-r--r--remoting/protocol/jingle_session_unittest.cc41
1 files changed, 34 insertions, 7 deletions
diff --git a/remoting/protocol/jingle_session_unittest.cc b/remoting/protocol/jingle_session_unittest.cc
index 8ca7dcf..6c1fdfb 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);