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

Side by Side Diff: ui/events/test/keyboard_layout.h

Issue 2197113002: Force U.S. English keyboard layout for TextfieldTest.KeysWithModifiersTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix review issues Created 4 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_EVENTS_TEST_KEYBOARD_LAYOUT_H_
6 #define UI_EVENTS_TEST_KEYBOARD_LAYOUT_H_
7
8 #include "base/macros.h"
9 #include "build/build_config.h"
10
11 #if defined(OS_WIN)
12 #include <windows.h>
13 #elif defined(OS_MACOSX)
14 #include <Carbon/Carbon.h>
15 #include "base/mac/scoped_cftyperef.h"
16 #endif
17
18 #if defined(OS_WIN) || defined(OS_MACOSX)
Peter Kasting 2016/08/26 18:54:33 If this header only defines the contents below for
Tomasz Moniuszko 2016/08/31 15:29:42 Right, it won't work for tests which are disabled
19 namespace ui {
20
21 enum KeyboardLayout {
22 KEYBOARD_LAYOUT_ENGLISH_US,
23 KEYBOARD_LAYOUT_FRENCH,
24 KEYBOARD_LAYOUT_GERMAN,
25 KEYBOARD_LAYOUT_GREEK,
26 KEYBOARD_LAYOUT_JAPANESE,
27 KEYBOARD_LAYOUT_KOREAN,
28 KEYBOARD_LAYOUT_RUSSIAN,
29 };
30
31 #if defined(OS_WIN)
32 using PlatformKeyboardLayout = HKL;
33 #elif defined(OS_MACOSX)
34 using PlatformKeyboardLayout = base::ScopedCFTypeRef<TISInputSourceRef>;
35 #endif
36
37 PlatformKeyboardLayout GetPlatformKeyboardLayout(KeyboardLayout layout);
38
39 // Changes the active keyboard layout for the scope of this object.
40 class ScopedKeyboardLayout {
41 public:
42 explicit ScopedKeyboardLayout(KeyboardLayout layout);
43 ~ScopedKeyboardLayout();
44
45 private:
46 static PlatformKeyboardLayout GetActiveLayout();
47 static void ActivateLayout(PlatformKeyboardLayout layout);
48
49 PlatformKeyboardLayout original_layout_;
50
51 DISALLOW_COPY_AND_ASSIGN(ScopedKeyboardLayout);
52 };
53
54 } // namespace ui
55 #endif // defined(OS_WIN) || defined(OS_MACOSX)
56
57 #endif // UI_EVENTS_TEST_KEYBOARD_LAYOUT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698