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

Side by Side Diff: chrome/browser/chromeos/events/event_rewriter_unittest.cc

Issue 1000713003: Remove special key rewrite code for x11 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « chrome/browser/chromeos/events/event_rewriter.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/chromeos/events/event_rewriter.h" 5 #include "chrome/browser/chromeos/events/event_rewriter.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/sticky_keys/sticky_keys_controller.h" 10 #include "ash/sticky_keys/sticky_keys_controller.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // Verify that the X11-based key event is as expected. 108 // Verify that the X11-based key event is as expected.
109 EXPECT_EQ(GetExpectedResultAsString( 109 EXPECT_EQ(GetExpectedResultAsString(
110 test.input.key_code, test.input.flags, test.type), 110 test.input.key_code, test.input.flags, test.type),
111 GetKeyEventAsString(xkey_event)); 111 GetKeyEventAsString(xkey_event));
112 // Rewrite the event and check the result. 112 // Rewrite the event and check the result.
113 scoped_ptr<ui::Event> new_event; 113 scoped_ptr<ui::Event> new_event;
114 rewriter->RewriteEvent(xkey_event, &new_event); 114 rewriter->RewriteEvent(xkey_event, &new_event);
115 ui::KeyEvent& rewritten_key_event = 115 ui::KeyEvent& rewritten_key_event =
116 new_event ? *static_cast<ui::KeyEvent*>(new_event.get()) : xkey_event; 116 new_event ? *static_cast<ui::KeyEvent*>(new_event.get()) : xkey_event;
117 EXPECT_EQ(expected, GetKeyEventAsString(rewritten_key_event)); 117 EXPECT_EQ(expected, GetKeyEventAsString(rewritten_key_event));
118 if ((rewritten_key_event.key_code() != ui::VKEY_UNKNOWN) && 118 if (xevent->type == GenericEvent)
119 (rewritten_key_event.native_event()->xkey.keycode != 0)) { 119 EXPECT_EQ(nullptr, rewritten_key_event.native_event());
120 // Build a new ui::KeyEvent from the rewritten native component, 120 else
121 // and check that it also matches the rewritten event. 121 EXPECT_NE(nullptr, rewritten_key_event.native_event());
122 EXPECT_TRUE(rewritten_key_event.native_event());
123 ui::KeyEvent from_native_event(rewritten_key_event.native_event());
124 EXPECT_EQ(expected, GetKeyEventAsString(from_native_event));
125 }
126 } 122 }
127 #endif 123 #endif
128 124
129 // Tests a single stateless key rewrite operation. 125 // Tests a single stateless key rewrite operation.
130 // |i| is a an identifying number to locate failing tests in the tables. 126 // |i| is a an identifying number to locate failing tests in the tables.
131 void CheckKeyTestCase(chromeos::EventRewriter* rewriter, 127 void CheckKeyTestCase(chromeos::EventRewriter* rewriter,
132 const KeyTestCase& test) { 128 const KeyTestCase& test) {
133 std::string expected = 129 std::string expected =
134 GetExpectedResultAsString( 130 GetExpectedResultAsString(
135 test.expected.key_code, test.expected.flags, test.type); 131 test.expected.key_code, test.expected.flags, test.type);
(...skipping 2329 matching lines...) Expand 10 before | Expand all | Expand 10 after
2465 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); 2461 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN));
2466 EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); 2462 EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN));
2467 2463
2468 // Turn off AltGr and Mod3. 2464 // Turn off AltGr and Mod3.
2469 sticky_keys_controller_->SetModifiersEnabled(false, false); 2465 sticky_keys_controller_->SetModifiersEnabled(false, false);
2470 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); 2466 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN));
2471 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); 2467 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN));
2472 } 2468 }
2473 2469
2474 } // namespace chromeos 2470 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/events/event_rewriter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698