Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Unified Diff: remoting/protocol/jingle_session.cc

Issue 8743023: Separate Authenticator and Session unittests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/jingle_session.h ('k') | remoting/protocol/jingle_session_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/jingle_session.cc
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index 40f06579db13724e9c3b0da708ee6c4b63c4c98b..0d6dc4f21ecb77fa4dfa262f461652b634a2bf75 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() {
« no previous file with comments | « remoting/protocol/jingle_session.h ('k') | remoting/protocol/jingle_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698