diff options
author | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-31 02:20:29 +0000 |
---|---|---|
committer | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-31 02:20:29 +0000 |
commit | e3cab678cc8946b60fbba819943d7316c06bec58 (patch) | |
tree | 675e69d5ea800784d73f2de4a575644606b2a2be /remoting | |
parent | bc8d134739b6cdc5a7f6bb2ffe7ecd48b147fd0e (diff) | |
download | chromium_src-e3cab678cc8946b60fbba819943d7316c06bec58.zip chromium_src-e3cab678cc8946b60fbba819943d7316c06bec58.tar.gz chromium_src-e3cab678cc8946b60fbba819943d7316c06bec58.tar.bz2 |
Fixed a typo in DesktopSessionProxy::SetScreenResolution().
The typo was causing DesktopSessionProxy to ignore a valid screen resolution. I also added a unit test to excercise SetScreenResolution().
Review URL: https://chromiumcodereview.appspot.com/15855004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203313 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/host/desktop_session_proxy.cc | 2 | ||||
-rw-r--r-- | remoting/host/ipc_desktop_environment_unittest.cc | 38 |
2 files changed, 39 insertions, 1 deletions
diff --git a/remoting/host/desktop_session_proxy.cc b/remoting/host/desktop_session_proxy.cc index 27e6c41..58d5c7b 100644 --- a/remoting/host/desktop_session_proxy.cc +++ b/remoting/host/desktop_session_proxy.cc @@ -372,7 +372,7 @@ void DesktopSessionProxy::SetScreenResolution( const ScreenResolution& resolution) { DCHECK(caller_task_runner_->BelongsToCurrentThread()); - if (!resolution.IsEmpty()) + if (resolution.IsEmpty()) return; screen_resolution_ = resolution; diff --git a/remoting/host/ipc_desktop_environment_unittest.cc b/remoting/host/ipc_desktop_environment_unittest.cc index e2138d2..25b47d5 100644 --- a/remoting/host/ipc_desktop_environment_unittest.cc +++ b/remoting/host/ipc_desktop_environment_unittest.cc @@ -59,6 +59,7 @@ class FakeDaemonSender : public IPC::Sender { MOCK_METHOD3(ConnectTerminal, void(int, const ScreenResolution&, bool)); MOCK_METHOD1(DisconnectTerminal, void(int)); + MOCK_METHOD2(SetScreenResolution, void(int, const ScreenResolution&)); private: void OnMessageReceived(const IPC::Message& message); @@ -95,6 +96,8 @@ void FakeDaemonSender::OnMessageReceived(const IPC::Message& message) { ConnectTerminal) IPC_MESSAGE_HANDLER(ChromotingNetworkHostMsg_DisconnectTerminal, DisconnectTerminal) + IPC_MESSAGE_HANDLER(ChromotingNetworkDaemonMsg_SetScreenResolution, + SetScreenResolution) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -191,6 +194,9 @@ class IpcDesktopEnvironmentTest : public testing::Test { // The IPC input injector. scoped_ptr<InputInjector> input_injector_; + // The IPC screen controls. + scoped_ptr<ScreenControls> screen_controls_; + // The IPC screen capturer. scoped_ptr<media::ScreenCapturer> video_capturer_; @@ -276,6 +282,8 @@ void IpcDesktopEnvironmentTest::SetUp() { desktop_environment_ = desktop_environment_factory_->Create( client_session_control_factory_.GetWeakPtr()); + screen_controls_ = desktop_environment_->CreateScreenControls(); + // Create the input injector. input_injector_ = desktop_environment_->CreateInputInjector(); @@ -343,6 +351,7 @@ media::ScreenCapturer* IpcDesktopEnvironmentTest::CreateVideoCapturer() { void IpcDesktopEnvironmentTest::DeleteDesktopEnvironment() { input_injector_.reset(); + screen_controls_.reset(); video_capturer_.reset(); // Trigger DisconnectTerminal(). @@ -618,4 +627,33 @@ TEST_F(IpcDesktopEnvironmentTest, InjectMouseEvent) { main_run_loop_.Run(); } +// Tests that setting the desktop resolution works. +TEST_F(IpcDesktopEnvironmentTest, SetScreenResolution) { + scoped_ptr<protocol::MockClipboardStub> clipboard_stub( + new protocol::MockClipboardStub()); + EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_)) + .Times(0); + + // Start the input injector and screen capturer. + input_injector_->Start(clipboard_stub.PassAs<protocol::ClipboardStub>()); + video_capturer_->Start(&screen_capturer_callback_); + + // Run the message loop until the desktop is attached. + setup_run_loop_->Run(); + + EXPECT_CALL(daemon_channel_, SetScreenResolution(_, _)) + .Times(1) + .WillOnce(InvokeWithoutArgs( + this, &IpcDesktopEnvironmentTest::DeleteDesktopEnvironment)); + + // Change the desktop resolution. + screen_controls_->SetScreenResolution(ScreenResolution( + webrtc::DesktopSize(100, 100), + webrtc::DesktopVector(96, 96))); + + task_runner_ = NULL; + io_task_runner_ = NULL; + main_run_loop_.Run(); +} + } // namespace remoting |