diff options
| author | Stefan Kerkmann <karlk90@pm.me> | 2022-12-18 21:55:14 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-18 21:55:14 +0100 |
| commit | c2b13bd77b71ea73db12a6cda64871565036a6dc (patch) | |
| tree | e24c99abb8260a929b9fcc4cba21705475514c07 /tests/secure | |
| parent | 7aa2d791f69244a5f17ec0d00908ec5a05d21103 (diff) | |
Introduce VERIFY_AND_CLEAR shorthand (#19370)
Which is just a syntactic sugar for
testing::Mock::VerifyAndClearExpectations to reduce the visual clutter
in unit-tests.
Diffstat (limited to 'tests/secure')
| -rw-r--r-- | tests/secure/test_secure.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/secure/test_secure.cpp b/tests/secure/test_secure.cpp index 6ca98d78f3..3162e9d5df 100644 --- a/tests/secure/test_secure.cpp +++ b/tests/secure/test_secure.cpp | |||
| @@ -43,7 +43,7 @@ TEST_F(Secure, test_lock) { | |||
| 43 | secure_lock(); | 43 | secure_lock(); |
| 44 | EXPECT_FALSE(secure_is_unlocked()); | 44 | EXPECT_FALSE(secure_is_unlocked()); |
| 45 | 45 | ||
| 46 | testing::Mock::VerifyAndClearExpectations(&driver); | 46 | VERIFY_AND_CLEAR(driver); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | TEST_F(Secure, test_unlock_timeout) { | 49 | TEST_F(Secure, test_unlock_timeout) { |
| @@ -58,7 +58,7 @@ TEST_F(Secure, test_unlock_timeout) { | |||
| 58 | idle_for(SECURE_IDLE_TIMEOUT + 1); | 58 | idle_for(SECURE_IDLE_TIMEOUT + 1); |
| 59 | EXPECT_FALSE(secure_is_unlocked()); | 59 | EXPECT_FALSE(secure_is_unlocked()); |
| 60 | 60 | ||
| 61 | testing::Mock::VerifyAndClearExpectations(&driver); | 61 | VERIFY_AND_CLEAR(driver); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | TEST_F(Secure, test_unlock_request) { | 64 | TEST_F(Secure, test_unlock_request) { |
| @@ -80,7 +80,7 @@ TEST_F(Secure, test_unlock_request) { | |||
| 80 | tap_keys(key_a, key_b, key_c, key_d); | 80 | tap_keys(key_a, key_b, key_c, key_d); |
| 81 | EXPECT_TRUE(secure_is_unlocked()); | 81 | EXPECT_TRUE(secure_is_unlocked()); |
| 82 | 82 | ||
| 83 | testing::Mock::VerifyAndClearExpectations(&driver); | 83 | VERIFY_AND_CLEAR(driver); |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | TEST_F(Secure, test_unlock_request_fail) { | 86 | TEST_F(Secure, test_unlock_request_fail) { |
| @@ -108,7 +108,7 @@ TEST_F(Secure, test_unlock_request_fail) { | |||
| 108 | tap_keys(key_e, key_a, key_b, key_c, key_d); | 108 | tap_keys(key_e, key_a, key_b, key_c, key_d); |
| 109 | EXPECT_FALSE(secure_is_unlocked()); | 109 | EXPECT_FALSE(secure_is_unlocked()); |
| 110 | 110 | ||
| 111 | testing::Mock::VerifyAndClearExpectations(&driver); | 111 | VERIFY_AND_CLEAR(driver); |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | TEST_F(Secure, test_unlock_request_timeout) { | 114 | TEST_F(Secure, test_unlock_request_timeout) { |
| @@ -124,7 +124,7 @@ TEST_F(Secure, test_unlock_request_timeout) { | |||
| 124 | EXPECT_FALSE(secure_is_unlocking()); | 124 | EXPECT_FALSE(secure_is_unlocking()); |
| 125 | EXPECT_FALSE(secure_is_unlocked()); | 125 | EXPECT_FALSE(secure_is_unlocked()); |
| 126 | 126 | ||
| 127 | testing::Mock::VerifyAndClearExpectations(&driver); | 127 | VERIFY_AND_CLEAR(driver); |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | TEST_F(Secure, test_unlock_request_fail_mid) { | 130 | TEST_F(Secure, test_unlock_request_fail_mid) { |
| @@ -151,7 +151,7 @@ TEST_F(Secure, test_unlock_request_fail_mid) { | |||
| 151 | EXPECT_FALSE(secure_is_unlocking()); | 151 | EXPECT_FALSE(secure_is_unlocking()); |
| 152 | EXPECT_FALSE(secure_is_unlocked()); | 152 | EXPECT_FALSE(secure_is_unlocked()); |
| 153 | 153 | ||
| 154 | testing::Mock::VerifyAndClearExpectations(&driver); | 154 | VERIFY_AND_CLEAR(driver); |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | TEST_F(Secure, test_unlock_request_fail_out_of_order) { | 157 | TEST_F(Secure, test_unlock_request_fail_out_of_order) { |
| @@ -179,7 +179,7 @@ TEST_F(Secure, test_unlock_request_fail_out_of_order) { | |||
| 179 | EXPECT_FALSE(secure_is_unlocking()); | 179 | EXPECT_FALSE(secure_is_unlocking()); |
| 180 | EXPECT_FALSE(secure_is_unlocked()); | 180 | EXPECT_FALSE(secure_is_unlocked()); |
| 181 | 181 | ||
| 182 | testing::Mock::VerifyAndClearExpectations(&driver); | 182 | VERIFY_AND_CLEAR(driver); |
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | TEST_F(Secure, test_unlock_request_on_layer) { | 185 | TEST_F(Secure, test_unlock_request_on_layer) { |
| @@ -206,7 +206,7 @@ TEST_F(Secure, test_unlock_request_on_layer) { | |||
| 206 | EXPECT_TRUE(secure_is_unlocked()); | 206 | EXPECT_TRUE(secure_is_unlocked()); |
| 207 | EXPECT_FALSE(layer_state_is(1)); | 207 | EXPECT_FALSE(layer_state_is(1)); |
| 208 | 208 | ||
| 209 | testing::Mock::VerifyAndClearExpectations(&driver); | 209 | VERIFY_AND_CLEAR(driver); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | TEST_F(Secure, test_unlock_request_mid_stroke) { | 212 | TEST_F(Secure, test_unlock_request_mid_stroke) { |
| @@ -231,7 +231,7 @@ TEST_F(Secure, test_unlock_request_mid_stroke) { | |||
| 231 | tap_keys(key_a, key_b, key_c, key_d); | 231 | tap_keys(key_a, key_b, key_c, key_d); |
| 232 | EXPECT_TRUE(secure_is_unlocked()); | 232 | EXPECT_TRUE(secure_is_unlocked()); |
| 233 | 233 | ||
| 234 | testing::Mock::VerifyAndClearExpectations(&driver); | 234 | VERIFY_AND_CLEAR(driver); |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | TEST_F(Secure, test_unlock_request_mods) { | 237 | TEST_F(Secure, test_unlock_request_mods) { |
| @@ -256,5 +256,5 @@ TEST_F(Secure, test_unlock_request_mods) { | |||
| 256 | tap_keys(key_a, key_b, key_c, key_d); | 256 | tap_keys(key_a, key_b, key_c, key_d); |
| 257 | EXPECT_TRUE(secure_is_unlocked()); | 257 | EXPECT_TRUE(secure_is_unlocked()); |
| 258 | 258 | ||
| 259 | testing::Mock::VerifyAndClearExpectations(&driver); | 259 | VERIFY_AND_CLEAR(driver); |
| 260 | } | 260 | } |
