Make AppRTCDemoTest pass without Internet connection.
The AppRTCDemoTest is failing if the Android device lacks an Internet connection (e.g. is in flight mode). This change makes it benefit from the work done in https://review.webrtc.org/36769004/ to work around that limitation for loopback tests. R=phoglund@webrtc.org TBR=glaznev@webrtc.org BUG=4421 TESTED=Successful run on Nexus 7 (2013) in flight mode using: ninja -C out/Release . build/android/envsetup.sh adb install -r out/Release/apks/AppRTCDemo.apk webrtc/build/android/test_runner.py instrumentation --test-apk AppRTCDemoTest --verbose --release Review URL: https://webrtc-codereview.appspot.com/45649004 Cr-Commit-Position: refs/heads/master@{#8714} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8714 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
0c5b137e7e
commit
503a9e822a
@ -330,9 +330,16 @@ public class PeerConnectionClient {
|
||||
events.onPeerConnectionError("Failed to initializeAndroidGlobals");
|
||||
}
|
||||
factory = new PeerConnectionFactory();
|
||||
configureFactory(factory);
|
||||
Log.d(TAG, "Peer connection factory created.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook where tests can provide additional configuration for the factory.
|
||||
*/
|
||||
protected void configureFactory(PeerConnectionFactory factory) {
|
||||
}
|
||||
|
||||
private void createPeerConnectionInternal() {
|
||||
if (factory == null || isError) {
|
||||
Log.e(TAG, "Peerconnection factory is not created");
|
||||
|
@ -40,6 +40,7 @@ import org.appspot.apprtc.util.LooperExecutor;
|
||||
import org.webrtc.IceCandidate;
|
||||
import org.webrtc.MediaConstraints;
|
||||
import org.webrtc.PeerConnection;
|
||||
import org.webrtc.PeerConnectionFactory;
|
||||
import org.webrtc.SessionDescription;
|
||||
import org.webrtc.StatsReport;
|
||||
import org.webrtc.VideoRenderer;
|
||||
@ -123,6 +124,17 @@ public class PeerConnectionClientTest extends InstrumentationTestCase
|
||||
}
|
||||
}
|
||||
|
||||
// Test instance of the PeerConnectionClient class that overrides the options
|
||||
// for the factory so we can run the test without an Internet connection.
|
||||
class TestPeerConnectionClient extends PeerConnectionClient {
|
||||
protected void configureFactory(PeerConnectionFactory factory) {
|
||||
PeerConnectionFactory.Options options =
|
||||
new PeerConnectionFactory.Options();
|
||||
options.networkIgnoreMask = 0;
|
||||
factory.setOptions(options);
|
||||
}
|
||||
}
|
||||
|
||||
// Peer connection events implementation.
|
||||
@Override
|
||||
public void onLocalDescription(SessionDescription sdp) {
|
||||
@ -259,7 +271,7 @@ public class PeerConnectionClientTest extends InstrumentationTestCase
|
||||
0, 0, 0, 0, videoCodec, true, // video codec parameters.
|
||||
0, "OPUS", true); // audio codec parameters.
|
||||
|
||||
PeerConnectionClient client = new PeerConnectionClient();
|
||||
PeerConnectionClient client = new TestPeerConnectionClient();
|
||||
client.createPeerConnectionFactory(
|
||||
getInstrumentation().getContext(), null,
|
||||
peerConnectionParameters, this);
|
||||
|
Loading…
Reference in New Issue
Block a user