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

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

Issue 560853003: Revert of Fix test for master device. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | ui/events/event.cc » ('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 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 28 matching lines...) Expand all
39 #include "ui/events/test/events_test_utils_x11.h" 39 #include "ui/events/test/events_test_utils_x11.h"
40 #include "ui/events/x/touch_factory_x11.h" 40 #include "ui/events/x/touch_factory_x11.h"
41 #include "ui/gfx/x/x11_types.h" 41 #include "ui/gfx/x/x11_types.h"
42 #endif 42 #endif
43 43
44 namespace { 44 namespace {
45 45
46 // The device id of the test touchpad device. 46 // The device id of the test touchpad device.
47 const unsigned int kTouchPadDeviceId = 1; 47 const unsigned int kTouchPadDeviceId = 1;
48 const int kKeyboardDeviceId = 2; 48 const int kKeyboardDeviceId = 2;
49 const int kMasterKeyboardDeviceId = 3;
50 49
51 std::string GetExpectedResultAsString(ui::KeyboardCode ui_keycode, 50 std::string GetExpectedResultAsString(ui::KeyboardCode ui_keycode,
52 int ui_flags, 51 int ui_flags,
53 ui::EventType ui_type) { 52 ui::EventType ui_type) {
54 return base::StringPrintf("ui_keycode=0x%X ui_flags=0x%X ui_type=%d", 53 return base::StringPrintf("ui_keycode=0x%X ui_flags=0x%X ui_type=%d",
55 ui_keycode, 54 ui_keycode,
56 ui_flags & ~ui::EF_IS_REPEAT, 55 ui_flags & ~ui::EF_IS_REPEAT,
57 ui_type); 56 ui_type);
58 } 57 }
59 58
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 #if defined(USE_X11) 143 #if defined(USE_X11)
145 if (test.test & KeyTestCase::TEST_X11) { 144 if (test.test & KeyTestCase::TEST_X11) {
146 ui::ScopedXI2Event xev; 145 ui::ScopedXI2Event xev;
147 // Test an XKeyEvent. 146 // Test an XKeyEvent.
148 xev.InitKeyEvent(test.type, test.input.key_code, test.input.flags); 147 xev.InitKeyEvent(test.type, test.input.key_code, test.input.flags);
149 XEvent* xevent = xev; 148 XEvent* xevent = xev;
150 DCHECK((xevent->type == KeyPress) || (xevent->type == KeyRelease)); 149 DCHECK((xevent->type == KeyPress) || (xevent->type == KeyRelease));
151 if (xevent->xkey.keycode) 150 if (xevent->xkey.keycode)
152 CheckX11KeyTestCase(expected, rewriter, test, xevent); 151 CheckX11KeyTestCase(expected, rewriter, test, xevent);
153 // Test an XI2 GenericEvent. 152 // Test an XI2 GenericEvent.
154 xev.InitGenericKeyEvent(kMasterKeyboardDeviceId, 153 xev.InitGenericKeyEvent(
155 kKeyboardDeviceId, 154 kKeyboardDeviceId, test.type, test.input.key_code, test.input.flags);
156 test.type,
157 test.input.key_code,
158 test.input.flags);
159 xevent = xev; 155 xevent = xev;
160 DCHECK(xevent->type == GenericEvent); 156 DCHECK(xevent->type == GenericEvent);
161 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xevent->xcookie.data); 157 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xevent->xcookie.data);
162 DCHECK((xievent->evtype == XI_KeyPress) || 158 DCHECK((xievent->evtype == XI_KeyPress) ||
163 (xievent->evtype == XI_KeyRelease)); 159 (xievent->evtype == XI_KeyRelease));
164 if (xievent->detail) 160 if (xievent->detail)
165 CheckX11KeyTestCase(expected, rewriter, test, xevent); 161 CheckX11KeyTestCase(expected, rewriter, test, xevent);
166 } 162 }
167 #endif 163 #endif
168 } 164 }
(...skipping 2309 matching lines...) Expand 10 before | Expand all | Expand 10 after
2478 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); 2474 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN));
2479 EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); 2475 EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN));
2480 2476
2481 // Turn off AltGr and Mod3. 2477 // Turn off AltGr and Mod3.
2482 sticky_keys_controller_->SetModifiersEnabled(false, false); 2478 sticky_keys_controller_->SetModifiersEnabled(false, false);
2483 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); 2479 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN));
2484 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); 2480 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN));
2485 } 2481 }
2486 2482
2487 } // namespace chromeos 2483 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | ui/events/event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698