Add SetConfig method to FakeNetworkPipe and to DirectTransport
This method allow the user to change the network configuration
during run-time. This is useful when testing how components react
to changing bandwidth.
BUG=2636
R=mflodman@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/9049004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@5612 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/test/fake_network_pipe.cc b/test/fake_network_pipe.cc
index 5a2424e..c5caef2 100644
--- a/test/fake_network_pipe.cc
+++ b/test/fake_network_pipe.cc
@@ -93,6 +93,11 @@
packet_receiver_ = receiver;
}
+void FakeNetworkPipe::SetConfig(const FakeNetworkPipe::Config& config) {
+ CriticalSectionScoped crit(lock_.get());
+ config_ = config; // Shallow copy of the struct.
+}
+
void FakeNetworkPipe::SendPacket(const uint8_t* data, size_t data_length) {
// A NULL packet_receiver_ means that this pipe will terminate the flow of
// packets.