summaryrefslogtreecommitdiffstats
path: root/remoting/host
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-19 14:55:37 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-19 14:55:37 +0000
commita5d181f50c2543ac837623a0b619a6a487913fa5 (patch)
tree7ba018efcd8bbfb51478b5dd1bf0b5ed66bddf36 /remoting/host
parent48b6601cb7a02a3cd6ff74c8f9d5f222ddc2304f (diff)
downloadchromium_src-a5d181f50c2543ac837623a0b619a6a487913fa5.zip
chromium_src-a5d181f50c2543ac837623a0b619a6a487913fa5.tar.gz
chromium_src-a5d181f50c2543ac837623a0b619a6a487913fa5.tar.bz2
Set the initial resolution of an RDP session to the client screen resolution if it is available.
Changes in this CL: - The version of the control channel is increased to 3. This allows the host and client to tell if the peer supports capabilities negotiation or not. - The client and host negotiate supported capabilities by sending each other a list of the supported capabilities. Capabilities supported by both client and host are assumed to be enabled. - The client plugin and webapp negotiate the list of capabilities supported by the client. The webapp has the final word. - The DesktopEnvironment interface was extended to provide the list of all supported capabilities and receive the results of negotiation with the client. - Added the 'sendInitialResolution' capability. When it is enabled the client sends its screen resolution to the host once the connection has been established. - DesktopSessionProxy now waits for the client screen resolution when the 'sendInitialResolution' capability is enabled. BUG=230893 Review URL: https://chromiumcodereview.appspot.com/13932020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195192 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host')
-rw-r--r--remoting/host/basic_desktop_environment.cc7
-rw-r--r--remoting/host/basic_desktop_environment.h4
-rw-r--r--remoting/host/chromoting_host_unittest.cc15
-rw-r--r--remoting/host/client_session.cc65
-rw-r--r--remoting/host/client_session.h10
-rw-r--r--remoting/host/client_session_unittest.cc7
-rw-r--r--remoting/host/desktop_environment.h7
-rw-r--r--remoting/host/desktop_process_unittest.cc15
-rw-r--r--remoting/host/desktop_session_proxy.cc72
-rw-r--r--remoting/host/desktop_session_proxy.h18
-rw-r--r--remoting/host/host_mock_objects.h2
-rw-r--r--remoting/host/ipc_desktop_environment.cc15
-rw-r--r--remoting/host/ipc_desktop_environment.h2
-rw-r--r--remoting/host/ipc_desktop_environment_unittest.cc17
14 files changed, 208 insertions, 48 deletions
diff --git a/remoting/host/basic_desktop_environment.cc b/remoting/host/basic_desktop_environment.cc
index 9174e04..daef98a 100644
--- a/remoting/host/basic_desktop_environment.cc
+++ b/remoting/host/basic_desktop_environment.cc
@@ -46,6 +46,13 @@ scoped_ptr<ScreenControls> BasicDesktopEnvironment::CreateScreenControls() {
return scoped_ptr<ScreenControls>();
}
+std::string BasicDesktopEnvironment::GetCapabilities() const {
+ return std::string();
+}
+
+void BasicDesktopEnvironment::SetCapabilities(const std::string& capabilities) {
+}
+
scoped_ptr<media::ScreenCapturer>
BasicDesktopEnvironment::CreateVideoCapturer() {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
diff --git a/remoting/host/basic_desktop_environment.h b/remoting/host/basic_desktop_environment.h
index f5de55b..b73bba1 100644
--- a/remoting/host/basic_desktop_environment.h
+++ b/remoting/host/basic_desktop_environment.h
@@ -5,6 +5,8 @@
#ifndef REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_
#define REMOTING_HOST_BASIC_DESKTOP_ENVIRONMENT_H_
+#include <string>
+
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
@@ -27,6 +29,8 @@ class BasicDesktopEnvironment : public DesktopEnvironment {
virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE;
virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE;
virtual scoped_ptr<media::ScreenCapturer> CreateVideoCapturer() OVERRIDE;
+ virtual std::string GetCapabilities() const OVERRIDE;
+ virtual void SetCapabilities(const std::string& capabilities) OVERRIDE;
protected:
friend class BasicDesktopEnvironmentFactory;
diff --git a/remoting/host/chromoting_host_unittest.cc b/remoting/host/chromoting_host_unittest.cc
index b15fb8d..3f7768f 100644
--- a/remoting/host/chromoting_host_unittest.cc
+++ b/remoting/host/chromoting_host_unittest.cc
@@ -33,6 +33,7 @@ using ::remoting::protocol::SessionConfig;
using testing::_;
using testing::AnyNumber;
+using testing::AtMost;
using testing::AtLeast;
using testing::CreateFunctor;
using testing::DeleteArg;
@@ -283,13 +284,17 @@ class ChromotingHostTest : public testing::Test {
EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr())
.Times(0);
EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr())
- .Times(AnyNumber())
- .WillRepeatedly(Invoke(this, &ChromotingHostTest::CreateInputInjector));
+ .Times(AtMost(1))
+ .WillOnce(Invoke(this, &ChromotingHostTest::CreateInputInjector));
EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr())
- .Times(AnyNumber());
+ .Times(AtMost(1));
EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr())
- .Times(AnyNumber())
- .WillRepeatedly(Invoke(this, &ChromotingHostTest::CreateVideoCapturer));
+ .Times(AtMost(1))
+ .WillOnce(Invoke(this, &ChromotingHostTest::CreateVideoCapturer));
+ EXPECT_CALL(*desktop_environment, GetCapabilities())
+ .Times(AtMost(1));
+ EXPECT_CALL(*desktop_environment, SetCapabilities(_))
+ .Times(AtMost(1));
return desktop_environment;
}
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index 58b49a5..24cad35 100644
--- a/remoting/host/client_session.cc
+++ b/remoting/host/client_session.cc
@@ -8,6 +8,7 @@
#include "base/message_loop_proxy.h"
#include "media/video/capture/screen/screen_capturer.h"
+#include "remoting/base/capabilities.h"
#include "remoting/codec/audio_encoder.h"
#include "remoting/codec/audio_encoder_opus.h"
#include "remoting/codec/audio_encoder_speex.h"
@@ -96,6 +97,8 @@ ClientSession::~ClientSession() {
void ClientSession::NotifyClientResolution(
const protocol::ClientResolution& resolution) {
+ DCHECK(CalledOnValidThread());
+
if (!resolution.has_dips_width() || !resolution.has_dips_height())
return;
@@ -116,6 +119,8 @@ void ClientSession::NotifyClientResolution(
}
void ClientSession::ControlVideo(const protocol::VideoControl& video_control) {
+ DCHECK(CalledOnValidThread());
+
if (video_control.has_enable()) {
VLOG(1) << "Received VideoControl (enable="
<< video_control.enable() << ")";
@@ -125,6 +130,8 @@ void ClientSession::ControlVideo(const protocol::VideoControl& video_control) {
}
void ClientSession::ControlAudio(const protocol::AudioControl& audio_control) {
+ DCHECK(CalledOnValidThread());
+
if (audio_control.has_enable()) {
VLOG(1) << "Received AudioControl (enable="
<< audio_control.enable() << ")";
@@ -133,10 +140,42 @@ void ClientSession::ControlAudio(const protocol::AudioControl& audio_control) {
}
}
+void ClientSession::SetCapabilities(
+ const protocol::Capabilities& capabilities) {
+ DCHECK(CalledOnValidThread());
+
+ // The client should not send protocol::Capabilities if it is not supported by
+ // the config channel.
+ if (!connection_->session()->config().SupportsCapabilities()) {
+ LOG(ERROR) << "Unexpected protocol::Capabilities has been received.";
+ return;
+ }
+
+ // Ignore all the messages but the 1st one.
+ if (client_capabilities_) {
+ LOG(WARNING) << "protocol::Capabilities has been received already.";
+ return;
+ }
+
+ client_capabilities_ = make_scoped_ptr(new std::string());
+ if (capabilities.has_capabilities())
+ *client_capabilities_ = capabilities.capabilities();
+
+ VLOG(1) << "Client capabilities: " << *client_capabilities_;
+
+ // Calculate the set of capabilities enabled by both client and host and
+ // pass it to the desktop environment if it is available.
+ if (desktop_environment_) {
+ desktop_environment_->SetCapabilities(
+ IntersectCapabilities(*client_capabilities_, host_capabilities_));
+ }
+}
+
void ClientSession::OnConnectionAuthenticated(
protocol::ConnectionToClient* connection) {
DCHECK(CalledOnValidThread());
DCHECK_EQ(connection_.get(), connection);
+ DCHECK(!desktop_environment_);
auth_input_filter_.set_enabled(true);
auth_clipboard_filter_.set_enabled(true);
@@ -151,6 +190,8 @@ void ClientSession::OnConnectionAuthenticated(
this, &ClientSession::DisconnectSession);
}
+ // The session may be destroyed as the result result of this call, so it must
+ // be the last in this method.
event_handler_->OnSessionAuthenticated(this);
}
@@ -159,13 +200,35 @@ void ClientSession::OnConnectionChannelsConnected(
DCHECK(CalledOnValidThread());
DCHECK_EQ(connection_.get(), connection);
DCHECK(!audio_scheduler_);
- DCHECK(!desktop_environment_);
DCHECK(!input_injector_);
DCHECK(!screen_controls_);
DCHECK(!video_scheduler_);
+ // Create the desktop environment.
desktop_environment_ =
desktop_environment_factory_->Create(control_factory_.GetWeakPtr());
+ host_capabilities_ = desktop_environment_->GetCapabilities();
+
+ // Negotiate capabilities with the client.
+ if (connection_->session()->config().SupportsCapabilities()) {
+ VLOG(1) << "Host capabilities: " << host_capabilities_;
+
+ protocol::Capabilities capabilities;
+ capabilities.set_capabilities(host_capabilities_);
+ connection_->client_stub()->SetCapabilities(capabilities);
+
+ // |client_capabilities_| could have been received before all channels were
+ // connected. Process them now.
+ if (client_capabilities_) {
+ desktop_environment_->SetCapabilities(
+ IntersectCapabilities(*client_capabilities_, host_capabilities_));
+ }
+ } else {
+ VLOG(1) << "The client does not support any capabilities.";
+
+ client_capabilities_ = make_scoped_ptr(new std::string());
+ desktop_environment_->SetCapabilities(*client_capabilities_);
+ }
// Create the object that controls the screen resolution.
screen_controls_ = desktop_environment_->CreateScreenControls();
diff --git a/remoting/host/client_session.h b/remoting/host/client_session.h
index da850bc..778243d 100644
--- a/remoting/host/client_session.h
+++ b/remoting/host/client_session.h
@@ -5,7 +5,7 @@
#ifndef REMOTING_HOST_CLIENT_SESSION_H_
#define REMOTING_HOST_CLIENT_SESSION_H_
-#include <list>
+#include <string>
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
@@ -104,6 +104,8 @@ class ClientSession
const protocol::VideoControl& video_control) OVERRIDE;
virtual void ControlAudio(
const protocol::AudioControl& audio_control) OVERRIDE;
+ virtual void SetCapabilities(
+ const protocol::Capabilities& capabilities) OVERRIDE;
// protocol::ConnectionToClient::EventHandler interface.
virtual void OnConnectionAuthenticated(
@@ -209,6 +211,12 @@ class ClientSession
scoped_refptr<AudioScheduler> audio_scheduler_;
scoped_refptr<VideoScheduler> video_scheduler_;
+ // The set of all capabilities supported by the client.
+ scoped_ptr<std::string> client_capabilities_;
+
+ // The set of all capabilities supported by the host.
+ std::string host_capabilities_;
+
// Used to inject mouse and keyboard input and handle clipboard events.
scoped_ptr<InputInjector> input_injector_;
diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc
index e12758e..a5c687b 100644
--- a/remoting/host/client_session_unittest.cc
+++ b/remoting/host/client_session_unittest.cc
@@ -26,6 +26,7 @@ using protocol::SessionConfig;
using testing::_;
using testing::AnyNumber;
+using testing::AtMost;
using testing::DeleteArg;
using testing::DoAll;
using testing::Expectation;
@@ -190,9 +191,13 @@ DesktopEnvironment* ClientSessionTest::CreateDesktopEnvironment() {
EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr())
.WillOnce(Invoke(this, &ClientSessionTest::CreateInputInjector));
EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr())
- .Times(1);
+ .Times(AtMost(1));
EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr())
.WillOnce(Invoke(this, &ClientSessionTest::CreateVideoCapturer));
+ EXPECT_CALL(*desktop_environment, GetCapabilities())
+ .Times(AtMost(1));
+ EXPECT_CALL(*desktop_environment, SetCapabilities(_))
+ .Times(AtMost(1));
return desktop_environment;
}
diff --git a/remoting/host/desktop_environment.h b/remoting/host/desktop_environment.h
index 0df2e01a..0e8b480 100644
--- a/remoting/host/desktop_environment.h
+++ b/remoting/host/desktop_environment.h
@@ -40,6 +40,13 @@ class DesktopEnvironment {
virtual scoped_ptr<InputInjector> CreateInputInjector() = 0;
virtual scoped_ptr<ScreenControls> CreateScreenControls() = 0;
virtual scoped_ptr<media::ScreenCapturer> CreateVideoCapturer() = 0;
+
+ // Returns the set of all capabilities supported by |this|.
+ virtual std::string GetCapabilities() const = 0;
+
+ // Passes the final set of capabilities negotiated between the client and host
+ // to |this|.
+ virtual void SetCapabilities(const std::string& capabilities) = 0;
};
// Used to create |DesktopEnvironment| instances.
diff --git a/remoting/host/desktop_process_unittest.cc b/remoting/host/desktop_process_unittest.cc
index bc50988..0c019be 100644
--- a/remoting/host/desktop_process_unittest.cc
+++ b/remoting/host/desktop_process_unittest.cc
@@ -30,6 +30,7 @@
using testing::_;
using testing::AnyNumber;
+using testing::AtMost;
using testing::InSequence;
using testing::Return;
@@ -198,13 +199,17 @@ DesktopEnvironment* DesktopProcessTest::CreateDesktopEnvironment() {
EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr())
.Times(0);
EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr())
- .Times(AnyNumber())
- .WillRepeatedly(Invoke(this, &DesktopProcessTest::CreateInputInjector));
+ .Times(AtMost(1))
+ .WillOnce(Invoke(this, &DesktopProcessTest::CreateInputInjector));
EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr())
- .Times(AnyNumber());
+ .Times(AtMost(1));
EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr())
- .Times(AnyNumber())
- .WillRepeatedly(Invoke(this, &DesktopProcessTest::CreateVideoCapturer));
+ .Times(AtMost(1))
+ .WillOnce(Invoke(this, &DesktopProcessTest::CreateVideoCapturer));
+ EXPECT_CALL(*desktop_environment, GetCapabilities())
+ .Times(AtMost(1));
+ EXPECT_CALL(*desktop_environment, SetCapabilities(_))
+ .Times(AtMost(1));
// Notify the test that the desktop environment has been created.
network_listener_.OnDesktopEnvironmentCreated();
diff --git a/remoting/host/desktop_session_proxy.cc b/remoting/host/desktop_session_proxy.cc
index 04add54..a61ab7c 100644
--- a/remoting/host/desktop_session_proxy.cc
+++ b/remoting/host/desktop_session_proxy.cc
@@ -12,6 +12,7 @@
#include "ipc/ipc_channel_proxy.h"
#include "ipc/ipc_message_macros.h"
#include "media/video/capture/screen/screen_capture_data.h"
+#include "remoting/base/capabilities.h"
#include "remoting/host/chromoting_messages.h"
#include "remoting/host/client_session.h"
#include "remoting/host/client_session_control.h"
@@ -28,6 +29,8 @@
#include "base/win/scoped_handle.h"
#endif // defined(OS_WIN)
+const char kSendInitialResolution[] = "sendInitialResolution";
+
namespace remoting {
DesktopSessionProxy::DesktopSessionProxy(
@@ -35,14 +38,19 @@ DesktopSessionProxy::DesktopSessionProxy(
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner,
- base::WeakPtr<ClientSessionControl> client_session_control)
+ base::WeakPtr<ClientSessionControl> client_session_control,
+ base::WeakPtr<DesktopSessionConnector> desktop_session_connector,
+ bool virtual_terminal)
: audio_capture_task_runner_(audio_capture_task_runner),
caller_task_runner_(caller_task_runner),
io_task_runner_(io_task_runner),
video_capture_task_runner_(video_capture_task_runner),
client_session_control_(client_session_control),
+ desktop_session_connector_(desktop_session_connector),
desktop_process_(base::kNullProcessHandle),
- pending_capture_frame_requests_(0) {
+ pending_capture_frame_requests_(0),
+ is_desktop_session_connected_(false),
+ virtual_terminal_(virtual_terminal) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
}
@@ -70,6 +78,33 @@ scoped_ptr<media::ScreenCapturer> DesktopSessionProxy::CreateVideoCapturer() {
return scoped_ptr<media::ScreenCapturer>(new IpcVideoFrameCapturer(this));
}
+std::string DesktopSessionProxy::GetCapabilities() const {
+ // Ask the client to send it's resolution unconditionally.
+ return virtual_terminal_ ? kSendInitialResolution : std::string();
+}
+
+void DesktopSessionProxy::SetCapabilities(const std::string& capabilities) {
+ // Delay creation of the desktop session until the client screen resolution is
+ // received if the desktop session requires the initial screen resolution
+ // (when |virtual_terminal_| is true) and the client is expected to
+ // sent its screen resolution (the 'sendInitialResolution' capability is
+ // supported).
+ if (virtual_terminal_ &&
+ HasCapability(capabilities, kSendInitialResolution)) {
+ VLOG(1) << "Waiting for the client screen resolution.";
+ return;
+ }
+
+ // Connect to the desktop session.
+ if (!is_desktop_session_connected_) {
+ is_desktop_session_connected_ = true;
+ if (desktop_session_connector_) {
+ desktop_session_connector_->ConnectTerminal(this, screen_resolution_,
+ virtual_terminal_);
+ }
+ }
+}
+
bool DesktopSessionProxy::OnMessageReceived(const IPC::Message& message) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
@@ -288,36 +323,35 @@ void DesktopSessionProxy::SetScreenResolution(
const ScreenResolution& resolution) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
+ if (!resolution.IsValid())
+ return;
+
screen_resolution_ = resolution;
- if (!screen_resolution_.IsValid())
+
+ // Connect to the desktop session if it is not done yet.
+ if (!is_desktop_session_connected_) {
+ is_desktop_session_connected_ = true;
+ if (desktop_session_connector_) {
+ desktop_session_connector_->ConnectTerminal(this, screen_resolution_,
+ virtual_terminal_);
+ }
return;
+ }
// Pass the client's resolution to both daemon and desktop session agent.
- // Depending on the session kind the screen resolution ccan be set by either
+ // Depending on the session kind the screen resolution can be set by either
// the daemon (for example RDP sessions on Windows) or by the desktop session
// agent (when sharing the physical console).
if (desktop_session_connector_)
- desktop_session_connector_->SetScreenResolution(this, resolution);
+ desktop_session_connector_->SetScreenResolution(this, screen_resolution_);
SendToDesktop(
- new ChromotingNetworkDesktopMsg_SetScreenResolution(resolution));
-}
-
-void DesktopSessionProxy::ConnectToDesktopSession(
- base::WeakPtr<DesktopSessionConnector> desktop_session_connector,
- bool virtual_terminal) {
- DCHECK(caller_task_runner_->BelongsToCurrentThread());
- DCHECK(!desktop_session_connector_);
- DCHECK(desktop_session_connector);
-
- desktop_session_connector_ = desktop_session_connector;
- desktop_session_connector_->ConnectTerminal(
- this, ScreenResolution(), virtual_terminal);
+ new ChromotingNetworkDesktopMsg_SetScreenResolution(screen_resolution_));
}
DesktopSessionProxy::~DesktopSessionProxy() {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
- if (desktop_session_connector_)
+ if (desktop_session_connector_ && is_desktop_session_connected_)
desktop_session_connector_->DisconnectTerminal(this);
if (desktop_process_ != base::kNullProcessHandle) {
diff --git a/remoting/host/desktop_session_proxy.h b/remoting/host/desktop_session_proxy.h
index c172228..34eac55 100644
--- a/remoting/host/desktop_session_proxy.h
+++ b/remoting/host/desktop_session_proxy.h
@@ -70,13 +70,17 @@ class DesktopSessionProxy
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner,
- base::WeakPtr<ClientSessionControl> client_session_control);
+ base::WeakPtr<ClientSessionControl> client_session_control,
+ base::WeakPtr<DesktopSessionConnector> desktop_session_connector,
+ bool virtual_terminal);
// Mirrors DesktopEnvironment.
scoped_ptr<AudioCapturer> CreateAudioCapturer();
scoped_ptr<InputInjector> CreateInputInjector();
scoped_ptr<ScreenControls> CreateScreenControls();
scoped_ptr<media::ScreenCapturer> CreateVideoCapturer();
+ std::string GetCapabilities() const;
+ void SetCapabilities(const std::string& capabilities);
// IPC::Listener implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
@@ -87,11 +91,6 @@ class DesktopSessionProxy
bool AttachToDesktop(base::ProcessHandle desktop_process,
IPC::PlatformFileForTransit desktop_pipe);
- // Binds |this| to a desktop session.
- void ConnectToDesktopSession(
- base::WeakPtr<DesktopSessionConnector> desktop_session_connector,
- bool virtual_terminal);
-
// Closes the connection to the desktop session agent and cleans up
// the associated resources.
void DetachFromDesktop();
@@ -183,7 +182,7 @@ class DesktopSessionProxy
// Used to disconnect the client session.
base::WeakPtr<ClientSessionControl> client_session_control_;
- // Used to bind to a desktop session and receive notifications every time
+ // Used to create a desktop session and receive notifications every time
// the desktop process is replaced.
base::WeakPtr<DesktopSessionConnector> desktop_session_connector_;
@@ -205,6 +204,11 @@ class DesktopSessionProxy
// desktop session agent.
ScreenResolution screen_resolution_;
+ // True if |this| has been connected to the desktop session.
+ bool is_desktop_session_connected_;
+
+ bool virtual_terminal_;
+
DISALLOW_COPY_AND_ASSIGN(DesktopSessionProxy);
};
diff --git a/remoting/host/host_mock_objects.h b/remoting/host/host_mock_objects.h
index 0dd4020..499b198 100644
--- a/remoting/host/host_mock_objects.h
+++ b/remoting/host/host_mock_objects.h
@@ -34,6 +34,8 @@ class MockDesktopEnvironment : public DesktopEnvironment {
MOCK_METHOD0(CreateInputInjectorPtr, InputInjector*());
MOCK_METHOD0(CreateScreenControlsPtr, ScreenControls*());
MOCK_METHOD0(CreateVideoCapturerPtr, media::ScreenCapturer*());
+ MOCK_CONST_METHOD0(GetCapabilities, std::string());
+ MOCK_METHOD1(SetCapabilities, void(const std::string&));
// DesktopEnvironment implementation.
virtual scoped_ptr<AudioCapturer> CreateAudioCapturer() OVERRIDE;
diff --git a/remoting/host/ipc_desktop_environment.cc b/remoting/host/ipc_desktop_environment.cc
index 797cbd5..4254c57 100644
--- a/remoting/host/ipc_desktop_environment.cc
+++ b/remoting/host/ipc_desktop_environment.cc
@@ -36,10 +36,9 @@ IpcDesktopEnvironment::IpcDesktopEnvironment(
caller_task_runner,
io_task_runner,
capture_task_runner,
- client_session_control);
-
- desktop_session_proxy_->ConnectToDesktopSession(desktop_session_connector,
- virtual_terminal);
+ client_session_control,
+ desktop_session_connector,
+ virtual_terminal);
}
IpcDesktopEnvironment::~IpcDesktopEnvironment() {
@@ -61,6 +60,14 @@ scoped_ptr<media::ScreenCapturer> IpcDesktopEnvironment::CreateVideoCapturer() {
return desktop_session_proxy_->CreateVideoCapturer();
}
+std::string IpcDesktopEnvironment::GetCapabilities() const {
+ return desktop_session_proxy_->GetCapabilities();
+}
+
+void IpcDesktopEnvironment::SetCapabilities(const std::string& capabilities) {
+ return desktop_session_proxy_->SetCapabilities(capabilities);
+}
+
IpcDesktopEnvironmentFactory::IpcDesktopEnvironmentFactory(
scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
diff --git a/remoting/host/ipc_desktop_environment.h b/remoting/host/ipc_desktop_environment.h
index b4a8818..8a7d7d2 100644
--- a/remoting/host/ipc_desktop_environment.h
+++ b/remoting/host/ipc_desktop_environment.h
@@ -53,6 +53,8 @@ class IpcDesktopEnvironment : public DesktopEnvironment {
virtual scoped_ptr<InputInjector> CreateInputInjector() OVERRIDE;
virtual scoped_ptr<ScreenControls> CreateScreenControls() OVERRIDE;
virtual scoped_ptr<media::ScreenCapturer> CreateVideoCapturer() OVERRIDE;
+ virtual std::string GetCapabilities() const OVERRIDE;
+ virtual void SetCapabilities(const std::string& capabilities) OVERRIDE;
private:
scoped_refptr<DesktopSessionProxy> desktop_session_proxy_;
diff --git a/remoting/host/ipc_desktop_environment_unittest.cc b/remoting/host/ipc_desktop_environment_unittest.cc
index ec6c257..cd4346f 100644
--- a/remoting/host/ipc_desktop_environment_unittest.cc
+++ b/remoting/host/ipc_desktop_environment_unittest.cc
@@ -36,6 +36,7 @@
using testing::_;
using testing::AnyNumber;
using testing::AtLeast;
+using testing::AtMost;
using testing::Return;
using testing::ReturnRef;
@@ -277,6 +278,8 @@ void IpcDesktopEnvironmentTest::SetUp() {
// Create the screen capturer.
video_capturer_ =
desktop_environment_->CreateVideoCapturer();
+
+ desktop_environment_->SetCapabilities(std::string());
}
void IpcDesktopEnvironmentTest::ConnectTerminal(
@@ -302,15 +305,19 @@ DesktopEnvironment* IpcDesktopEnvironmentTest::CreateDesktopEnvironment() {
EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr())
.Times(0);
EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr())
- .Times(AnyNumber())
- .WillRepeatedly(Invoke(
+ .Times(AtMost(1))
+ .WillOnce(Invoke(
this, &IpcDesktopEnvironmentTest::CreateInputInjector));
EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr())
- .Times(AnyNumber());
+ .Times(AtMost(1));
EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr())
- .Times(AnyNumber())
- .WillRepeatedly(Invoke(
+ .Times(AtMost(1))
+ .WillOnce(Invoke(
this, &IpcDesktopEnvironmentTest::CreateVideoCapturer));
+ EXPECT_CALL(*desktop_environment, GetCapabilities())
+ .Times(AtMost(1));
+ EXPECT_CALL(*desktop_environment, SetCapabilities(_))
+ .Times(AtMost(1));
// Let tests know that the remote desktop environment is created.
message_loop_.PostTask(FROM_HERE, setup_run_loop_->QuitClosure());