diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-22 03:16:57 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-22 03:16:57 +0000 |
commit | e2ba2b44df616afaf25a4b6119ad11daa120a887 (patch) | |
tree | a64b03151b8d1e7cba5c26bc8d7012e57573c6a0 /remoting | |
parent | 14e66abe9c27f1e728a749950a78f837ac538c73 (diff) | |
download | chromium_src-e2ba2b44df616afaf25a4b6119ad11daa120a887.zip chromium_src-e2ba2b44df616afaf25a4b6119ad11daa120a887.tar.gz chromium_src-e2ba2b44df616afaf25a4b6119ad11daa120a887.tar.bz2 |
[chromoting] Fix sticky c key with cmd on mac using usb keycode
Switch to use USB keycode for the fix for sticky keys on Mac.
BUG=101937
TEST=Build on Mac and run chromoting and press cmd+c
Review URL: https://chromiumcodereview.appspot.com/10387226
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138205 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/client/plugin/mac_key_event_processor.cc | 57 | ||||
-rw-r--r-- | remoting/client/plugin/mac_key_event_processor.h | 16 | ||||
-rw-r--r-- | remoting/client/plugin/mac_key_event_processor_unittest.cc | 300 |
3 files changed, 143 insertions, 230 deletions
diff --git a/remoting/client/plugin/mac_key_event_processor.cc b/remoting/client/plugin/mac_key_event_processor.cc index ac82745..523ef09 100644 --- a/remoting/client/plugin/mac_key_event_processor.cc +++ b/remoting/client/plugin/mac_key_event_processor.cc @@ -6,17 +6,21 @@ #include <vector> +#include "base/logging.h" + namespace remoting { namespace { -// A list of known keycodes. -const int kShift = 16; -const int kControl = 17; -const int kOption = 18; -const int kCapsLock = 20; -const int kLeftCmd = 91; -const int kRightCmd = 93; +const unsigned int kUsbLeftControl = 0x0700e0; +const unsigned int kUsbLeftShift = 0x0700e1; +const unsigned int kUsbLeftOption = 0x0700e2; +const unsigned int kUsbLeftCmd = 0x0700e3; +const unsigned int kUsbRightControl = 0x0700e4; +const unsigned int kUsbRightShift = 0x0700e5; +const unsigned int kUsbRightOption = 0x0700e6; +const unsigned int kUsbRightCmd = 0x0700e7; +const unsigned int kUsbTab = 0x07002b; } // namespace @@ -28,19 +32,32 @@ MacKeyEventProcessor::~MacKeyEventProcessor() { } void MacKeyEventProcessor::InjectKeyEvent(const protocol::KeyEvent& event) { - if (event.pressed()) { - key_pressed_map_[event.keycode()] = event; - } else { - key_pressed_map_.erase(event.keycode()); - if (event.keycode() == kLeftCmd || event.keycode() == kRightCmd) - GenerateKeyupEvents(); + DCHECK(event.has_usb_keycode()); + + bool is_special_key = event.usb_keycode() == kUsbLeftControl || + event.usb_keycode() == kUsbLeftShift || + event.usb_keycode() == kUsbLeftOption || + event.usb_keycode() == kUsbRightControl || + event.usb_keycode() == kUsbRightShift || + event.usb_keycode() == kUsbRightOption || + event.usb_keycode() == kUsbTab; + + bool is_cmd_key = event.usb_keycode() == kUsbLeftCmd || + event.usb_keycode() == kUsbRightCmd; + + if (!is_cmd_key && !is_special_key) { + if (event.pressed()) { + key_pressed_map_[event.usb_keycode()] = event; + } else { + key_pressed_map_.erase(event.usb_keycode()); + } } - InputFilter::InjectKeyEvent(event); -} + if (is_cmd_key && !event.pressed()) { + GenerateKeyupEvents(); + } -int MacKeyEventProcessor::NumberOfPressedKeys() const { - return key_pressed_map_.size(); + InputFilter::InjectKeyEvent(event); } void MacKeyEventProcessor::GenerateKeyupEvents() { @@ -52,12 +69,6 @@ void MacKeyEventProcessor::GenerateKeyupEvents() { i != key_pressed_map_.end(); ++i) { const int keycode = i->first; - if (keycode == kCapsLock || keycode == kOption || - keycode == kControl || keycode == kShift || - keycode == kLeftCmd || keycode == kRightCmd) { - continue; - } - keycodes.push_back(keycode); protocol::KeyEvent event = i->second; event.set_pressed(false); diff --git a/remoting/client/plugin/mac_key_event_processor.h b/remoting/client/plugin/mac_key_event_processor.h index d395954..56bc974 100644 --- a/remoting/client/plugin/mac_key_event_processor.h +++ b/remoting/client/plugin/mac_key_event_processor.h @@ -12,13 +12,6 @@ // The cause is that CMD + C triggers a system action and Chrome injects only a // keydown event for the C key. Safari shares the same behavior. // -// This is a list of sample edge cases: -// -// CMD DOWN, C DOWN, C UP, CMD UP -// CMD DOWN, SHIFT DOWN, C DOWN, C UP, CMD UP, SHIFT UP -// CMD DOWN, CAPS LOCK DOWN, CMD DOWN, CAPS LOCK DOWN -// L CMD DOWN, C DOWN, R CMD DOWN, L CMD UP, C UP, R CMD UP -// // SOLUTION // // When a keyup event for CMD key happens we will check all prior keydown @@ -41,7 +34,8 @@ // CMD DOWN, C DOWN, C UP, CMD UP, C UP // // Because we artificially generate keyup events the C UP event is duplicated -// as user releases the key after CMD key. +// as user releases the key after CMD key. This would not be a problem as the +// receiver end will drop this duplicated keyup event. #ifndef REMOTING_CLIENT_PLUGIN_MAC_KEY_EVENT_PROCESSOR_H_ #define REMOTING_CLIENT_PLUGIN_MAC_KEY_EVENT_PROCESSOR_H_ @@ -66,12 +60,8 @@ class MacKeyEventProcessor : public protocol::InputFilter { // InputFilter overrides. virtual void InjectKeyEvent(const protocol::KeyEvent& event) OVERRIDE; - // Return the number of keys pressed. This method is used by unit test to - // test correctness of this class. - int NumberOfPressedKeys() const; - private: - // Iterate the current pressed keys and generate keyup events. + // Generate keyup events for any keys pressed with CMD. void GenerateKeyupEvents(); // A map that stores pressed keycodes and the corresponding key event. diff --git a/remoting/client/plugin/mac_key_event_processor_unittest.cc b/remoting/client/plugin/mac_key_event_processor_unittest.cc index 9cb1393..34be4e3 100644 --- a/remoting/client/plugin/mac_key_event_processor_unittest.cc +++ b/remoting/client/plugin/mac_key_event_processor_unittest.cc @@ -4,73 +4,33 @@ #include "remoting/client/plugin/mac_key_event_processor.h" #include "remoting/proto/event.pb.h" +#include "remoting/protocol/protocol_mock_objects.h" +#include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +using ::testing::InSequence; using remoting::protocol::InputStub; using remoting::protocol::KeyEvent; +using remoting::protocol::MockInputStub; using remoting::protocol::MouseEvent; namespace remoting { namespace { -const int kShift = 16; -const int kOption = 18; -const int kLeftCmd = 91; -const int kRightCmd = 93; +const unsigned int kUsbLeftShift = 0x0700e1; +const unsigned int kUsbLeftOption = 0x0700e2; +const unsigned int kUsbLeftCmd = 0x0700e3; +const unsigned int kUsbRightCmd = 0x0700e7; -class FakeInputStub : public InputStub { - public: - FakeInputStub() {} - virtual ~FakeInputStub() {} - - virtual void InjectKeyEvent(const KeyEvent& event) { - key_events_.push_back(std::make_pair(event.keycode(), event.pressed())); - } - - virtual void InjectMouseEvent(const MouseEvent& event) { - } - - void ExpectOneKeyEvent(int keycode, bool pressed) { - EXPECT_EQ(1u, key_events_.size()); - EXPECT_EQ(keycode, key_events_[0].first); - EXPECT_EQ(pressed, key_events_[0].second); - } - - void ExpectTwoKeyEvents(int keycode0, bool pressed0, - int keycode1, bool pressed1) { - EXPECT_EQ(2u, key_events_.size()); - EXPECT_EQ(keycode0, key_events_[0].first); - EXPECT_EQ(pressed0, key_events_[0].second); - EXPECT_EQ(keycode1, key_events_[1].first); - EXPECT_EQ(pressed1, key_events_[1].second); - } - - void ExpectThreeKeyEvents(int keycode0, bool pressed0, - int keycode1, bool pressed1, - int keycode2, bool pressed2) { - EXPECT_EQ(3u, key_events_.size()); - EXPECT_EQ(keycode0, key_events_[0].first); - EXPECT_EQ(pressed0, key_events_[0].second); - EXPECT_EQ(keycode1, key_events_[1].first); - EXPECT_EQ(pressed1, key_events_[1].second); - EXPECT_EQ(keycode2, key_events_[2].first); - EXPECT_EQ(pressed2, key_events_[2].second); - } - - void ClearKeyEvents() { - key_events_.clear(); - } - - private: - std::vector<std::pair<int, bool> > key_events_; - - DISALLOW_COPY_AND_ASSIGN(FakeInputStub); -}; +MATCHER_P2(EqualsUsbEvent, usb_keycode, pressed, "") { + return arg.usb_keycode() == static_cast<uint32>(usb_keycode) && + arg.pressed() == pressed; +} KeyEvent MakeKeyEvent(int keycode, bool pressed) { KeyEvent event; - event.set_keycode(keycode); + event.set_usb_keycode(keycode); event.set_pressed(pressed); return event; } @@ -79,192 +39,144 @@ KeyEvent MakeKeyEvent(int keycode, bool pressed) { // Test without pressing command key. TEST(MacKeyEventProcessorTest, NoInjection) { - FakeInputStub stub; + MockInputStub stub; MacKeyEventProcessor processor(&stub); - // C Down. - processor.InjectKeyEvent(MakeKeyEvent('C', true)); - stub.ExpectOneKeyEvent('C', true); - stub.ClearKeyEvents(); - EXPECT_EQ(1, processor.NumberOfPressedKeys()); + { + InSequence s; + + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent('C', true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent('C', false))); + } - // C Up. + // C Down and C Up. + processor.InjectKeyEvent(MakeKeyEvent('C', true)); processor.InjectKeyEvent(MakeKeyEvent('C', false)); - stub.ExpectOneKeyEvent('C', false); - stub.ClearKeyEvents(); - EXPECT_EQ(0, processor.NumberOfPressedKeys()); } // Test pressing command key and other normal keys. TEST(MacKeyEventProcessorTest, CmdKey) { - FakeInputStub stub; + MockInputStub stub; MacKeyEventProcessor processor(&stub); + { + InSequence s; + + // Left command key. + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbLeftCmd, true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent('C', true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent('C', false))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbLeftCmd, false))); + + // Right command key. + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbRightCmd, true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent('C', true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent('C', false))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbRightCmd, false))); + + // More than one keys after CMD. + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbRightCmd, true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent('C', true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent('V', true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent('C', false))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent('V', false))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbRightCmd, false))); + } + // Left command key. - processor.InjectKeyEvent(MakeKeyEvent(kLeftCmd, true)); - stub.ExpectOneKeyEvent(kLeftCmd, true); - stub.ClearKeyEvents(); - EXPECT_EQ(1, processor.NumberOfPressedKeys()); + processor.InjectKeyEvent(MakeKeyEvent(kUsbLeftCmd, true)); processor.InjectKeyEvent(MakeKeyEvent('C', true)); - stub.ExpectOneKeyEvent('C', true); - stub.ClearKeyEvents(); - EXPECT_EQ(2, processor.NumberOfPressedKeys()); - processor.InjectKeyEvent(MakeKeyEvent(kLeftCmd, false)); - stub.ExpectTwoKeyEvents('C', false, kLeftCmd, false); - stub.ClearKeyEvents(); - EXPECT_EQ(0, processor.NumberOfPressedKeys()); + processor.InjectKeyEvent(MakeKeyEvent(kUsbLeftCmd, false)); // Right command key. - processor.InjectKeyEvent(MakeKeyEvent(kRightCmd, true)); - stub.ExpectOneKeyEvent(kRightCmd, true); - stub.ClearKeyEvents(); - EXPECT_EQ(1, processor.NumberOfPressedKeys()); + processor.InjectKeyEvent(MakeKeyEvent(kUsbRightCmd, true)); processor.InjectKeyEvent(MakeKeyEvent('C', true)); - stub.ExpectOneKeyEvent('C', true); - stub.ClearKeyEvents(); - EXPECT_EQ(2, processor.NumberOfPressedKeys()); - processor.InjectKeyEvent(MakeKeyEvent(kRightCmd, false)); - stub.ExpectTwoKeyEvents('C', false, kRightCmd, false); - stub.ClearKeyEvents(); - EXPECT_EQ(0, processor.NumberOfPressedKeys()); + processor.InjectKeyEvent(MakeKeyEvent(kUsbRightCmd, false)); // More than one keys after CMD. - processor.InjectKeyEvent(MakeKeyEvent(kRightCmd, true)); - stub.ExpectOneKeyEvent(kRightCmd, true); - stub.ClearKeyEvents(); - EXPECT_EQ(1, processor.NumberOfPressedKeys()); + processor.InjectKeyEvent(MakeKeyEvent(kUsbRightCmd, true)); processor.InjectKeyEvent(MakeKeyEvent('C', true)); - stub.ExpectOneKeyEvent('C', true); - stub.ClearKeyEvents(); - EXPECT_EQ(2, processor.NumberOfPressedKeys()); processor.InjectKeyEvent(MakeKeyEvent('V', true)); - stub.ExpectOneKeyEvent('V', true); - stub.ClearKeyEvents(); - EXPECT_EQ(3, processor.NumberOfPressedKeys()); - processor.InjectKeyEvent(MakeKeyEvent(kRightCmd, false)); - stub.ExpectThreeKeyEvents('C', false, 'V', false, - kRightCmd, false); - EXPECT_EQ(0, processor.NumberOfPressedKeys()); + processor.InjectKeyEvent(MakeKeyEvent(kUsbRightCmd, false)); } // Test pressing command and special keys. TEST(MacKeyEventProcessorTest, SpecialKeys) { - FakeInputStub stub; + MockInputStub stub; MacKeyEventProcessor processor(&stub); + { + InSequence s; + + // Command + Shift. + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbLeftCmd, true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbLeftShift, true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbLeftCmd, false))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbLeftShift, false))); + + // Command + Option. + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbLeftCmd, true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbLeftOption, true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbLeftCmd, false))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbLeftOption, false))); + } + // Command + Shift. - processor.InjectKeyEvent(MakeKeyEvent(kLeftCmd, true)); - stub.ExpectOneKeyEvent(kLeftCmd, true); - stub.ClearKeyEvents(); - EXPECT_EQ(1, processor.NumberOfPressedKeys()); - processor.InjectKeyEvent(MakeKeyEvent(kShift, true)); - stub.ExpectOneKeyEvent(kShift, true); - stub.ClearKeyEvents(); - EXPECT_EQ(2, processor.NumberOfPressedKeys()); - processor.InjectKeyEvent(MakeKeyEvent(kLeftCmd, false)); - stub.ExpectOneKeyEvent(kLeftCmd, false); - stub.ClearKeyEvents(); - EXPECT_EQ(1, processor.NumberOfPressedKeys()); - processor.InjectKeyEvent(MakeKeyEvent(kShift, false)); - stub.ExpectOneKeyEvent(kShift, false); - stub.ClearKeyEvents(); - EXPECT_EQ(0, processor.NumberOfPressedKeys()); + processor.InjectKeyEvent(MakeKeyEvent(kUsbLeftCmd, true)); + processor.InjectKeyEvent(MakeKeyEvent(kUsbLeftShift, true)); + processor.InjectKeyEvent(MakeKeyEvent(kUsbLeftCmd, false)); + processor.InjectKeyEvent(MakeKeyEvent(kUsbLeftShift, false)); // Command + Option. - processor.InjectKeyEvent(MakeKeyEvent(kLeftCmd, true)); - stub.ExpectOneKeyEvent(kLeftCmd, true); - stub.ClearKeyEvents(); - EXPECT_EQ(1, processor.NumberOfPressedKeys()); - processor.InjectKeyEvent(MakeKeyEvent(kOption, true)); - stub.ExpectOneKeyEvent(kOption, true); - stub.ClearKeyEvents(); - EXPECT_EQ(2, processor.NumberOfPressedKeys()); - processor.InjectKeyEvent(MakeKeyEvent(kLeftCmd, false)); - stub.ExpectOneKeyEvent(kLeftCmd, false); - stub.ClearKeyEvents(); - EXPECT_EQ(1, processor.NumberOfPressedKeys()); - processor.InjectKeyEvent(MakeKeyEvent(kOption, false)); - stub.ExpectOneKeyEvent(kOption, false); - stub.ClearKeyEvents(); - EXPECT_EQ(0, processor.NumberOfPressedKeys()); + processor.InjectKeyEvent(MakeKeyEvent(kUsbLeftCmd, true)); + processor.InjectKeyEvent(MakeKeyEvent(kUsbLeftOption, true)); + processor.InjectKeyEvent(MakeKeyEvent(kUsbLeftCmd, false)); + processor.InjectKeyEvent(MakeKeyEvent(kUsbLeftOption, false)); } // Test pressing multiple command keys. TEST(MacKeyEventProcessorTest, MultipleCmdKeys) { - FakeInputStub stub; + MockInputStub stub; MacKeyEventProcessor processor(&stub); + { + InSequence s; + + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbLeftCmd, true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent('C', true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbRightCmd, true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent('C', false))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbLeftCmd, false))); + } + // Test multiple CMD keys at the same time. - // L CMD Down. - processor.InjectKeyEvent(MakeKeyEvent(kLeftCmd, true)); - stub.ExpectOneKeyEvent(kLeftCmd, true); - stub.ClearKeyEvents(); - EXPECT_EQ(1, processor.NumberOfPressedKeys()); - // C Down. + // L CMD Down, C Down, R CMD Down, L CMD Up. + processor.InjectKeyEvent(MakeKeyEvent(kUsbLeftCmd, true)); processor.InjectKeyEvent(MakeKeyEvent('C', true)); - stub.ExpectOneKeyEvent('C', true); - stub.ClearKeyEvents(); - EXPECT_EQ(2, processor.NumberOfPressedKeys()); - // R CMD Down. - processor.InjectKeyEvent(MakeKeyEvent(kRightCmd, true)); - stub.ExpectOneKeyEvent(kRightCmd, true); - stub.ClearKeyEvents(); - EXPECT_EQ(3, processor.NumberOfPressedKeys()); - // L CMD Up. - processor.InjectKeyEvent(MakeKeyEvent(kLeftCmd, false)); - stub.ExpectTwoKeyEvents('C', false, kLeftCmd, false); - stub.ClearKeyEvents(); - EXPECT_EQ(1, processor.NumberOfPressedKeys()); + processor.InjectKeyEvent(MakeKeyEvent(kUsbRightCmd, true)); + processor.InjectKeyEvent(MakeKeyEvent(kUsbLeftCmd, false)); } // Test press C key before command key. TEST(MacKeyEventProcessorTest, BeforeCmdKey) { - FakeInputStub stub; + MockInputStub stub; MacKeyEventProcessor processor(&stub); - // Press C before command key. - processor.InjectKeyEvent(MakeKeyEvent('C', true)); - stub.ExpectOneKeyEvent('C', true); - stub.ClearKeyEvents(); - EXPECT_EQ(1, processor.NumberOfPressedKeys()); - processor.InjectKeyEvent(MakeKeyEvent(kRightCmd, true)); - stub.ExpectOneKeyEvent(kRightCmd, true); - stub.ClearKeyEvents(); - EXPECT_EQ(2, processor.NumberOfPressedKeys()); - processor.InjectKeyEvent(MakeKeyEvent(kRightCmd, false)); - stub.ExpectTwoKeyEvents('C', false, kRightCmd, false); - stub.ClearKeyEvents(); - EXPECT_EQ(0, processor.NumberOfPressedKeys()); - processor.InjectKeyEvent(MakeKeyEvent('C', false)); - stub.ExpectOneKeyEvent('C', false); - stub.ClearKeyEvents(); - EXPECT_EQ(0, processor.NumberOfPressedKeys()); -} + { + InSequence s; -// Test sending multiple keydowns. -TEST(MacKeyEventProcessorTest, MultipleKeydowns) { - FakeInputStub stub; - MacKeyEventProcessor processor(&stub); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent('C', true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbRightCmd, true))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent('C', false))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent(kUsbRightCmd, false))); + EXPECT_CALL(stub, InjectKeyEvent(EqualsUsbEvent('C', false))); + } - // 2 CMD Downs. - processor.InjectKeyEvent(MakeKeyEvent(kLeftCmd, true)); - stub.ExpectOneKeyEvent(kLeftCmd, true); - stub.ClearKeyEvents(); - EXPECT_EQ(1, processor.NumberOfPressedKeys()); - processor.InjectKeyEvent(MakeKeyEvent(kLeftCmd, true)); - stub.ExpectOneKeyEvent(kLeftCmd, true); - stub.ClearKeyEvents(); - EXPECT_EQ(1, processor.NumberOfPressedKeys()); - // C Down. + // Press C before command key. processor.InjectKeyEvent(MakeKeyEvent('C', true)); - stub.ExpectOneKeyEvent('C', true); - stub.ClearKeyEvents(); - EXPECT_EQ(2, processor.NumberOfPressedKeys()); - // CMD Up. - processor.InjectKeyEvent(MakeKeyEvent(kLeftCmd, false)); - stub.ExpectTwoKeyEvents('C', false, kLeftCmd, false); - stub.ClearKeyEvents(); - EXPECT_EQ(0, processor.NumberOfPressedKeys()); + processor.InjectKeyEvent(MakeKeyEvent(kUsbRightCmd, true)); + processor.InjectKeyEvent(MakeKeyEvent(kUsbRightCmd, false)); + processor.InjectKeyEvent(MakeKeyEvent('C', false)); } } // namespace remoting |