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

Side by Side Diff: chrome/renderer/mock_keyboard.h

Issue 8230034: Split most of RenderViewTest and associated classes into content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac build breaks. Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2009 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 CHROME_RENDERER_MOCK_KEYBOARD_H_
6 #define CHROME_RENDERER_MOCK_KEYBOARD_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/basictypes.h"
12
13 #if defined(OS_WIN)
14 #include "chrome/renderer/mock_keyboard_driver_win.h"
15 #endif
16
17 // A mock keyboard interface.
18 // This class defines a pseudo keyboard device, which implements mappings from
19 // a tuple (layout, key code, modifiers) to Unicode characters so that
20 // engineers can write RenderViewTest cases without taking care of such
21 // mappings. (This mapping is not trivial when using non-US keyboards.)
22 // A pseudo keyboard device consists of two parts: a platform-independent part
23 // and a platform-dependent part. This class implements the platform-independent
24 // part. The platform-dependet part is implemented in the MockKeyboardWin class.
25 // This class is usually called from RenderViewTest::SendKeyEvent().
26 class MockKeyboard {
27 public:
28 // Represents keyboard-layouts.
29 enum Layout {
30 LAYOUT_NULL,
31 LAYOUT_ARABIC,
32 LAYOUT_BULGARIAN,
33 LAYOUT_CHINESE_TRADITIONAL,
34 LAYOUT_CZECH,
35 LAYOUT_DANISH,
36 LAYOUT_GERMAN,
37 LAYOUT_GREEK,
38 LAYOUT_UNITED_STATES,
39 LAYOUT_SPANISH,
40 LAYOUT_FINNISH,
41 LAYOUT_FRENCH,
42 LAYOUT_HEBREW,
43 LAYOUT_HUNGARIAN,
44 LAYOUT_ICELANDIC,
45 LAYOUT_ITALIAN,
46 LAYOUT_JAPANESE,
47 LAYOUT_KOREAN,
48 LAYOUT_POLISH,
49 LAYOUT_PORTUGUESE_BRAZILIAN,
50 LAYOUT_ROMANIAN,
51 LAYOUT_RUSSIAN,
52 LAYOUT_CROATIAN,
53 LAYOUT_SLOVAK,
54 LAYOUT_THAI,
55 LAYOUT_SWEDISH,
56 LAYOUT_TURKISH_Q,
57 LAYOUT_VIETNAMESE,
58 LAYOUT_DEVANAGARI_INSCRIPT,
59 LAYOUT_PORTUGUESE,
60 LAYOUT_UNITED_STATES_DVORAK,
61 LAYOUT_CANADIAN_FRENCH,
62 };
63
64 // Enumerates keyboard modifiers.
65 // These modifiers explicitly distinguish left-keys and right-keys because we
66 // should emulate AltGr (right-alt) key, used by many European keyboards to
67 // input alternate graph characters.
68 enum Modifiers {
69 INVALID = -1,
70 NONE = 0,
71 LEFT_SHIFT = 1 << 0,
72 LEFT_CONTROL = 1 << 1,
73 LEFT_ALT = 1 << 2,
74 LEFT_META = 1 << 3,
75 RIGHT_SHIFT = 1 << 4,
76 RIGHT_CONTROL = 1 << 5,
77 RIGHT_ALT = 1 << 6,
78 RIGHT_META = 1 << 7,
79 KEYPAD = 1 << 8,
80 AUTOREPEAAT = 1 << 9,
81 };
82
83 MockKeyboard();
84 ~MockKeyboard();
85
86 // Retrieves Unicode characters composed from the the specified keyboard
87 // layout, key code, and modifiers, i.e. characters returned when we type
88 // specified keys on a specified layout.
89 // This function returns the length of Unicode characters filled in the
90 // |output| parameter.
91 int GetCharacters(Layout layout,
92 int key_code,
93 Modifiers modifiers,
94 std::wstring* output);
95
96 private:
97 Layout keyboard_layout_;
98 Modifiers keyboard_modifiers_;
99
100 #if defined(OS_WIN)
101 MockKeyboardDriverWin driver_;
102 #endif
103
104 DISALLOW_COPY_AND_ASSIGN(MockKeyboard);
105 };
106
107 #endif // CHROME_RENDERER_MOCK_KEYBOARD_H_
OLDNEW
« no previous file with comments | « chrome/renderer/content_settings_observer_browsertest.cc ('k') | chrome/renderer/mock_keyboard.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698