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

Side by Side Diff: ui/events/event_unittest.cc

Issue 1061733002: Remove windows/mac/ios specific code from //ui (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix default try set Created 5 years, 8 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 | « ui/events/event.cc ('k') | ui/events/gestures/gesture_recognizer_impl_mac.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 (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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "ui/events/event.h" 7 #include "ui/events/event.h"
8 #include "ui/events/event_utils.h" 8 #include "ui/events/event_utils.h"
9 #include "ui/events/keycodes/dom4/keycode_converter.h" 9 #include "ui/events/keycodes/dom4/keycode_converter.h"
10 #include "ui/events/test/events_test_utils.h" 10 #include "ui/events/test/events_test_utils.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 KeyEvent key(ET_KEY_PRESSED, VKEY_RETURN, kCodeForSpace, EF_NONE); 217 KeyEvent key(ET_KEY_PRESSED, VKEY_RETURN, kCodeForSpace, EF_NONE);
218 EXPECT_EQ(kCodeForSpace, key.code()); 218 EXPECT_EQ(kCodeForSpace, key.code());
219 } 219 }
220 { 220 {
221 // If the synthetic event is initialized without code, it returns 221 // If the synthetic event is initialized without code, it returns
222 // an empty string. 222 // an empty string.
223 // TODO(komatsu): Fill a fallback value assuming the US keyboard layout. 223 // TODO(komatsu): Fill a fallback value assuming the US keyboard layout.
224 KeyEvent key(ET_KEY_PRESSED, VKEY_SPACE, EF_NONE); 224 KeyEvent key(ET_KEY_PRESSED, VKEY_SPACE, EF_NONE);
225 EXPECT_TRUE(key.code().empty()); 225 EXPECT_TRUE(key.code().empty());
226 } 226 }
227 #if defined(OS_WIN)
228 {
229 // Test a non extended key.
230 ASSERT_EQ((kNativeCodeSpace & 0xFF), kNativeCodeSpace);
231
232 const LPARAM lParam = GetLParamFromScanCode(kNativeCodeSpace);
233 MSG native_event = { NULL, WM_KEYUP, VKEY_SPACE, lParam };
234 KeyEvent key(native_event);
235
236 // KeyEvent converts from the native keycode (scan code) to the code.
237 EXPECT_EQ(kCodeForSpace, key.code());
238 }
239 {
240 const char kCodeForHome[] = "Home";
241 const uint16 kNativeCodeHome = 0xe047;
242
243 // 'Home' is an extended key with 0xe000 bits.
244 ASSERT_NE((kNativeCodeHome & 0xFF), kNativeCodeHome);
245 const LPARAM lParam = GetLParamFromScanCode(kNativeCodeHome);
246
247 MSG native_event = { NULL, WM_KEYUP, VKEY_HOME, lParam };
248 KeyEvent key(native_event);
249
250 // KeyEvent converts from the native keycode (scan code) to the code.
251 EXPECT_EQ(kCodeForHome, key.code());
252 }
253 #endif // OS_WIN
254 } 227 }
255 228
256 } // namespace ui 229 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/event.cc ('k') | ui/events/gestures/gesture_recognizer_impl_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698