Updating startUser_realistic to waiting for start user callback
Instead this test wait for ACTION_USER_STARTED broadcast, will measure time until the callback after start user execution. Bug: 265289462 Test: Manual test Change-Id: Ib6fa26ea6fd17e92d29b511879bdd8c80a219d43
This commit is contained in:
committed by
Jackson Michael Moreira Miranda
parent
47fddf4dd2
commit
9547060ac6
@@ -16,6 +16,7 @@
|
||||
package android.multiuser;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
@@ -241,24 +242,27 @@ public class UserLifecycleTests {
|
||||
|
||||
/**
|
||||
* Tests starting an uninitialized user, with wait times in between iterations.
|
||||
* Measures the time until ACTION_USER_STARTED is received.
|
||||
* Measures the time until the ProgressListener callback.
|
||||
*/
|
||||
@Test(timeout = TIMEOUT_MAX_TEST_TIME_MS)
|
||||
public void startUser_realistic() throws RemoteException {
|
||||
while (mRunner.keepRunning()) {
|
||||
mRunner.pauseTiming();
|
||||
final int userId = createUserNoFlags();
|
||||
final ProgressWaiter waiter = new ProgressWaiter();
|
||||
|
||||
waitForBroadcastIdle();
|
||||
runThenWaitForBroadcasts(userId, () -> {
|
||||
mRunner.resumeTiming();
|
||||
Log.i(TAG, "Starting timer");
|
||||
mRunner.resumeTiming();
|
||||
Log.i(TAG, "Starting timer");
|
||||
|
||||
mIam.startUserInBackground(userId);
|
||||
}, Intent.ACTION_USER_STARTED);
|
||||
final boolean success = mIam.startUserInBackgroundWithListener(userId, waiter)
|
||||
&& waiter.waitForFinish(TIMEOUT_IN_SECOND * 1000);
|
||||
|
||||
mRunner.pauseTiming();
|
||||
Log.i(TAG, "Stopping timer");
|
||||
|
||||
assertTrue("Error: could not start user " + userId, success);
|
||||
|
||||
removeUser(userId);
|
||||
waitCoolDownPeriod();
|
||||
mRunner.resumeTimingForNextIteration();
|
||||
|
||||
Reference in New Issue
Block a user