Merge "Add tests for optional screenshot Fd in bugreport API" into qt-dev

am: f0e0af70ab

Change-Id: I1a151b050f4869cb84c835edf08ff1fdc03fd23b
This commit is contained in:
Abhijeet Kaur
2019-05-21 10:37:26 -07:00
committed by android-build-merger

View File

@@ -88,7 +88,9 @@ public class BugreportManagerTest {
@Test @Test
public void normalFlow_wifi() throws Exception { public void normalFlow_wifi() throws Exception {
BugreportCallbackImpl callback = new BugreportCallbackImpl(); BugreportCallbackImpl callback = new BugreportCallbackImpl();
mBrm.startBugreport(mBugreportFd, mScreenshotFd, wifi(), mExecutor, callback); // wifi bugreport does not take screenshot
mBrm.startBugreport(mBugreportFd, null /*screenshotFd = null*/, wifi(),
mExecutor, callback);
waitTillDoneOrTimeout(callback); waitTillDoneOrTimeout(callback);
assertThat(callback.isDone()).isTrue(); assertThat(callback.isDone()).isTrue();
@@ -99,13 +101,15 @@ public class BugreportManagerTest {
// of mBugreportFd. // of mBugreportFd.
assertThat(callback.getErrorCode()).isEqualTo( assertThat(callback.getErrorCode()).isEqualTo(
BugreportCallback.BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT); BugreportCallback.BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT);
assertFdsAreClosed(mBugreportFd, mScreenshotFd); assertFdsAreClosed(mBugreportFd);
} }
@Test @Test
public void normalFlow_interactive() throws Exception { public void normalFlow_interactive() throws Exception {
BugreportCallbackImpl callback = new BugreportCallbackImpl(); BugreportCallbackImpl callback = new BugreportCallbackImpl();
mBrm.startBugreport(mBugreportFd, mScreenshotFd, interactive(), mExecutor, callback); // interactive bugreport does not take screenshot
mBrm.startBugreport(mBugreportFd, null /*screenshotFd = null*/, interactive(),
mExecutor, callback);
waitTillDoneOrTimeout(callback); waitTillDoneOrTimeout(callback);
assertThat(callback.isDone()).isTrue(); assertThat(callback.isDone()).isTrue();
@@ -113,7 +117,7 @@ public class BugreportManagerTest {
assertThat(callback.hasReceivedProgress()).isTrue(); assertThat(callback.hasReceivedProgress()).isTrue();
assertThat(callback.getErrorCode()).isEqualTo( assertThat(callback.getErrorCode()).isEqualTo(
BugreportCallback.BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT); BugreportCallback.BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT);
assertFdsAreClosed(mBugreportFd, mScreenshotFd); assertFdsAreClosed(mBugreportFd);
} }
@Test @Test