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

Unified Diff: remoting/host/ipc_desktop_environment_unittest.cc

Issue 1033913003: Touch Events capability negotiation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass supports_touch_events to classes that inherit BasicDesktopEnvironment Created 5 years, 7 months 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/host/ipc_desktop_environment.cc ('k') | remoting/host/it2me_desktop_environment.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/ipc_desktop_environment_unittest.cc
diff --git a/remoting/host/ipc_desktop_environment_unittest.cc b/remoting/host/ipc_desktop_environment_unittest.cc
index d31d3d46acd51160f2aae5e3b6084cd03b66e202..edd70bd8c06205e95f4d278d574b9191abdad759 100644
--- a/remoting/host/ipc_desktop_environment_unittest.cc
+++ b/remoting/host/ipc_desktop_environment_unittest.cc
@@ -169,6 +169,8 @@ class IpcDesktopEnvironmentTest : public testing::Test {
// received.
void OnDesktopAttached(IPC::PlatformFileForTransit desktop_pipe);
+ void RunMainLoopUntilDone();
+
// The main message loop.
base::MessageLoopForUI message_loop_;
@@ -438,6 +440,12 @@ void IpcDesktopEnvironmentTest::OnDesktopAttached(
terminal_id_, process_handle, desktop_pipe);
}
+void IpcDesktopEnvironmentTest::RunMainLoopUntilDone() {
+ task_runner_ = nullptr;
+ io_task_runner_ = nullptr;
+ main_run_loop_.Run();
+}
+
// Runs until the desktop is attached and exits immediately after that.
TEST_F(IpcDesktopEnvironmentTest, Basic) {
scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
@@ -454,9 +462,56 @@ TEST_F(IpcDesktopEnvironmentTest, Basic) {
// Stop the test.
DeleteDesktopEnvironment();
- task_runner_ = nullptr;
- io_task_runner_ = nullptr;
- main_run_loop_.Run();
+ RunMainLoopUntilDone();
+}
+
+// Check Capabilities.
+TEST_F(IpcDesktopEnvironmentTest, CapabilitiesNoTouch) {
+ scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
+ new protocol::MockClipboardStub());
+ EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_))
+ .Times(0);
+
+ EXPECT_EQ("rateLimitResizeRequests", desktop_environment_->GetCapabilities());
+
+ // Start the input injector and screen capturer.
+ input_injector_->Start(clipboard_stub.Pass());
+
+ // Run the message loop until the desktop is attached.
+ setup_run_loop_->Run();
+
+ // Stop the test.
+ DeleteDesktopEnvironment();
+
+ RunMainLoopUntilDone();
+}
+
+// Check touchEvents capability is set when the desktop environment can
+// inject touch events.
+TEST_F(IpcDesktopEnvironmentTest, TouchEventsCapabilities) {
+ // Create an environment with multi touch enabled.
+ desktop_environment_factory_->set_supports_touch_events(true);
+ desktop_environment_ = desktop_environment_factory_->Create(
+ client_session_control_factory_.GetWeakPtr());
+
+ scoped_ptr<protocol::MockClipboardStub> clipboard_stub(
+ new protocol::MockClipboardStub());
+ EXPECT_CALL(*clipboard_stub, InjectClipboardEvent(_))
+ .Times(0);
+
+ EXPECT_EQ("rateLimitResizeRequests touchEvents",
+ desktop_environment_->GetCapabilities());
+
+ // Start the input injector and screen capturer.
+ input_injector_->Start(clipboard_stub.Pass());
+
+ // Run the message loop until the desktop is attached.
+ setup_run_loop_->Run();
+
+ // Stop the test.
+ DeleteDesktopEnvironment();
+
+ RunMainLoopUntilDone();
}
// Tests that the video capturer receives a frame over IPC.
@@ -483,9 +538,7 @@ TEST_F(IpcDesktopEnvironmentTest, CaptureFrame) {
// Capture a single frame.
video_capturer_->Capture(webrtc::DesktopRegion());
- task_runner_ = nullptr;
- io_task_runner_ = nullptr;
- main_run_loop_.Run();
+ RunMainLoopUntilDone();
}
// Tests that attaching to a new desktop works.
@@ -511,9 +564,7 @@ TEST_F(IpcDesktopEnvironmentTest, Reattach) {
// Stop the test.
DeleteDesktopEnvironment();
- task_runner_ = nullptr;
- io_task_runner_ = nullptr;
- main_run_loop_.Run();
+ RunMainLoopUntilDone();
}
// Tests injection of clipboard events.
@@ -547,9 +598,7 @@ TEST_F(IpcDesktopEnvironmentTest, InjectClipboardEvent) {
event.set_data("a");
input_injector_->InjectClipboardEvent(event);
- task_runner_ = nullptr;
- io_task_runner_ = nullptr;
- main_run_loop_.Run();
+ RunMainLoopUntilDone();
}
// Tests injection of key events.
@@ -578,9 +627,7 @@ TEST_F(IpcDesktopEnvironmentTest, InjectKeyEvent) {
event.set_pressed(true);
input_injector_->InjectKeyEvent(event);
- task_runner_ = nullptr;
- io_task_runner_ = nullptr;
- main_run_loop_.Run();
+ RunMainLoopUntilDone();
}
// Tests injection of text events.
@@ -608,9 +655,7 @@ TEST_F(IpcDesktopEnvironmentTest, InjectTextEvent) {
event.set_text("hello");
input_injector_->InjectTextEvent(event);
- task_runner_ = nullptr;
- io_task_runner_ = nullptr;
- main_run_loop_.Run();
+ RunMainLoopUntilDone();
}
// Tests injection of mouse events.
@@ -639,9 +684,7 @@ TEST_F(IpcDesktopEnvironmentTest, InjectMouseEvent) {
event.set_y(0);
input_injector_->InjectMouseEvent(event);
- task_runner_ = nullptr;
- io_task_runner_ = nullptr;
- main_run_loop_.Run();
+ RunMainLoopUntilDone();
}
// Tests injection of touch events.
@@ -685,9 +728,7 @@ TEST_F(IpcDesktopEnvironmentTest, InjectTouchEvent) {
// Send the touch event.
input_injector_->InjectTouchEvent(event);
- task_runner_ = nullptr;
- io_task_runner_ = nullptr;
- main_run_loop_.Run();
+ RunMainLoopUntilDone();
}
// Tests that setting the desktop resolution works.
@@ -714,9 +755,7 @@ TEST_F(IpcDesktopEnvironmentTest, SetScreenResolution) {
webrtc::DesktopSize(100, 100),
webrtc::DesktopVector(96, 96)));
- task_runner_ = nullptr;
- io_task_runner_ = nullptr;
- main_run_loop_.Run();
+ RunMainLoopUntilDone();
}
} // namespace remoting
« no previous file with comments | « remoting/host/ipc_desktop_environment.cc ('k') | remoting/host/it2me_desktop_environment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698