diff options
author | garykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-24 02:21:40 +0000 |
---|---|---|
committer | garykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-24 02:21:40 +0000 |
commit | ebf44f11859ce520a9541cdb436b4b2589ef2e73 (patch) | |
tree | 9ce36ee27955484b8e1bf1cf2072acdd97d656a9 /remoting | |
parent | 596fe8e78ed3433e8d8f6577de21c64593d10bea (diff) | |
download | chromium_src-ebf44f11859ce520a9541cdb436b4b2589ef2e73.zip chromium_src-ebf44f11859ce520a9541cdb436b4b2589ef2e73.tar.gz chromium_src-ebf44f11859ce520a9541cdb436b4b2589ef2e73.tar.bz2 |
Call ClientSession::Disconnect when Chromoting client disconnects.
BUG=84544
TEST=manual
Review URL: http://codereview.chromium.org/7981046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102638 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/host/chromoting_host.cc | 5 | ||||
-rw-r--r-- | remoting/host/client_session.cc | 3 | ||||
-rw-r--r-- | remoting/host/client_session.h | 5 | ||||
-rw-r--r-- | remoting/host/client_session_unittest.cc | 6 |
4 files changed, 11 insertions, 8 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc index 437a01c..f11ce8d 100644 --- a/remoting/host/chromoting_host.cc +++ b/remoting/host/chromoting_host.cc @@ -377,6 +377,9 @@ void ChromotingHost::OnClientDisconnected(ConnectionToClient* connection) { } // Close the connection to client just to be safe. + // TODO(garykac): This should be removed when we revisit our shutdown and + // disconnect code. This should only need to be done in + // ClientSession::Disconnect(). connection->Disconnect(); if (client->authenticated()) { @@ -398,6 +401,8 @@ void ChromotingHost::OnClientDisconnected(ConnectionToClient* connection) { desktop_environment_->OnLastDisconnect(); } } + + client->OnDisconnected(); } // TODO(sergeyu): Move this to SessionManager? diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc index 2aedcfa..312e6c1 100644 --- a/remoting/host/client_session.cc +++ b/remoting/host/client_session.cc @@ -120,8 +120,7 @@ void ClientSession::InjectMouseEvent(const MouseEvent& event) { } } -void ClientSession::Disconnect() { - connection_->Disconnect(); +void ClientSession::OnDisconnected() { UnpressKeys(); authenticated_ = false; } diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h index 31329d5..4cedefc 100644 --- a/remoting/host/client_session.h +++ b/remoting/host/client_session.h @@ -56,8 +56,9 @@ class ClientSession : public protocol::HostStub, virtual void InjectKeyEvent(const protocol::KeyEvent& event); virtual void InjectMouseEvent(const protocol::MouseEvent& event); - // Disconnect this client session. - void Disconnect(); + // Notifier called when the client is being disconnected. + // This should only be called by ChromotingHost. + void OnDisconnected(); // Set the authenticated flag or log a failure message as appropriate. void OnAuthorizationComplete(bool success); diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc index 34ad787..1734709 100644 --- a/remoting/host/client_session_unittest.cc +++ b/remoting/host/client_session_unittest.cc @@ -122,7 +122,6 @@ TEST_F(ClientSessionTest, InputStubFilter) { EXPECT_CALL(input_stub_, InjectKeyEvent(EqualsKeyEvent(2, true))); EXPECT_CALL(input_stub_, InjectKeyEvent(EqualsKeyEvent(2, false))); EXPECT_CALL(input_stub_, InjectMouseEvent(EqualsMouseEvent(200, 201))); - EXPECT_CALL(*connection_.get(), Disconnect()); // These events should not get through to the input stub, // because the client isn't authenticated yet. @@ -133,7 +132,7 @@ TEST_F(ClientSessionTest, InputStubFilter) { client_session_->InjectKeyEvent(key_event2_down); client_session_->InjectKeyEvent(key_event2_up); client_session_->InjectMouseEvent(mouse_event2); - client_session_->Disconnect(); + client_session_->OnDisconnected(); // These events should not get through to the input stub, // because the client has disconnected. client_session_->InjectKeyEvent(key_event3); @@ -162,7 +161,6 @@ TEST_F(ClientSessionTest, LocalInputTest) { EXPECT_CALL(session_event_handler_, LocalLoginSucceeded(_)); EXPECT_CALL(input_stub_, InjectMouseEvent(EqualsMouseEvent(100, 101))); EXPECT_CALL(input_stub_, InjectMouseEvent(EqualsMouseEvent(200, 201))); - EXPECT_CALL(*connection_.get(), Disconnect()); client_session_->BeginSessionRequest(&credentials, new DummyTask()); // This event should get through to the input stub. @@ -177,7 +175,7 @@ TEST_F(ClientSessionTest, LocalInputTest) { client_session_->InjectMouseEvent(mouse_event3); // TODO(jamiewalch): Verify that remote inputs are re-enabled eventually // (via dependency injection, not sleep!) - client_session_->Disconnect(); + client_session_->OnDisconnected(); } TEST_F(ClientSessionTest, UnpressKeys) { |