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

Side by Side Diff: remoting/host/remote_input_filter_unittest.cc

Issue 112453002: Remove dependency on skia from remoting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/remote_input_filter.cc ('k') | remoting/host/video_scheduler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/remote_input_filter.h" 5 #include "remoting/host/remote_input_filter.h"
6 6
7 #include "remoting/proto/event.pb.h" 7 #include "remoting/proto/event.pb.h"
8 #include "remoting/protocol/input_event_tracker.h" 8 #include "remoting/protocol/input_event_tracker.h"
9 #include "remoting/protocol/protocol_mock_objects.h" 9 #include "remoting/protocol/protocol_mock_objects.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 MockInputStub mock_stub; 60 MockInputStub mock_stub;
61 InputEventTracker input_tracker(&mock_stub); 61 InputEventTracker input_tracker(&mock_stub);
62 RemoteInputFilter input_filter(&input_tracker); 62 RemoteInputFilter input_filter(&input_tracker);
63 63
64 EXPECT_CALL(mock_stub, InjectMouseEvent(_)) 64 EXPECT_CALL(mock_stub, InjectMouseEvent(_))
65 .Times(5); 65 .Times(5);
66 66
67 for (int i = 0; i < 10; ++i) { 67 for (int i = 0; i < 10; ++i) {
68 input_filter.InjectMouseEvent(MouseMoveEvent(0, 0)); 68 input_filter.InjectMouseEvent(MouseMoveEvent(0, 0));
69 if (i == 4) 69 if (i == 4)
70 input_filter.LocalMouseMoved(SkIPoint::Make(1, 1)); 70 input_filter.LocalMouseMoved(webrtc::DesktopVector(1, 1));
71 } 71 }
72 } 72 }
73 73
74 // Verify that echos of injected events don't block activity. 74 // Verify that echos of injected events don't block activity.
75 TEST(RemoteInputFilterTest, LocalEchoesOfRemoteActivity) { 75 TEST(RemoteInputFilterTest, LocalEchoesOfRemoteActivity) {
76 MockInputStub mock_stub; 76 MockInputStub mock_stub;
77 InputEventTracker input_tracker(&mock_stub); 77 InputEventTracker input_tracker(&mock_stub);
78 RemoteInputFilter input_filter(&input_tracker); 78 RemoteInputFilter input_filter(&input_tracker);
79 79
80 EXPECT_CALL(mock_stub, InjectMouseEvent(_)) 80 EXPECT_CALL(mock_stub, InjectMouseEvent(_))
81 .Times(10); 81 .Times(10);
82 82
83 for (int i = 0; i < 10; ++i) { 83 for (int i = 0; i < 10; ++i) {
84 input_filter.InjectMouseEvent(MouseMoveEvent(0, 0)); 84 input_filter.InjectMouseEvent(MouseMoveEvent(0, 0));
85 input_filter.LocalMouseMoved(SkIPoint::Make(0, 0)); 85 input_filter.LocalMouseMoved(webrtc::DesktopVector(0, 0));
86 } 86 }
87 } 87 }
88 88
89 // Verify that echos followed by a mismatch blocks activity. 89 // Verify that echos followed by a mismatch blocks activity.
90 TEST(RemoteInputFilterTest, LocalEchosAndLocalActivity) { 90 TEST(RemoteInputFilterTest, LocalEchosAndLocalActivity) {
91 MockInputStub mock_stub; 91 MockInputStub mock_stub;
92 InputEventTracker input_tracker(&mock_stub); 92 InputEventTracker input_tracker(&mock_stub);
93 RemoteInputFilter input_filter(&input_tracker); 93 RemoteInputFilter input_filter(&input_tracker);
94 94
95 EXPECT_CALL(mock_stub, InjectMouseEvent(_)) 95 EXPECT_CALL(mock_stub, InjectMouseEvent(_))
96 .Times(5); 96 .Times(5);
97 97
98 for (int i = 0; i < 10; ++i) { 98 for (int i = 0; i < 10; ++i) {
99 input_filter.InjectMouseEvent(MouseMoveEvent(0, 0)); 99 input_filter.InjectMouseEvent(MouseMoveEvent(0, 0));
100 input_filter.LocalMouseMoved(SkIPoint::Make(0, 0)); 100 input_filter.LocalMouseMoved(webrtc::DesktopVector(0, 0));
101 if (i == 4) 101 if (i == 4)
102 input_filter.LocalMouseMoved(SkIPoint::Make(1, 1)); 102 input_filter.LocalMouseMoved(webrtc::DesktopVector(1, 1));
103 } 103 }
104 } 104 }
105 105
106 // Verify that local activity also causes buttons & keys to be released. 106 // Verify that local activity also causes buttons & keys to be released.
107 TEST(RemoteInputFilterTest, LocalActivityReleasesAll) { 107 TEST(RemoteInputFilterTest, LocalActivityReleasesAll) {
108 MockInputStub mock_stub; 108 MockInputStub mock_stub;
109 InputEventTracker input_tracker(&mock_stub); 109 InputEventTracker input_tracker(&mock_stub);
110 RemoteInputFilter input_filter(&input_tracker); 110 RemoteInputFilter input_filter(&input_tracker);
111 111
112 EXPECT_CALL(mock_stub, InjectMouseEvent(_)) 112 EXPECT_CALL(mock_stub, InjectMouseEvent(_))
113 .Times(5); 113 .Times(5);
114 114
115 // Use release of a key as a proxy for InputEventTracker::ReleaseAll() 115 // Use release of a key as a proxy for InputEventTracker::ReleaseAll()
116 // having been called, rather than mocking it. 116 // having been called, rather than mocking it.
117 EXPECT_CALL(mock_stub, InjectKeyEvent(EqualsUsbEvent(0, true))); 117 EXPECT_CALL(mock_stub, InjectKeyEvent(EqualsUsbEvent(0, true)));
118 EXPECT_CALL(mock_stub, InjectKeyEvent(EqualsUsbEvent(0, false))); 118 EXPECT_CALL(mock_stub, InjectKeyEvent(EqualsUsbEvent(0, false)));
119 input_filter.InjectKeyEvent(UsbKeyEvent(0, true)); 119 input_filter.InjectKeyEvent(UsbKeyEvent(0, true));
120 120
121 for (int i = 0; i < 10; ++i) { 121 for (int i = 0; i < 10; ++i) {
122 input_filter.InjectMouseEvent(MouseMoveEvent(0, 0)); 122 input_filter.InjectMouseEvent(MouseMoveEvent(0, 0));
123 input_filter.LocalMouseMoved(SkIPoint::Make(0, 0)); 123 input_filter.LocalMouseMoved(webrtc::DesktopVector(0, 0));
124 if (i == 4) 124 if (i == 4)
125 input_filter.LocalMouseMoved(SkIPoint::Make(1, 1)); 125 input_filter.LocalMouseMoved(webrtc::DesktopVector(1, 1));
126 } 126 }
127 } 127 }
128 128
129 } // namespace remoting 129 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/remote_input_filter.cc ('k') | remoting/host/video_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698