/// Advance executor by `duration`.
/// This function repeatedly advances the executor by 1 second, triggering
/// any expired timers and running the test_fut, until `duration` is reached.
Advance executor by `duration`.
This function repeatedly advances the executor by 1 second, triggering
any expired timers and running the test_fut, until `duration` is reached.
Advance executor by ` duration ` . This function repeatedly advances the executor by 1 second triggering any expired timers and running the test_fut until ` duration ` is reached .
fn advance_by(
            &mut self,
            duration: zx::Duration,
            mut test_fut: Pin<&mut impl Future<Output = ()>>,
        ) {
            assert_eq!(
                duration.into_nanos() % STEP_INCREMENT.into_nanos(),
                0,
                "duration {:?} is not divisible by STEP_INCREMENT",
                duration,
            );
            const_assert_eq!(
                TELEMETRY_QUERY_INTERVAL.into_nanos() % STEP_INCREMENT.into_nanos(),
                0
            );
            for _i in 0..(duration.into_nanos() / STEP_INCREMENT.into_nanos()) {
                self.exec.set_fake_time(fasync::Time::after(STEP_INCREMENT));
                let _ = self.exec.wake_expired_timers();
                assert_eq!(self.exec.run_until_stalled(&mut test_fut), Poll::Pending);
                respond_iface_stats_req(
                    &mut self.exec,
                    &mut self.dev_svc_stream,
                    &mut self.iface_stats_req_handler,
                );
                // Respond to any potential Cobalt request, draining their payloads to
                // `self.cobalt_events`.
                self.drain_cobalt_events(&mut test_fut);
                assert_eq!(self.exec.run_until_stalled(&mut test_fut), Poll::Pending);
            }
        }
fn advance_by ( & mut self , duration : zx :: Duration , mut test_fut : Pin < & mut impl Future < Output = ( ) > > , ) { assert_eq ! ( duration into_nanos ( ) STEP_INCREMENT into_nanos ( ) 0 " " duration ) ; const_assert_eq ! ( TELEMETRY_QUERY_INTERVAL into_nanos ( ) STEP_INCREMENT into_nanos ( ) 0 ) ; for _i in 0 .. ( duration . into_nanos ( ) / STEP_INCREMENT . into_nanos ( ) ) { self . exec . set_fake_time ( fasync :: Time :: after ( STEP_INCREMENT ) ) ; let _ = self . exec . wake_expired_timers ( ) ; assert_eq ! ( self exec run_until_stalled ( mut test_fut ) Poll Pending ) ; respond_iface_stats_req ( & mut self . exec , & mut self . dev_svc_stream , & mut self . iface_stats_req_handler , ) ; // Respond to any potential Cobalt request, draining their payloads to // `self.cobalt_events`. self . drain_cobalt_events ( & mut test_fut ) ; assert_eq ! ( self exec run_until_stalled ( mut test_fut ) Poll Pending ) ; } }
Advance executor by `duration`.
Advance executor by ` duration ` .
&mut self
duration
zx::Duration
test_fut
Pin<&mut impl Future<Output = ()>>