diff options
| author | 2024-01-22 18:16:02 +0000 | |
|---|---|---|
| committer | 2024-01-22 19:14:24 +0000 | |
| commit | 37d64fa5ed0655fa3329f1d71583f2d42745fe41 (patch) | |
| tree | c941a76c6149b04375ceefc70d51f2d736388a3e /libs/androidfw/FileStream.cpp | |
| parent | ef057fc59d3571f95c1c395c1923d044a746bb19 (diff) | |
LockPatternUtilsTest: use dependency injection for ILockSettings
LockPatternUtilsTest is spying on LockPatternUtils to try to inject a
mock ILockSettings. Using "spy" is an anti-pattern, and it doesn't seem
to work properly as the following test failure occurs:
[8/17] com.android.internal.util.LockPatternUtilsTest#isLockScreenDisabled_isSecureAndDemoUser_false: FAILED (3ms)
STACKTRACE:
java.lang.AssertionError
at org.junit.Assert.fail(Assert.java:87)
at org.junit.Assert.assertTrue(Assert.java:42)
at org.junit.Assert.assertFalse(Assert.java:65)
at org.junit.Assert.assertFalse(Assert.java:75)
at com.android.internal.util.LockPatternUtilsTest.isLockScreenDisabled_isSecureAndDemoUser_false(LockPatternUtilsTest.java:148)
This CL fixes the bug by making LockPatternUtils optionally take an
ILockSettings via constructor.
Note: LockPatternUtils#getLockSettings() cannot yet be changed to
private because it actually has a caller in non-test code.
Bug: 321737173
Ignore-AOSP-First: Conflict due to security fix ag/25939141
Flag: NA
Test: atest FrameworksUtilTests:com.android.internal.util.LockPatternUtilsTest
Change-Id: I242d3bdfe62c0be5a40df6028c6d34fad8f0abe2
Diffstat (limited to 'libs/androidfw/FileStream.cpp')
0 files changed, 0 insertions, 0 deletions