From 63149c81adf79f43c6508647614247277f8052e2 Mon Sep 17 00:00:00 2001 From: Hong Teng Date: Wed, 30 Nov 2011 16:54:46 -0800 Subject: Fixd for 5490443 Native crash while exporting a video - Add new onError callback to PreviewProgressListener, which is used to indicate video editor application for the error that has occurred during priviewing. With this modification, the application must implement the onError method, and then VideoEditorPreviewTest.java is changed accordingly. Change-Id: I15610b8907fcf8bd35a3c69ad7c07b5175a6e309 --- .../videoeditor/VideoEditorPreviewTest.java | 38 ++++++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'media/tests/MediaFrameworkTest') diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorPreviewTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorPreviewTest.java index e848f5f..3c08138 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorPreviewTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorPreviewTest.java @@ -93,6 +93,7 @@ public class VideoEditorPreviewTest extends private boolean previewStart; private boolean previewStop; + private boolean previewError; /* Minimum waiting time for Semaphore to wait for release */ private final long minWaitingTime = 3000; @@ -141,7 +142,9 @@ public class VideoEditorPreviewTest extends protected void setPreviewStop() { previewStop = true; } - + protected void setPreviewError() { + previewError = true; + } protected void validatePreviewProgress(int startMs, int endMs, boolean loop, long duration) throws Exception { @@ -149,6 +152,7 @@ public class VideoEditorPreviewTest extends final Semaphore blockTillPreviewCompletes = new Semaphore(1); previewStart = false; previewStop = false; + previewError = false; mVideoEditor.generatePreview(new MediaProcessingProgressListener() { int i = 0; public void onProgress(Object item, int action, int progress) { @@ -187,6 +191,10 @@ public class VideoEditorPreviewTest extends setPreviewStop(); blockTillPreviewCompletes.release(); } + public void onError(VideoEditor videoEditor, int error) { + setPreviewError(); + blockTillPreviewCompletes.release(); + } }); } catch (Exception e) { blockTillPreviewCompletes.release(); @@ -196,6 +204,7 @@ public class VideoEditorPreviewTest extends mVideoEditor.stopPreview(); assertTrue("Preview Failed to start", previewStart); assertTrue("Preview Failed to stop", previewStop); + assertFalse("Preview Error occurred", previewError); blockTillPreviewCompletes.release(); } @@ -399,6 +408,7 @@ public class VideoEditorPreviewTest extends "TransitionSpiral_QVGA.jpg"; previewStart = false; previewStop = false; + previewError = false; final Semaphore blockTillPreviewCompletes = new Semaphore(1); @@ -490,6 +500,10 @@ public class VideoEditorPreviewTest extends setPreviewStop(); blockTillPreviewCompletes.release(); } + public void onError(VideoEditor videoEditor, int error) { + setPreviewError(); + blockTillPreviewCompletes.release(); + } }); } catch (Exception e) { blockTillPreviewCompletes.release(); @@ -499,6 +513,7 @@ public class VideoEditorPreviewTest extends blockTillPreviewCompletes.release(); assertTrue("Preview Failed to start", previewStart); assertTrue("Preview Failed to stop", previewStop); + assertFalse("Preview Error occurred", previewError); assertEquals("Removing Transition " + transition1And2CrossFade.getId(), transition1And2CrossFade, @@ -677,6 +692,7 @@ public class VideoEditorPreviewTest extends final Semaphore blockTillPreviewCompletes = new Semaphore(1); previewStart = false; previewStop = false; + previewError = false; final MediaVideoItem mediaVideoItem1 = mVideoEditorHelper.createMediaItem(mVideoEditor, "m1", @@ -727,6 +743,10 @@ public class VideoEditorPreviewTest extends setPreviewStop(); blockTillPreviewCompletes.release(); } + public void onError(VideoEditor videoEditor, int error) { + setPreviewError(); + blockTillPreviewCompletes.release(); + } }); } catch (Exception e) { @@ -736,6 +756,8 @@ public class VideoEditorPreviewTest extends mVideoEditor.stopPreview(); assertTrue("Preview Failed to start", previewStart); assertTrue("Preview Failed to stop", previewStop); + assertFalse("Preview Error occurred", previewError); + blockTillPreviewCompletes.release(); } @@ -784,6 +806,10 @@ public class VideoEditorPreviewTest extends setPreviewStop(); blockTillPreviewCompletes.release(); } + public void onError(VideoEditor videoEditor, int error) { + setPreviewError(); + blockTillPreviewCompletes.release(); + } }); } catch (IllegalArgumentException e) { @@ -1023,7 +1049,10 @@ public class VideoEditorPreviewTest extends } public void onStop(VideoEditor videoEditor) { setPreviewStop(); - } + } + public void onError(VideoEditor videoEditor, int error) { + setPreviewError(); + } }); }catch (IllegalArgumentException e) { flagForException = true; @@ -1089,7 +1118,10 @@ public class VideoEditorPreviewTest extends } public void onStop(VideoEditor videoEditor) { setPreviewStop(); - } + } + public void onError(VideoEditor videoEditor, int error) { + setPreviewError(); + } }); }catch (IllegalArgumentException e) { flagForException = true; -- cgit v1.1