summaryrefslogtreecommitdiffstats
path: root/remoting/protocol/jingle_session.cc
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-13 03:54:28 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-13 03:54:28 +0000
commit57651a87aecad07517dd5d334ef0b45e872b70b9 (patch)
treec4cd753bf38216e6d31d554fd91fa86f98f2a780 /remoting/protocol/jingle_session.cc
parentf7e3fb85e5f15210155ef761fa4bbac674d6f501 (diff)
downloadchromium_src-57651a87aecad07517dd5d334ef0b45e872b70b9.zip
chromium_src-57651a87aecad07517dd5d334ef0b45e872b70b9.tar.gz
chromium_src-57651a87aecad07517dd5d334ef0b45e872b70b9.tar.bz2
Separate Authenticator and Session unittests.
Previously JingleSession unit tests were using real authenticators. Here I changed them to always use FakeAuthenticator and added new tests for channel authentication in v1_authenticator_unittest.cc . Also, to make new tests pass, fixed session-terminate message handling in JingleSession to return correct error code. BUG=105214 Review URL: http://codereview.chromium.org/8743023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114178 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol/jingle_session.cc')
-rw-r--r--remoting/protocol/jingle_session.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index 40f0657..0d6dc4f 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -45,6 +45,8 @@ JingleSession::JingleSession(
jid_ = cricket_session_->remote_name();
cricket_session_->SignalState.connect(this, &JingleSession::OnSessionState);
cricket_session_->SignalError.connect(this, &JingleSession::OnSessionError);
+ cricket_session_->SignalReceivedTerminateReason.connect(
+ this, &JingleSession::OnTerminateReason);
}
JingleSession::~JingleSession() {
@@ -244,6 +246,11 @@ void JingleSession::OnSessionError(
}
}
+void JingleSession::OnTerminateReason(cricket::Session* session,
+ const std::string& reason) {
+ terminate_reason_ = reason;
+}
+
void JingleSession::OnInitiate() {
DCHECK(CalledOnValidThread());
jid_ = cricket_session_->remote_name();
@@ -332,7 +339,16 @@ void JingleSession::OnAccept() {
void JingleSession::OnTerminate() {
DCHECK(CalledOnValidThread());
- CloseInternal(net::ERR_CONNECTION_ABORTED, OK);
+
+ if (terminate_reason_ == "success") {
+ CloseInternal(net::ERR_CONNECTION_ABORTED, OK);
+ } else if (terminate_reason_ == "decline") {
+ CloseInternal(net::ERR_CONNECTION_ABORTED, AUTHENTICATION_FAILED);
+ } else if (terminate_reason_ == "incompatible-protocol") {
+ CloseInternal(net::ERR_CONNECTION_ABORTED, INCOMPATIBLE_PROTOCOL);
+ } else {
+ CloseInternal(net::ERR_CONNECTION_ABORTED, UNKNOWN_ERROR);
+ }
}
void JingleSession::AcceptConnection() {