Add test for DirectRTCClient in AppRTC Demo for Android
Test is very simple but should test the basic sanity of the class. Test is implemented as a JUnit test using Robolectric. Also removed unused imports from TCPChannelClientTest. Review-Url: https://codereview.webrtc.org/1989013003 Cr-Commit-Position: refs/heads/master@{#12804}
This commit is contained in:
@ -245,7 +245,7 @@ public class CallActivity extends Activity
|
||||
appRtcClient = new WebSocketRTCClient(this, new LooperExecutor());
|
||||
} else {
|
||||
Log.i(TAG, "Using DirectRTCClient because room name looks like an IP.");
|
||||
appRtcClient = new DirectRTCClient(this);
|
||||
appRtcClient = new DirectRTCClient(this, new LooperExecutor());
|
||||
}
|
||||
// Create connection parameters.
|
||||
roomConnectionParameters = new RoomConnectionParameters(
|
||||
|
||||
@ -64,9 +64,9 @@ public class DirectRTCClient implements AppRTCClient, TCPChannelClient.TCPChanne
|
||||
// All alterations of the room state should be done from inside the looper thread.
|
||||
private ConnectionState roomState;
|
||||
|
||||
public DirectRTCClient(SignalingEvents events) {
|
||||
public DirectRTCClient(SignalingEvents events, LooperExecutor looperExecutor) {
|
||||
this.events = events;
|
||||
executor = new LooperExecutor();
|
||||
executor = looperExecutor;
|
||||
|
||||
executor.requestStart();
|
||||
roomState = ConnectionState.NEW;
|
||||
@ -100,7 +100,6 @@ public class DirectRTCClient implements AppRTCClient, TCPChannelClient.TCPChanne
|
||||
disconnectFromRoomInternal();
|
||||
}
|
||||
});
|
||||
executor.requestStop();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -296,11 +295,13 @@ public class DirectRTCClient implements AppRTCClient, TCPChannelClient.TCPChanne
|
||||
@Override
|
||||
public void onTCPError(String description) {
|
||||
reportError("TCP connection error: " + description);
|
||||
executor.requestStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTCPClose() {
|
||||
events.onChannelClose();
|
||||
executor.requestStop();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user