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

Unified Diff: remoting/host/client_session_unittest.cc

Issue 9465035: Move ClientSession's input logic into separate components. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Replace |authenticated_| with an InputFilter. Created 8 years, 9 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
Index: remoting/host/client_session_unittest.cc
diff --git a/remoting/host/client_session_unittest.cc b/remoting/host/client_session_unittest.cc
index 67bf728ba6d0e5f07312c64026a46f3358246c28..ead8dcb468df84bfbf9081a6dbf994cb6579ee47 100644
--- a/remoting/host/client_session_unittest.cc
+++ b/remoting/host/client_session_unittest.cc
@@ -107,8 +107,8 @@ MATCHER_P2(EqualsMouseEvent, x, y, "") {
return arg.x() == x && arg.y() == y;
}
-MATCHER_P(EqualsMouseUpEvent, button, "") {
- return arg.button() == button && !arg.button_down();
+MATCHER_P2(EqualsMouseButtonEvent, button, down, "") {
+ return arg.button() == button && arg.button_down() == down;
}
TEST_F(ClientSessionTest, InputStubFilter) {
@@ -213,16 +213,23 @@ TEST_F(ClientSessionTest, RestoreEventState) {
mousedown.set_button(protocol::MouseEvent::BUTTON_LEFT);
mousedown.set_button_down(true);
- client_session_->RecordKeyEvent(key1);
- client_session_->RecordKeyEvent(key2);
- client_session_->RecordMouseButtonState(mousedown);
-
+ InSequence s;
+ EXPECT_CALL(host_event_stub_, InjectKeyEvent(EqualsKeyEvent(1, true)));
+ EXPECT_CALL(host_event_stub_, InjectKeyEvent(EqualsKeyEvent(2, true)));
+ EXPECT_CALL(host_event_stub_, InjectMouseEvent(EqualsMouseButtonEvent(
+ protocol::MouseEvent::BUTTON_LEFT, true)));
EXPECT_CALL(host_event_stub_, InjectKeyEvent(EqualsKeyEvent(1, false)));
EXPECT_CALL(host_event_stub_, InjectKeyEvent(EqualsKeyEvent(2, false)));
- EXPECT_CALL(host_event_stub_, InjectMouseEvent(EqualsMouseUpEvent(
- protocol::MouseEvent::BUTTON_LEFT)));
+ EXPECT_CALL(host_event_stub_, InjectMouseEvent(EqualsMouseButtonEvent(
+ protocol::MouseEvent::BUTTON_LEFT, false)));
- client_session_->RestoreEventState();
+ client_session_->OnConnectionOpened(client_session_->connection());
+
+ client_session_->InjectKeyEvent(key1);
+ client_session_->InjectKeyEvent(key2);
+ client_session_->InjectMouseEvent(mousedown);
+
+ client_session_->Disconnect();
}
TEST_F(ClientSessionTest, ClampMouseEvents) {

Powered by Google App Engine
This is Rietveld 408576698