Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit dbcf8a0a authored by Robert Horvath's avatar Robert Horvath
Browse files

Set DreamsActivateOnSleepSetting and handle Sandman in tests

Two PowerManagerServiceTest were failing on TV:
- testRemovedDisplayGroupWakeLock_affectsNoDisplayGroups
- testWakeLock_affectsProperDisplayGroup

These tests expected the device to be DOZING at the end of the test,
but the devices was found to be DREAMING.
This difference came from `mDreamsActivateOnSleepSetting`, which was
not set for phones, but is set on TV.
Two tests are added to test the behaviour of this setting.

This CL also changes a call to `Handler#sendMessage` to
`Handler#sendMessageAtTime`, which schedules the message according to
the time of the test clock, instead of the real SystemClock.
This causes `handleSandman` to actually run during the test,
which would put the device to sleep if DOZING and dream couldn't be
started, so when #startDream is called on the DreamManager mock,
we set #isDreaming on the mock.

Bug: 205837239
Test: atest PowerManagerServiceTest
Change-Id: I6f27ea6a5cf8ddb1b7735c8d6ef67f27a5eb3747
parent b8bfc0a0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment