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: chrome/browser/chromeos/events/event_rewriter_unittest.cc

Issue 538143002: Fix test for master device. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Identify virtual core keyboard. 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;
49 50
50 std::string GetExpectedResultAsString(ui::KeyboardCode ui_keycode, 51 std::string GetExpectedResultAsString(ui::KeyboardCode ui_keycode,
51 int ui_flags, 52 int ui_flags,
52 ui::EventType ui_type) { 53 ui::EventType ui_type) {
53 return base::StringPrintf("ui_keycode=0x%X ui_flags=0x%X ui_type=%d", 54 return base::StringPrintf("ui_keycode=0x%X ui_flags=0x%X ui_type=%d",
54 ui_keycode, 55 ui_keycode,
55 ui_flags & ~ui::EF_IS_REPEAT, 56 ui_flags & ~ui::EF_IS_REPEAT,
56 ui_type); 57 ui_type);
57 } 58 }
58 59
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 #if defined(USE_X11) 144 #if defined(USE_X11)
144 if (test.test & KeyTestCase::TEST_X11) { 145 if (test.test & KeyTestCase::TEST_X11) {
145 ui::ScopedXI2Event xev; 146 ui::ScopedXI2Event xev;
146 // Test an XKeyEvent. 147 // Test an XKeyEvent.
147 xev.InitKeyEvent(test.type, test.input.key_code, test.input.flags); 148 xev.InitKeyEvent(test.type, test.input.key_code, test.input.flags);
148 XEvent* xevent = xev; 149 XEvent* xevent = xev;
149 DCHECK((xevent->type == KeyPress) || (xevent->type == KeyRelease)); 150 DCHECK((xevent->type == KeyPress) || (xevent->type == KeyRelease));
150 if (xevent->xkey.keycode) 151 if (xevent->xkey.keycode)
151 CheckX11KeyTestCase(expected, rewriter, test, xevent); 152 CheckX11KeyTestCase(expected, rewriter, test, xevent);
152 // Test an XI2 GenericEvent. 153 // Test an XI2 GenericEvent.
153 xev.InitGenericKeyEvent( 154 xev.InitGenericKeyEvent(kMasterKeyboardDeviceId,
154 kKeyboardDeviceId, test.type, test.input.key_code, test.input.flags); 155 kKeyboardDeviceId,
156 test.type,
157 test.input.key_code,
158 test.input.flags);
155 xevent = xev; 159 xevent = xev;
156 DCHECK(xevent->type == GenericEvent); 160 DCHECK(xevent->type == GenericEvent);
157 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xevent->xcookie.data); 161 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xevent->xcookie.data);
158 DCHECK((xievent->evtype == XI_KeyPress) || 162 DCHECK((xievent->evtype == XI_KeyPress) ||
159 (xievent->evtype == XI_KeyRelease)); 163 (xievent->evtype == XI_KeyRelease));
160 if (xievent->detail) 164 if (xievent->detail)
161 CheckX11KeyTestCase(expected, rewriter, test, xevent); 165 CheckX11KeyTestCase(expected, rewriter, test, xevent);
162 } 166 }
163 #endif 167 #endif
164 } 168 }
(...skipping 2309 matching lines...) Expand 10 before | Expand all | Expand 10 after
2474 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); 2478 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN));
2475 EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); 2479 EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN));
2476 2480
2477 // Turn off AltGr and Mod3. 2481 // Turn off AltGr and Mod3.
2478 sticky_keys_controller_->SetModifiersEnabled(false, false); 2482 sticky_keys_controller_->SetModifiersEnabled(false, false);
2479 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); 2483 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN));
2480 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); 2484 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN));
2481 } 2485 }
2482 2486
2483 } // namespace chromeos 2487 } // 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