[Unit test] Fix flakiness in CarPowerManagementTest

Some tests require that no power transition takes place. The timeout
for these tests was set the same as the timeout that cancels Garage
Mode if it runs too long. When Garage Mode is canceled, a new power
state is reported. These tests would pass or fail based on the order
of the timeouts.

Also, some tests look for a particular power state report, but want to
ignore SHUTDOWN_POSTPONE reports. The code that did this check would
only look at the first reported state and ignored any others. This
caused flakiness based on where a reported state happend to be in
the list at the time of the check.

Fixes: 149837279
Fixes: 146210534
Test: Updates CarPowerManagementTest
Change-Id: I9313adc049c78014e098ad8375c7196163315a39
1 file changed
tree: cc9f3c627c4cd2be71f7181cd43759762d3627fb
  1. car-bugreportd/
  2. car-default-input-service/
  3. car-lib/
  4. car-maps-placeholder/
  5. car-systemtest-lib/
  6. car-test-lib/
  7. car-usb-handler/
  8. car_product/
  9. computepipe/
  10. EncryptionRunner/
  11. evs/
  12. experimental/
  13. FrameworkPackageStubs/
  14. obd2-lib/
  15. procfs-inspector/
  16. service/
  17. surround_view/
  18. tests/
  19. tools/
  20. user/
  21. vehicle-hal-support-lib/
  22. watchdog/
  23. .clang-format
  24. .gitignore
  25. Android.mk
  26. CleanSpec.mk
  27. CPPLINT.cfg
  28. OWNERS
  29. PREUPLOAD.cfg
  30. README.md
README.md

Native (C++) code format is required to be compatible with .clang-format file. Run

git clang-format --style=file --extension='h,cpp,cc' HEAD~

Note that clang-format is not desirable for Android java files. Therefore the command line above is limited to specific extensions.