Merge "Fix AvatarPhotoControllerTest." into tm-dev

This commit is contained in:
Oli Lan
2022-03-10 09:46:36 +00:00
committed by Android (Google) Code Review

View File

@@ -89,6 +89,10 @@ public class AvatarPhotoControllerTest {
@After
public void tearDown() {
String[] entries = mImagesDir.list();
for (String entry : entries) {
new File(mImagesDir, entry).delete();
}
mImagesDir.delete();
}
@@ -233,7 +237,8 @@ public class AvatarPhotoControllerTest {
public void internalCropUsedIfNoSystemCropperFound() throws IOException {
when(mMockAvatarUi.startSystemActivityForResult(any(), anyInt())).thenReturn(false);
new File(mImagesDir, "file.txt").createNewFile();
File file = new File(mImagesDir, "file.txt");
saveBitmapToFile(file);
Intent intent = new Intent();
intent.setData(Uri.parse(
@@ -241,10 +246,6 @@ public class AvatarPhotoControllerTest {
mController.onActivityResult(
REQUEST_CODE_TAKE_PHOTO, Activity.RESULT_OK, intent);
Intent startIntent = verifyStartSystemActivityForResult(
"com.android.camera.action.CROP", REQUEST_CODE_CROP_PHOTO);
assertThat(startIntent.getData()).isNotEqualTo(mTakePhotoUri);
verify(mMockAvatarUi, timeout(TIMEOUT_MILLIS)).returnUriResult(mCropPhotoUri);
InputStream imageStream = mContext.getContentResolver().openInputStream(mCropPhotoUri);