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

Side by Side Diff: remoting/protocol/key_event_tracker_unittest.cc

Issue 9646013: Add the plumbing that will carry a clipboard item from a chromoting client to a host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync, and make InputStub inherit from ClipboardStub. 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 unified diff | Download patch | Annotate | Revision Log
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/protocol/key_event_tracker.h" 5 #include "remoting/protocol/key_event_tracker.h"
6 6
7 #include "remoting/proto/event.pb.h" 7 #include "remoting/proto/event.pb.h"
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 using ::testing::_; 11 using ::testing::_;
12 using ::testing::ExpectationSet; 12 using ::testing::ExpectationSet;
13 using ::testing::InSequence; 13 using ::testing::InSequence;
14 14
15 namespace remoting { 15 namespace remoting {
16 16
17 MATCHER_P2(EqualsKeyEvent, keycode, pressed, "") { 17 MATCHER_P2(EqualsKeyEvent, keycode, pressed, "") {
18 return arg.keycode() == keycode && arg.pressed() == pressed; 18 return arg.keycode() == keycode && arg.pressed() == pressed;
19 } 19 }
20 20
21 class MockInputStub : public protocol::InputStub { 21 class MockInputStub : public protocol::InputStub {
22 public: 22 public:
23 MockInputStub() {} 23 MockInputStub() {}
24 24
25 // TODO(wez): Delete the next line when InputStub no longer inherits from
26 // ClipboardStub.
27 MOCK_METHOD1(InjectClipboardEvent, void(const protocol::ClipboardEvent&));
25 MOCK_METHOD1(InjectKeyEvent, void(const protocol::KeyEvent&)); 28 MOCK_METHOD1(InjectKeyEvent, void(const protocol::KeyEvent&));
26 MOCK_METHOD1(InjectMouseEvent, void(const protocol::MouseEvent&)); 29 MOCK_METHOD1(InjectMouseEvent, void(const protocol::MouseEvent&));
27 private: 30 private:
28 DISALLOW_COPY_AND_ASSIGN(MockInputStub); 31 DISALLOW_COPY_AND_ASSIGN(MockInputStub);
29 }; 32 };
30 33
31 static protocol::KeyEvent KeyEvent(int keycode, bool pressed) { 34 static protocol::KeyEvent KeyEvent(int keycode, bool pressed) {
32 protocol::KeyEvent event; 35 protocol::KeyEvent event;
33 event.set_keycode(keycode); 36 event.set_keycode(keycode);
34 event.set_pressed(pressed); 37 event.set_pressed(pressed);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 EXPECT_CALL(mock_stub, InjectKeyEvent(EqualsKeyEvent(3, false))) 78 EXPECT_CALL(mock_stub, InjectKeyEvent(EqualsKeyEvent(3, false)))
76 .After(injects); 79 .After(injects);
77 80
78 key_tracker.InjectKeyEvent(KeyEvent(3, true)); 81 key_tracker.InjectKeyEvent(KeyEvent(3, true));
79 PressAndRelease(&key_tracker, 1); 82 PressAndRelease(&key_tracker, 1);
80 PressAndRelease(&key_tracker, 2); 83 PressAndRelease(&key_tracker, 2);
81 key_tracker.ReleaseAllKeys(); 84 key_tracker.ReleaseAllKeys();
82 } 85 }
83 86
84 } // namespace remoting 87 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698