Commit db32f981 authored by Finnur Thorarinsson's avatar Finnur Thorarinsson Committed by Commit Bot

[Android] Photo Picker: Add a simple RenderTest.

The test selects the first photo, scrolls to the bottom and back up
to the top to make sure the selection border is active and of correct
size (old bug I encountered once).

This should also function as a regression test for bugs like the one
seen in issue 1051523 (where a white circle got overlaid on top of
all photos).

Bug: 1051523, 656015
Change-Id: Ifb119c5e9450be5ef06b303eb3549315c0e4a623
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2083178
Commit-Queue: Finnur Thorarinsson <finnur@chromium.org>
Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747188}
parent ada8150d
...@@ -108,6 +108,11 @@ public class DecoderServiceHost ...@@ -108,6 +108,11 @@ public class DecoderServiceHost
* A function to define to receive a notification once the service is up and running. * A function to define to receive a notification once the service is up and running.
*/ */
void serviceReady(); void serviceReady();
/**
* Called when the decoder is idle.
*/
void decoderIdle();
} }
/** /**
...@@ -340,6 +345,10 @@ public class DecoderServiceHost ...@@ -340,6 +345,10 @@ public class DecoderServiceHost
mFailedVideoDecodesIo = 0; mFailedVideoDecodesIo = 0;
mFailedVideoDecodesUnknown = 0; mFailedVideoDecodesUnknown = 0;
} }
for (DecoderStatusCallback callback : mCallbacks) {
callback.decoderIdle();
}
} }
/** /**
......
...@@ -341,6 +341,9 @@ public class PickerCategoryView extends RelativeLayout ...@@ -341,6 +341,9 @@ public class PickerCategoryView extends RelativeLayout
processBitmaps(); processBitmaps();
} }
@Override
public void decoderIdle() {}
// RecyclerView.RecyclerListener: // RecyclerView.RecyclerListener:
@Override @Override
......
...@@ -49,10 +49,10 @@ public class DecoderServiceHostTest implements DecoderServiceHost.DecoderStatusC ...@@ -49,10 +49,10 @@ public class DecoderServiceHostTest implements DecoderServiceHost.DecoderStatusC
private Context mContext; private Context mContext;
// A callback that fires when the decoder is ready. // A callback that fires when the decoder is ready.
public final CallbackHelper onDecoderReadyCallback = new CallbackHelper(); public final CallbackHelper mOnDecoderReadyCallback = new CallbackHelper();
// A callback that fires when something is finished decoding in the dialog. // A callback that fires when something is finished decoding in the dialog.
public final CallbackHelper onDecodedCallback = new CallbackHelper(); public final CallbackHelper mOnDecodedCallback = new CallbackHelper();
private String mLastDecodedPath; private String mLastDecodedPath;
private boolean mLastIsVideo; private boolean mLastIsVideo;
...@@ -73,9 +73,12 @@ public class DecoderServiceHostTest implements DecoderServiceHost.DecoderStatusC ...@@ -73,9 +73,12 @@ public class DecoderServiceHostTest implements DecoderServiceHost.DecoderStatusC
@Override @Override
public void serviceReady() { public void serviceReady() {
onDecoderReadyCallback.notifyCalled(); mOnDecoderReadyCallback.notifyCalled();
} }
@Override
public void decoderIdle() {}
// DecoderServiceHost.ImagesDecodedCallback: // DecoderServiceHost.ImagesDecodedCallback:
@Override @Override
...@@ -88,18 +91,18 @@ public class DecoderServiceHostTest implements DecoderServiceHost.DecoderStatusC ...@@ -88,18 +91,18 @@ public class DecoderServiceHostTest implements DecoderServiceHost.DecoderStatusC
mLastVideoDuration = videoDuration; mLastVideoDuration = videoDuration;
mLastRatio = ratio; mLastRatio = ratio;
onDecodedCallback.notifyCalled(); mOnDecodedCallback.notifyCalled();
} }
private void waitForDecoder() throws Exception { private void waitForDecoder() throws Exception {
int callCount = onDecoderReadyCallback.getCallCount(); int callCount = mOnDecoderReadyCallback.getCallCount();
onDecoderReadyCallback.waitForCallback( mOnDecoderReadyCallback.waitForCallback(
callCount, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS); callCount, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
} }
private void waitForThumbnailDecode() throws Exception { private void waitForThumbnailDecode() throws Exception {
int callCount = onDecodedCallback.getCallCount(); int callCount = mOnDecodedCallback.getCallCount();
onDecodedCallback.waitForCallback(callCount, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS); mOnDecodedCallback.waitForCallback(callCount, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
} }
private void decodeImage(DecoderServiceHost host, Uri uri, @PickerBitmap.TileTypes int fileType, private void decodeImage(DecoderServiceHost host, Uri uri, @PickerBitmap.TileTypes int fileType,
......
712be6658684375f38d598a119343b391acdffde
\ No newline at end of file
45dd2fd26f943d60d1b4bb4f113fbe7c2c69bd00
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment