997 {
998 final KeyboardTester
tester =
new KeyboardTester();
999 final ArrayList<CallRecord> calls = new ArrayList<>();
1000
1001 tester.recordEmbedderCallsTo(calls);
1002 tester.respondToTextInputWith(
true);
1003
1004
1005 tester.keyboardManager.handleEvent(
1006 new FakeKeyEvent(ACTION_DOWN,
SCAN_SHIFT_LEFT, KEYCODE_SHIFT_LEFT, 0,
'\0', 0x41));
1008 calls,
1009 new KeyData[] {
1012 PHYSICAL_SHIFT_LEFT,
1013 LOGICAL_SHIFT_LEFT,
1014 null,
1015 false,
1016 DeviceType.kKeyboard),
1017 });
1018 calls.clear();
1019
1020 tester.keyboardManager.handleEvent(
1021 new FakeKeyEvent(ACTION_UP,
SCAN_SHIFT_LEFT, KEYCODE_SHIFT_LEFT, 0,
'\0', 0));
1023 calls,
1024 new KeyData[] {
1026 Type.kUp, PHYSICAL_SHIFT_LEFT, LOGICAL_SHIFT_LEFT,
null,
false, DeviceType.kKeyboard),
1027 });
1028 calls.clear();
1029
1030
1031 tester.keyboardManager.handleEvent(
1032 new FakeKeyEvent(ACTION_DOWN,
SCAN_SHIFT_RIGHT, KEYCODE_SHIFT_RIGHT, 0,
'\0', 0x41));
1034 calls,
1035 new KeyData[] {
1038 PHYSICAL_SHIFT_RIGHT,
1039 LOGICAL_SHIFT_RIGHT,
1040 null,
1041 false,
1042 DeviceType.kKeyboard),
1043 });
1044 calls.clear();
1045
1046 tester.keyboardManager.handleEvent(
1047 new FakeKeyEvent(ACTION_UP,
SCAN_SHIFT_RIGHT, KEYCODE_SHIFT_RIGHT, 0,
'\0', 0));
1049 calls,
1050 new KeyData[] {
1053 PHYSICAL_SHIFT_RIGHT,
1054 LOGICAL_SHIFT_RIGHT,
1055 null,
1056 false,
1057 DeviceType.kKeyboard),
1058 });
1059 calls.clear();
1060
1061
1062 tester.keyboardManager.handleEvent(
1063 new FakeKeyEvent(ACTION_DOWN,
SCAN_CONTROL_LEFT, KEYCODE_CTRL_LEFT, 0,
'\0', 0x3000));
1065 calls,
1066 new KeyData[] {
1069 PHYSICAL_CONTROL_LEFT,
1070 LOGICAL_CONTROL_LEFT,
1071 null,
1072 false,
1073 DeviceType.kKeyboard),
1074 });
1075 calls.clear();
1076
1077 tester.keyboardManager.handleEvent(
1080 calls,
1081 new KeyData[] {
1084 PHYSICAL_CONTROL_LEFT,
1085 LOGICAL_CONTROL_LEFT,
1086 null,
1087 false,
1088 DeviceType.kKeyboard),
1089 });
1090 calls.clear();
1091
1092
1093 tester.keyboardManager.handleEvent(
1094 new FakeKeyEvent(ACTION_DOWN,
SCAN_CONTROL_RIGHT, KEYCODE_CTRL_RIGHT, 0,
'\0', 0x3000));
1096 calls,
1097 new KeyData[] {
1100 PHYSICAL_CONTROL_RIGHT,
1101 LOGICAL_CONTROL_RIGHT,
1102 null,
1103 false,
1104 DeviceType.kKeyboard),
1105 });
1106 calls.clear();
1107
1108 tester.keyboardManager.handleEvent(
1111 calls,
1112 new KeyData[] {
1115 PHYSICAL_CONTROL_RIGHT,
1116 LOGICAL_CONTROL_RIGHT,
1117 null,
1118 false,
1119 DeviceType.kKeyboard),
1120 });
1121 calls.clear();
1122
1123
1124 tester.keyboardManager.handleEvent(
1125 new FakeKeyEvent(ACTION_DOWN,
SCAN_ALT_LEFT, KEYCODE_ALT_LEFT, 0,
'\0', 0x12));
1127 calls,
1128 new KeyData[] {
1130 Type.kDown, PHYSICAL_ALT_LEFT, LOGICAL_ALT_LEFT,
null,
false, DeviceType.kKeyboard),
1131 });
1132 calls.clear();
1133
1134 tester.keyboardManager.handleEvent(
1135 new FakeKeyEvent(ACTION_UP,
SCAN_ALT_LEFT, KEYCODE_ALT_LEFT, 0,
'\0', 0));
1137 calls,
1138 new KeyData[] {
1140 Type.kUp, PHYSICAL_ALT_LEFT, LOGICAL_ALT_LEFT,
null,
false, DeviceType.kKeyboard),
1141 });
1142 calls.clear();
1143
1144
1145 tester.keyboardManager.handleEvent(
1146 new FakeKeyEvent(ACTION_DOWN,
SCAN_ALT_RIGHT, KEYCODE_ALT_RIGHT, 0,
'\0', 0x12));
1148 calls,
1149 new KeyData[] {
1151 Type.kDown, PHYSICAL_ALT_RIGHT, LOGICAL_ALT_RIGHT,
null,
false, DeviceType.kKeyboard),
1152 });
1153 calls.clear();
1154
1155 tester.keyboardManager.handleEvent(
1156 new FakeKeyEvent(ACTION_UP,
SCAN_ALT_RIGHT, KEYCODE_ALT_RIGHT, 0,
'\0', 0));
1158 calls,
1159 new KeyData[] {
1161 Type.kUp, PHYSICAL_ALT_RIGHT, LOGICAL_ALT_RIGHT,
null,
false, DeviceType.kKeyboard),
1162 });
1163 calls.clear();
1164 }
static final int SCAN_SHIFT_LEFT
static final int SCAN_ALT_LEFT
static final int SCAN_SHIFT_RIGHT
static final int SCAN_ALT_RIGHT
static final int SCAN_CONTROL_RIGHT
static final int SCAN_CONTROL_LEFT