Skip to content

Commit

Permalink
improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
burak-58 committed Nov 23, 2023
1 parent e8a38de commit d3b9138
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@
import android.hardware.display.VirtualDisplay;
import android.media.projection.MediaProjection;
import android.media.projection.MediaProjectionManager;
import android.util.Log;
import android.view.Display;
import android.view.Surface;
import android.view.WindowManager;

import androidx.annotation.Nullable;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
import org.mockito.Mockito;
import org.webrtc.CapturerObserver;
import org.webrtc.ScreenCapturerAndroid;
Expand All @@ -28,6 +32,27 @@

public class ScreenCapturerAndroidTest {

@Rule
public TestWatcher watchman= new TestWatcher() {

@Override
protected void failed(Throwable e, Description description) {
Log.i("TestWatcher", "*** "+description + " failed!\n");
}

@Override
protected void succeeded(Description description) {
Log.i("TestWatcher", "*** "+description + " succeeded!\n");
}

protected void starting(Description description) {
Log.i("TestWatcher", "******\n*** "+description + " starting!\n");
}

protected void finished(Description description) {
Log.i("TestWatcher", "*** "+description + " finished!\n******\n");
}
};
@Test
public void testRotateScreen() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,11 @@ public void testCreatePeerConnection() {

verify(webRTCClient, never()).reportError(eq(streamId), anyString());

try {
Thread.sleep(2000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
doThrow(new NullPointerException()).when(webRTCClient).createMediaConstraintsInternal();
webRTCClient.createPeerConnection(streamId);
verify(webRTCClient, timeout(10000)).reportError(eq(streamId), anyString());
Expand Down

0 comments on commit d3b9138

Please sign in to comment.