summaryrefslogtreecommitdiff
path: root/tests/basic
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2021-12-14 19:40:18 +0100
committerGitHub <noreply@github.com>2021-12-14 10:40:18 -0800
commit8b865a9d6445e3bce6c991224f373d71c67e87e5 (patch)
tree3e78e95b1f6ecc59833ceed1ee6418c93758bab5 /tests/basic
parentce5a2a736792dc6e3e9957a013821374d01fb6d6 (diff)
[Core] Don't send keyboard reports that propagate no changes to the host (#14065)
Diffstat (limited to 'tests/basic')
-rw-r--r--tests/basic/test_action_layer.cpp33
-rw-r--r--tests/basic/test_keypress.cpp55
-rw-r--r--tests/basic/test_one_shot_keys.cpp8
3 files changed, 40 insertions, 56 deletions
diff --git a/tests/basic/test_action_layer.cpp b/tests/basic/test_action_layer.cpp
index 1b12d13642..fe5c729f7c 100644
--- a/tests/basic/test_action_layer.cpp
+++ b/tests/basic/test_action_layer.cpp
@@ -131,14 +131,12 @@ TEST_F(ActionLayer, MomentaryLayerDoesNothing) {
131 set_keymap({layer_key}); 131 set_keymap({layer_key});
132 132
133 /* Press and release MO, nothing should happen. */ 133 /* Press and release MO, nothing should happen. */
134 /* TODO: QMK currently sends an empty report even if nothing needs to be reported to the host! */ 134 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
135 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1);
136 layer_key.press(); 135 layer_key.press();
137 run_one_scan_loop(); 136 run_one_scan_loop();
138 testing::Mock::VerifyAndClearExpectations(&driver); 137 testing::Mock::VerifyAndClearExpectations(&driver);
139 138
140 /* TODO: QMK currently sends an empty report even if nothing needs to be reported to the host! */ 139 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
141 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1);
142 layer_key.release(); 140 layer_key.release();
143 run_one_scan_loop(); 141 run_one_scan_loop();
144 testing::Mock::VerifyAndClearExpectations(&driver); 142 testing::Mock::VerifyAndClearExpectations(&driver);
@@ -153,8 +151,7 @@ TEST_F(ActionLayer, MomentaryLayerWithKeypress) {
153 set_keymap({layer_key, regular_key, KeymapKey{1, 1, 0, KC_B}}); 151 set_keymap({layer_key, regular_key, KeymapKey{1, 1, 0, KC_B}});
154 152
155 /* Press MO. */ 153 /* Press MO. */
156 /* TODO: QMK currently sends an empty report even if nothing needs to be reported to the host! */ 154 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
157 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1);
158 layer_key.press(); 155 layer_key.press();
159 run_one_scan_loop(); 156 run_one_scan_loop();
160 EXPECT_TRUE(layer_state_is(1)); 157 EXPECT_TRUE(layer_state_is(1));
@@ -175,8 +172,7 @@ TEST_F(ActionLayer, MomentaryLayerWithKeypress) {
175 testing::Mock::VerifyAndClearExpectations(&driver); 172 testing::Mock::VerifyAndClearExpectations(&driver);
176 173
177 /* Release MO */ 174 /* Release MO */
178 /* TODO: QMK currently sends an empty report even if nothing needs to be reported to the host! */ 175 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
179 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1);
180 layer_key.release(); 176 layer_key.release();
181 run_one_scan_loop(); 177 run_one_scan_loop();
182 EXPECT_TRUE(layer_state_is(0)); 178 EXPECT_TRUE(layer_state_is(0));
@@ -199,8 +195,7 @@ TEST_F(ActionLayer, ToggleLayerDoesNothing) {
199 testing::Mock::VerifyAndClearExpectations(&driver); 195 testing::Mock::VerifyAndClearExpectations(&driver);
200 196
201 /* Release TG. */ 197 /* Release TG. */
202 /* TODO: QMK currently sends an empty report even if nothing needs to be reported to the host! */ 198 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
203 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1);
204 layer_key.release(); 199 layer_key.release();
205 run_one_scan_loop(); 200 run_one_scan_loop();
206 EXPECT_TRUE(layer_state_is(1)); 201 EXPECT_TRUE(layer_state_is(1));
@@ -223,8 +218,7 @@ TEST_F(ActionLayer, ToggleLayerUpAndDown) {
223 EXPECT_TRUE(layer_state_is(1)); 218 EXPECT_TRUE(layer_state_is(1));
224 testing::Mock::VerifyAndClearExpectations(&driver); 219 testing::Mock::VerifyAndClearExpectations(&driver);
225 220
226 /* TODO: QMK currently sends an empty report even if nothing needs to be reported to the host! */ 221 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
227 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1);
228 toggle_layer_1_on_layer_0.release(); 222 toggle_layer_1_on_layer_0.release();
229 run_one_scan_loop(); 223 run_one_scan_loop();
230 EXPECT_TRUE(layer_state_is(1)); 224 EXPECT_TRUE(layer_state_is(1));
@@ -237,8 +231,7 @@ TEST_F(ActionLayer, ToggleLayerUpAndDown) {
237 EXPECT_TRUE(layer_state_is(0)); 231 EXPECT_TRUE(layer_state_is(0));
238 testing::Mock::VerifyAndClearExpectations(&driver); 232 testing::Mock::VerifyAndClearExpectations(&driver);
239 233
240 /* TODO: QMK currently sends an empty report even if nothing needs to be reported to the host! */ 234 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
241 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1);
242 toggle_layer_0_on_layer_1.release(); 235 toggle_layer_0_on_layer_1.release();
243 run_one_scan_loop(); 236 run_one_scan_loop();
244 EXPECT_TRUE(layer_state_is(0)); 237 EXPECT_TRUE(layer_state_is(0));
@@ -254,14 +247,13 @@ TEST_F(ActionLayer, LayerTapToggleDoesNothing) {
254 set_keymap({layer_key}); 247 set_keymap({layer_key});
255 248
256 /* Press and release TT. */ 249 /* Press and release TT. */
257 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(0); 250 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
258 layer_key.press(); 251 layer_key.press();
259 run_one_scan_loop(); 252 run_one_scan_loop();
260 EXPECT_TRUE(layer_state_is(1)); 253 EXPECT_TRUE(layer_state_is(1));
261 testing::Mock::VerifyAndClearExpectations(&driver); 254 testing::Mock::VerifyAndClearExpectations(&driver);
262 255
263 /* TODO: QMK currently sends an empty report even if nothing needs to be reported to the host! */ 256 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
264 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(2);
265 layer_key.release(); 257 layer_key.release();
266 run_one_scan_loop(); 258 run_one_scan_loop();
267 EXPECT_TRUE(layer_state_is(0)); 259 EXPECT_TRUE(layer_state_is(0));
@@ -279,7 +271,6 @@ TEST_F(ActionLayer, LayerTapToggleWithKeypress) {
279 set_keymap({layer_key, regular_key, KeymapKey{1, 1, 0, KC_B}}); 271 set_keymap({layer_key, regular_key, KeymapKey{1, 1, 0, KC_B}});
280 272
281 /* Press TT. */ 273 /* Press TT. */
282 /* TODO: QMK currently sends an empty report even if nothing needs to be reported to the host! */
283 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(0); 274 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(0);
284 layer_key.press(); 275 layer_key.press();
285 run_one_scan_loop(); 276 run_one_scan_loop();
@@ -298,8 +289,7 @@ TEST_F(ActionLayer, LayerTapToggleWithKeypress) {
298 EXPECT_TRUE(layer_state_is(1)); 289 EXPECT_TRUE(layer_state_is(1));
299 testing::Mock::VerifyAndClearExpectations(&driver); 290 testing::Mock::VerifyAndClearExpectations(&driver);
300 291
301 /* TODO: QMK currently sends an empty report even if nothing needs to be reported to the host! */ 292 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
302 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1);
303 layer_key.release(); 293 layer_key.release();
304 run_one_scan_loop(); 294 run_one_scan_loop();
305 EXPECT_TRUE(layer_state_is(0)); 295 EXPECT_TRUE(layer_state_is(0));
@@ -317,8 +307,7 @@ TEST_F(ActionLayer, LayerTapToggleWithToggleWithKeypress) {
317 set_keymap({layer_key, regular_key, KeymapKey{1, 1, 0, KC_B}}); 307 set_keymap({layer_key, regular_key, KeymapKey{1, 1, 0, KC_B}});
318 308
319 /* Tap TT five times . */ 309 /* Tap TT five times . */
320 /* TODO: QMK currently sends an empty report even if nothing needs to be reported to the host! */ 310 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
321 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(9);
322 311
323 layer_key.press(); 312 layer_key.press();
324 run_one_scan_loop(); 313 run_one_scan_loop();
diff --git a/tests/basic/test_keypress.cpp b/tests/basic/test_keypress.cpp
index 1c175c9d56..044fc29378 100644
--- a/tests/basic/test_keypress.cpp
+++ b/tests/basic/test_keypress.cpp
@@ -85,7 +85,7 @@ TEST_F(KeyPress, CorrectKeysAreReportedWhenTwoKeysArePressed) {
85TEST_F(KeyPress, LeftShiftIsReportedCorrectly) { 85TEST_F(KeyPress, LeftShiftIsReportedCorrectly) {
86 TestDriver driver; 86 TestDriver driver;
87 auto key_a = KeymapKey(0, 0, 0, KC_A); 87 auto key_a = KeymapKey(0, 0, 0, KC_A);
88 auto key_lsft = KeymapKey(0, 3, 0, KC_LSFT); 88 auto key_lsft = KeymapKey(0, 3, 0, KC_LEFT_SHIFT);
89 89
90 set_keymap({key_a, key_lsft}); 90 set_keymap({key_a, key_lsft});
91 91
@@ -110,8 +110,8 @@ TEST_F(KeyPress, LeftShiftIsReportedCorrectly) {
110 110
111TEST_F(KeyPress, PressLeftShiftAndControl) { 111TEST_F(KeyPress, PressLeftShiftAndControl) {
112 TestDriver driver; 112 TestDriver driver;
113 auto key_lsft = KeymapKey(0, 3, 0, KC_LSFT); 113 auto key_lsft = KeymapKey(0, 3, 0, KC_LEFT_SHIFT);
114 auto key_lctrl = KeymapKey(0, 5, 0, KC_LCTRL); 114 auto key_lctrl = KeymapKey(0, 5, 0, KC_LEFT_CTRL);
115 115
116 set_keymap({key_lctrl, key_lsft}); 116 set_keymap({key_lctrl, key_lsft});
117 117
@@ -138,8 +138,8 @@ TEST_F(KeyPress, PressLeftShiftAndControl) {
138 138
139TEST_F(KeyPress, LeftAndRightShiftCanBePressedAtTheSameTime) { 139TEST_F(KeyPress, LeftAndRightShiftCanBePressedAtTheSameTime) {
140 TestDriver driver; 140 TestDriver driver;
141 auto key_lsft = KeymapKey(0, 3, 0, KC_LSFT); 141 auto key_lsft = KeymapKey(0, 3, 0, KC_LEFT_SHIFT);
142 auto key_rsft = KeymapKey(0, 4, 0, KC_RSFT); 142 auto key_rsft = KeymapKey(0, 4, 0, KC_RIGHT_SHIFT);
143 143
144 set_keymap({key_rsft, key_lsft}); 144 set_keymap({key_rsft, key_lsft});
145 145
@@ -175,12 +175,12 @@ TEST_F(KeyPress, RightShiftLeftControlAndCharWithTheSameKey) {
175 // The underlying cause is that we use only one bit to represent the right hand 175 // The underlying cause is that we use only one bit to represent the right hand
176 // modifiers. 176 // modifiers.
177 combo_key.press(); 177 combo_key.press();
178 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RSFT, KC_RCTRL))); 178 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RIGHT_SHIFT, KC_RIGHT_CTRL)));
179 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RSFT, KC_RCTRL, KC_O))); 179 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RIGHT_SHIFT, KC_RIGHT_CTRL, KC_O)));
180 keyboard_task(); 180 keyboard_task();
181 181
182 combo_key.release(); 182 combo_key.release();
183 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RSFT, KC_RCTRL))); 183 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_RIGHT_SHIFT, KC_RIGHT_CTRL)));
184 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 184 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
185 keyboard_task(); 185 keyboard_task();
186} 186}
@@ -189,18 +189,18 @@ TEST_F(KeyPress, PressPlusEqualReleaseBeforePress) {
189 TestDriver driver; 189 TestDriver driver;
190 InSequence s; 190 InSequence s;
191 auto key_plus = KeymapKey(0, 1, 1, KC_PLUS); 191 auto key_plus = KeymapKey(0, 1, 1, KC_PLUS);
192 auto key_eql = KeymapKey(0, 0, 1, KC_EQL); 192 auto key_eql = KeymapKey(0, 0, 1, KC_EQUAL);
193 193
194 set_keymap({key_plus, key_eql}); 194 set_keymap({key_plus, key_eql});
195 195
196 key_plus.press(); 196 key_plus.press();
197 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT))); 197 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
198 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_EQL))); 198 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL)));
199 run_one_scan_loop(); 199 run_one_scan_loop();
200 testing::Mock::VerifyAndClearExpectations(&driver); 200 testing::Mock::VerifyAndClearExpectations(&driver);
201 201
202 key_plus.release(); 202 key_plus.release();
203 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT))); 203 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
204 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 204 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
205 run_one_scan_loop(); 205 run_one_scan_loop();
206 testing::Mock::VerifyAndClearExpectations(&driver); 206 testing::Mock::VerifyAndClearExpectations(&driver);
@@ -220,13 +220,13 @@ TEST_F(KeyPress, PressPlusEqualDontReleaseBeforePress) {
220 TestDriver driver; 220 TestDriver driver;
221 InSequence s; 221 InSequence s;
222 auto key_plus = KeymapKey(0, 1, 1, KC_PLUS); 222 auto key_plus = KeymapKey(0, 1, 1, KC_PLUS);
223 auto key_eql = KeymapKey(0, 0, 1, KC_EQL); 223 auto key_eql = KeymapKey(0, 0, 1, KC_EQUAL);
224 224
225 set_keymap({key_plus, key_eql}); 225 set_keymap({key_plus, key_eql});
226 226
227 key_plus.press(); 227 key_plus.press();
228 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT))); 228 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
229 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_EQL))); 229 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL)));
230 run_one_scan_loop(); 230 run_one_scan_loop();
231 testing::Mock::VerifyAndClearExpectations(&driver); 231 testing::Mock::VerifyAndClearExpectations(&driver);
232 232
@@ -237,14 +237,13 @@ TEST_F(KeyPress, PressPlusEqualDontReleaseBeforePress) {
237 testing::Mock::VerifyAndClearExpectations(&driver); 237 testing::Mock::VerifyAndClearExpectations(&driver);
238 238
239 key_plus.release(); 239 key_plus.release();
240 // BUG: Should really still return KC_EQL, but this is fine too 240 // BUG: Should really still return KC_EQUAL, but this is fine too
241 // It's also called twice for some reason 241 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(1);
242 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(2);
243 run_one_scan_loop(); 242 run_one_scan_loop();
244 testing::Mock::VerifyAndClearExpectations(&driver); 243 testing::Mock::VerifyAndClearExpectations(&driver);
245 244
246 key_eql.release(); 245 key_eql.release();
247 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 246 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
248 run_one_scan_loop(); 247 run_one_scan_loop();
249 testing::Mock::VerifyAndClearExpectations(&driver); 248 testing::Mock::VerifyAndClearExpectations(&driver);
250} 249}
@@ -253,12 +252,12 @@ TEST_F(KeyPress, PressEqualPlusReleaseBeforePress) {
253 TestDriver driver; 252 TestDriver driver;
254 InSequence s; 253 InSequence s;
255 auto key_plus = KeymapKey(0, 1, 1, KC_PLUS); 254 auto key_plus = KeymapKey(0, 1, 1, KC_PLUS);
256 auto key_eql = KeymapKey(0, 0, 1, KC_EQL); 255 auto key_eql = KeymapKey(0, 0, 1, KC_EQUAL);
257 256
258 set_keymap({key_plus, key_eql}); 257 set_keymap({key_plus, key_eql});
259 258
260 key_eql.press(); 259 key_eql.press();
261 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQL))); 260 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQUAL)));
262 run_one_scan_loop(); 261 run_one_scan_loop();
263 testing::Mock::VerifyAndClearExpectations(&driver); 262 testing::Mock::VerifyAndClearExpectations(&driver);
264 263
@@ -268,13 +267,13 @@ TEST_F(KeyPress, PressEqualPlusReleaseBeforePress) {
268 testing::Mock::VerifyAndClearExpectations(&driver); 267 testing::Mock::VerifyAndClearExpectations(&driver);
269 268
270 key_plus.press(); 269 key_plus.press();
271 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT))); 270 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
272 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT, KC_EQL))); 271 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT, KC_EQUAL)));
273 run_one_scan_loop(); 272 run_one_scan_loop();
274 testing::Mock::VerifyAndClearExpectations(&driver); 273 testing::Mock::VerifyAndClearExpectations(&driver);
275 274
276 key_plus.release(); 275 key_plus.release();
277 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LSFT))); 276 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
278 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 277 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
279 run_one_scan_loop(); 278 run_one_scan_loop();
280 testing::Mock::VerifyAndClearExpectations(&driver); 279 testing::Mock::VerifyAndClearExpectations(&driver);
@@ -284,12 +283,12 @@ TEST_F(KeyPress, PressEqualPlusDontReleaseBeforePress) {
284 TestDriver driver; 283 TestDriver driver;
285 InSequence s; 284 InSequence s;
286 auto key_plus = KeymapKey(0, 1, 1, KC_PLUS); 285 auto key_plus = KeymapKey(0, 1, 1, KC_PLUS);
287 auto key_eql = KeymapKey(0, 0, 1, KC_EQL); 286 auto key_eql = KeymapKey(0, 0, 1, KC_EQUAL);
288 287
289 set_keymap({key_plus, key_eql}); 288 set_keymap({key_plus, key_eql});
290 289
291 key_eql.press(); 290 key_eql.press();
292 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQL))); 291 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_EQUAL)));
293 run_one_scan_loop(); 292 run_one_scan_loop();
294 testing::Mock::VerifyAndClearExpectations(&driver); 293 testing::Mock::VerifyAndClearExpectations(&driver);
295 294
@@ -309,9 +308,7 @@ TEST_F(KeyPress, PressEqualPlusDontReleaseBeforePress) {
309 testing::Mock::VerifyAndClearExpectations(&driver); 308 testing::Mock::VerifyAndClearExpectations(&driver);
310 309
311 key_plus.release(); 310 key_plus.release();
312 // This report is not needed
313 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(KC_LEFT_SHIFT)));
314 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 311 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
315 run_one_scan_loop(); 312 run_one_scan_loop();
316 testing::Mock::VerifyAndClearExpectations(&driver); 313 testing::Mock::VerifyAndClearExpectations(&driver);
317} \ No newline at end of file 314}
diff --git a/tests/basic/test_one_shot_keys.cpp b/tests/basic/test_one_shot_keys.cpp
index 98178912e4..43fc3e1ba3 100644
--- a/tests/basic/test_one_shot_keys.cpp
+++ b/tests/basic/test_one_shot_keys.cpp
@@ -175,22 +175,20 @@ TEST_F(OneShot, OSLWithAdditionalKeypress) {
175 testing::Mock::VerifyAndClearExpectations(&driver); 175 testing::Mock::VerifyAndClearExpectations(&driver);
176 176
177 /* Release OSL key */ 177 /* Release OSL key */
178 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())).Times(2); 178 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
179 osl_key.release(); 179 osl_key.release();
180 run_one_scan_loop(); 180 run_one_scan_loop();
181 testing::Mock::VerifyAndClearExpectations(&driver); 181 testing::Mock::VerifyAndClearExpectations(&driver);
182 182
183 /* Press regular key */ 183 /* Press regular key */
184 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 184 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(regular_key.report_code))).Times(1);
185 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport(regular_key.report_code))).Times(2);
186 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
187 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 185 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport()));
188 regular_key.press(); 186 regular_key.press();
189 run_one_scan_loop(); 187 run_one_scan_loop();
190 testing::Mock::VerifyAndClearExpectations(&driver); 188 testing::Mock::VerifyAndClearExpectations(&driver);
191 189
192 /* Release regular key */ 190 /* Release regular key */
193 EXPECT_CALL(driver, send_keyboard_mock(KeyboardReport())); 191 EXPECT_CALL(driver, send_keyboard_mock(_)).Times(0);
194 regular_key.release(); 192 regular_key.release();
195 run_one_scan_loop(); 193 run_one_scan_loop();
196 testing::Mock::VerifyAndClearExpectations(&driver); 194 testing::Mock::VerifyAndClearExpectations(&driver);