src/devices/bin/driver_manager/resume_tests.cc
// Verify the device transitions in and out of the resuming state.
Verify the device transitions in and out of the resuming state.
Verify the device transitions in and out of the resuming state .
void ResumeTestCase::StateTest(zx_status_t resume_status, Device::State want_device_state) {
  size_t index;
  ASSERT_NO_FATAL_FAILURES(AddDevice(platform_bus(), "device", 0 , "", &index));
  coordinator_.sys_device()->set_state(Device::State::kSuspended);
  coordinator_.sys_device()->proxy()->set_state(Device::State::kSuspended);
  platform_bus()->set_state(Device::State::kSuspended);
  device(index)->device->set_state(Device::State::kSuspended);
  ASSERT_NO_FATAL_FAILURES(DoResume(SystemPowerState::FULLY_ON));
  zx_txid_t txid;
  ASSERT_NO_FATAL_FAILURES(
      CheckResumeReceived(sys_proxy_controller_remote_, SystemPowerState::FULLY_ON, ZX_OK));
  coordinator_loop()->RunUntilIdle();
  ASSERT_NO_FATAL_FAILURES(
      CheckResumeReceived(platform_bus_controller_remote(), SystemPowerState::FULLY_ON, ZX_OK));
  coordinator_loop()->RunUntilIdle();
  ASSERT_NO_FATAL_FAILURES(
      CheckResumeReceived(device(index)->controller_remote, SystemPowerState::FULLY_ON, &txid));
  ASSERT_EQ(device(index)->device->state(), Device::State::kResuming);
  ASSERT_NO_FATAL_FAILURES(SendResumeReply(device(index)->controller_remote, resume_status, txid));
  coordinator_loop()->RunUntilIdle();
  ASSERT_EQ(device(index)->device->state(), want_device_state);
}
void ResumeTestCase :: StateTest ( zx_status_t resume_status , Device :: State want_device_state ) { size_t index ; ASSERT_NO_FATAL_FAILURES ( AddDevice ( platform_bus ( ) , " " , 0 , " " , & index ) ) ; coordinator_ . sys_device ( ) -> set_state ( Device :: State :: kSuspended ) ; coordinator_ . sys_device ( ) -> proxy ( ) -> set_state ( Device :: State :: kSuspended ) ; platform_bus ( ) -> set_state ( Device :: State :: kSuspended ) ; device ( index ) -> device -> set_state ( Device :: State :: kSuspended ) ; ASSERT_NO_FATAL_FAILURES ( DoResume ( SystemPowerState :: FULLY_ON ) ) ; zx_txid_t txid ; ASSERT_NO_FATAL_FAILURES ( CheckResumeReceived ( sys_proxy_controller_remote_ , SystemPowerState :: FULLY_ON , ZX_OK ) ) ; coordinator_loop ( ) -> RunUntilIdle ( ) ; ASSERT_NO_FATAL_FAILURES ( CheckResumeReceived ( platform_bus_controller_remote ( ) , SystemPowerState :: FULLY_ON , ZX_OK ) ) ; coordinator_loop ( ) -> RunUntilIdle ( ) ; ASSERT_NO_FATAL_FAILURES ( CheckResumeReceived ( device ( index ) -> controller_remote , SystemPowerState :: FULLY_ON , & txid ) ) ; ASSERT_EQ ( device ( index ) -> device -> state ( ) , Device :: State :: kResuming ) ; ASSERT_NO_FATAL_FAILURES ( SendResumeReply ( device ( index ) -> controller_remote , resume_status , txid ) ) ; coordinator_loop ( ) -> RunUntilIdle ( ) ; ASSERT_EQ ( device ( index ) -> device -> state ( ) , want_device_state ) ; }
Verify the device transitions in and out of the resuming state.
Verify the device transitions in and out of the resuming state .
/* protocol id */ // Mark all devices suspened. // Check for the resume message without replying.